mirror of https://github.com/bkaradzic/bgfx
Updated ImGui.
This commit is contained in:
parent
23994e7f23
commit
133b7ce91f
|
@ -1187,13 +1187,8 @@ void ImGuiIO::ClearInputCharacters()
|
||||||
InputQueueCharacters.resize(0);
|
InputQueueCharacters.resize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiIO::AddFocusEvent(bool focused)
|
void ImGuiIO::ClearInputKeys()
|
||||||
{
|
{
|
||||||
if (focused)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Clear buttons state when focus is lost
|
|
||||||
// (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle)
|
|
||||||
memset(KeysDown, 0, sizeof(KeysDown));
|
memset(KeysDown, 0, sizeof(KeysDown));
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(KeysDownDuration); n++)
|
for (int n = 0; n < IM_ARRAYSIZE(KeysDownDuration); n++)
|
||||||
KeysDownDuration[n] = KeysDownDurationPrev[n] = -1.0f;
|
KeysDownDuration[n] = KeysDownDurationPrev[n] = -1.0f;
|
||||||
|
@ -1203,6 +1198,13 @@ void ImGuiIO::AddFocusEvent(bool focused)
|
||||||
NavInputsDownDuration[n] = NavInputsDownDurationPrev[n] = -1.0f;
|
NavInputsDownDuration[n] = NavInputsDownDurationPrev[n] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGuiIO::AddFocusEvent(bool focused)
|
||||||
|
{
|
||||||
|
// We intentionally overwrite this and process in NewFrame(), in order to give a chance
|
||||||
|
// to multi-viewports backends to queue AddFocusEvent(false),AddFocusEvent(true) in same frame.
|
||||||
|
AppFocusLost = !focused;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -3285,13 +3287,13 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged)
|
bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (!bb.Overlaps(window->ClipRect))
|
if (!bb.Overlaps(window->ClipRect))
|
||||||
if (id == 0 || (id != g.ActiveId && id != g.NavId))
|
if (id == 0 || (id != g.ActiveId && id != g.NavId))
|
||||||
if (clip_even_when_logged || !g.LogEnabled)
|
if (!g.LogEnabled)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3888,7 +3890,7 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
|
||||||
|
|
||||||
// Modal windows prevents mouse from hovering behind them.
|
// Modal windows prevents mouse from hovering behind them.
|
||||||
ImGuiWindow* modal_window = GetTopMostPopupModal();
|
ImGuiWindow* modal_window = GetTopMostPopupModal();
|
||||||
if (modal_window && g.HoveredWindow && !IsWindowChildOf(g.HoveredWindow->RootWindow, modal_window))
|
if (modal_window && g.HoveredWindow && !IsWindowChildOf(g.HoveredWindow->RootWindow, modal_window, true))
|
||||||
clear_hovered_windows = true;
|
clear_hovered_windows = true;
|
||||||
|
|
||||||
// Disabled mouse?
|
// Disabled mouse?
|
||||||
|
@ -4072,6 +4074,18 @@ void ImGui::NewFrame()
|
||||||
g.DragDropWithinTarget = false;
|
g.DragDropWithinTarget = false;
|
||||||
g.DragDropHoldJustPressedId = 0;
|
g.DragDropHoldJustPressedId = 0;
|
||||||
|
|
||||||
|
// Close popups on focus lost (currently wip/opt-in)
|
||||||
|
//if (g.IO.AppFocusLost)
|
||||||
|
// ClosePopupsExceptModals();
|
||||||
|
|
||||||
|
// Clear buttons state when focus is lost
|
||||||
|
// (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle)
|
||||||
|
if (g.IO.AppFocusLost)
|
||||||
|
{
|
||||||
|
g.IO.ClearInputKeys();
|
||||||
|
g.IO.AppFocusLost = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Update keyboard input state
|
// Update keyboard input state
|
||||||
// Synchronize io.KeyMods with individual modifiers io.KeyXXX bools
|
// Synchronize io.KeyMods with individual modifiers io.KeyXXX bools
|
||||||
g.IO.KeyMods = GetMergedKeyModFlags();
|
g.IO.KeyMods = GetMergedKeyModFlags();
|
||||||
|
@ -5120,7 +5134,7 @@ void ImGui::EndChild()
|
||||||
ItemAdd(bb, window->ChildId);
|
ItemAdd(bb, window->ChildId);
|
||||||
RenderNavHighlight(bb, window->ChildId);
|
RenderNavHighlight(bb, window->ChildId);
|
||||||
|
|
||||||
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child
|
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying)
|
||||||
if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
|
if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
|
||||||
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
|
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
|
||||||
}
|
}
|
||||||
|
@ -5766,9 +5780,11 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||||
void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window)
|
void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window)
|
||||||
{
|
{
|
||||||
window->ParentWindow = parent_window;
|
window->ParentWindow = parent_window;
|
||||||
window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
window->RootWindow = window->RootWindowPopupTree = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
||||||
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
|
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
|
||||||
window->RootWindow = parent_window->RootWindow;
|
window->RootWindow = parent_window->RootWindow;
|
||||||
|
if (parent_window && (flags & ImGuiWindowFlags_Popup))
|
||||||
|
window->RootWindowPopupTree = parent_window->RootWindowPopupTree;
|
||||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||||
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
||||||
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
|
@ -5847,12 +5863,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
|
|
||||||
// Add to stack
|
// Add to stack
|
||||||
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
||||||
|
g.CurrentWindow = window;
|
||||||
ImGuiWindowStackData window_stack_data;
|
ImGuiWindowStackData window_stack_data;
|
||||||
window_stack_data.Window = window;
|
window_stack_data.Window = window;
|
||||||
window_stack_data.ParentLastItemDataBackup = g.LastItemData;
|
window_stack_data.ParentLastItemDataBackup = g.LastItemData;
|
||||||
|
window_stack_data.StackSizesOnBegin.SetToCurrentState();
|
||||||
g.CurrentWindowStack.push_back(window_stack_data);
|
g.CurrentWindowStack.push_back(window_stack_data);
|
||||||
g.CurrentWindow = window;
|
|
||||||
window->DC.StackSizesOnBegin.SetToCurrentState();
|
|
||||||
g.CurrentWindow = NULL;
|
g.CurrentWindow = NULL;
|
||||||
|
|
||||||
if (flags & ImGuiWindowFlags_Popup)
|
if (flags & ImGuiWindowFlags_Popup)
|
||||||
|
@ -6467,10 +6483,10 @@ void ImGui::End()
|
||||||
|
|
||||||
// Pop from window stack
|
// Pop from window stack
|
||||||
g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;
|
g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;
|
||||||
g.CurrentWindowStack.pop_back();
|
|
||||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||||
g.BeginPopupStack.pop_back();
|
g.BeginPopupStack.pop_back();
|
||||||
window->DC.StackSizesOnBegin.CompareWithCurrentState();
|
g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithCurrentState();
|
||||||
|
g.CurrentWindowStack.pop_back();
|
||||||
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
|
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6663,11 +6679,14 @@ void ImGui::BeginDisabled(bool disabled)
|
||||||
if (was_disabled || disabled)
|
if (was_disabled || disabled)
|
||||||
g.CurrentItemFlags |= ImGuiItemFlags_Disabled;
|
g.CurrentItemFlags |= ImGuiItemFlags_Disabled;
|
||||||
g.ItemFlagsStack.push_back(g.CurrentItemFlags);
|
g.ItemFlagsStack.push_back(g.CurrentItemFlags);
|
||||||
|
g.DisabledStackSize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndDisabled()
|
void ImGui::EndDisabled()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
IM_ASSERT(g.DisabledStackSize > 0);
|
||||||
|
g.DisabledStackSize--;
|
||||||
bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
|
bool was_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
|
||||||
//PopItemFlag();
|
//PopItemFlag();
|
||||||
g.ItemFlagsStack.pop_back();
|
g.ItemFlagsStack.pop_back();
|
||||||
|
@ -6711,14 +6730,25 @@ void ImGui::PopTextWrapPos()
|
||||||
window->DC.TextWrapPosStack.pop_back();
|
window->DC.TextWrapPosStack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent)
|
static ImGuiWindow* GetCombinedRootWindow(ImGuiWindow* window, bool popup_hierarchy)
|
||||||
{
|
{
|
||||||
if (window->RootWindow == potential_parent)
|
window = window->RootWindow;
|
||||||
|
if (popup_hierarchy)
|
||||||
|
window = window->RootWindowPopupTree;
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy)
|
||||||
|
{
|
||||||
|
ImGuiWindow* window_root = GetCombinedRootWindow(window, popup_hierarchy);
|
||||||
|
if (window_root == potential_parent)
|
||||||
return true;
|
return true;
|
||||||
while (window != NULL)
|
while (window != NULL)
|
||||||
{
|
{
|
||||||
if (window == potential_parent)
|
if (window == potential_parent)
|
||||||
return true;
|
return true;
|
||||||
|
if (window == window_root) // end of chain
|
||||||
|
return false;
|
||||||
window = window->ParentWindow;
|
window = window->ParentWindow;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -6750,13 +6780,13 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
|
||||||
if ((flags & ImGuiHoveredFlags_AnyWindow) == 0)
|
if ((flags & ImGuiHoveredFlags_AnyWindow) == 0)
|
||||||
{
|
{
|
||||||
IM_ASSERT(cur_window); // Not inside a Begin()/End()
|
IM_ASSERT(cur_window); // Not inside a Begin()/End()
|
||||||
|
const bool popup_hierarchy = (flags & ImGuiHoveredFlags_NoPopupHierarchy) == 0;
|
||||||
if (flags & ImGuiHoveredFlags_RootWindow)
|
if (flags & ImGuiHoveredFlags_RootWindow)
|
||||||
cur_window = cur_window->RootWindow;
|
cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy);
|
||||||
|
|
||||||
bool result;
|
bool result;
|
||||||
if (flags & ImGuiHoveredFlags_ChildWindows)
|
if (flags & ImGuiHoveredFlags_ChildWindows)
|
||||||
result = IsWindowChildOf(ref_window, cur_window);
|
result = IsWindowChildOf(ref_window, cur_window, popup_hierarchy);
|
||||||
else
|
else
|
||||||
result = (ref_window == cur_window);
|
result = (ref_window == cur_window);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -6783,11 +6813,12 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
||||||
return true;
|
return true;
|
||||||
IM_ASSERT(cur_window); // Not inside a Begin()/End()
|
IM_ASSERT(cur_window); // Not inside a Begin()/End()
|
||||||
|
|
||||||
|
const bool popup_hierarchy = (flags & ImGuiFocusedFlags_NoPopupHierarchy) == 0;
|
||||||
if (flags & ImGuiHoveredFlags_RootWindow)
|
if (flags & ImGuiHoveredFlags_RootWindow)
|
||||||
cur_window = cur_window->RootWindow;
|
cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy);
|
||||||
|
|
||||||
if (flags & ImGuiHoveredFlags_ChildWindows)
|
if (flags & ImGuiHoveredFlags_ChildWindows)
|
||||||
return IsWindowChildOf(ref_window, cur_window);
|
return IsWindowChildOf(ref_window, cur_window, popup_hierarchy);
|
||||||
else
|
else
|
||||||
return (ref_window == cur_window);
|
return (ref_window == cur_window);
|
||||||
}
|
}
|
||||||
|
@ -7313,53 +7344,13 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
|
||||||
{
|
{
|
||||||
// PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
|
// PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
while (g.CurrentWindowStack.Size > 0)
|
while (g.CurrentWindowStack.Size > 0) //-V1044
|
||||||
{
|
{
|
||||||
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
|
ErrorCheckEndWindowRecover(log_callback, user_data);
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name);
|
|
||||||
EndTable();
|
|
||||||
}
|
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
IM_ASSERT(window != NULL);
|
|
||||||
while (g.CurrentTabBar != NULL) //-V1044
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'", window->Name);
|
|
||||||
EndTabBar();
|
|
||||||
}
|
|
||||||
while (window->DC.TreeDepth > 0)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing TreePop() in '%s'", window->Name);
|
|
||||||
TreePop();
|
|
||||||
}
|
|
||||||
while (g.GroupStack.Size > window->DC.StackSizesOnBegin.SizeOfGroupStack)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndGroup() in '%s'", window->Name);
|
|
||||||
EndGroup();
|
|
||||||
}
|
|
||||||
while (window->IDStack.Size > 1)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing PopID() in '%s'", window->Name);
|
|
||||||
PopID();
|
|
||||||
}
|
|
||||||
while (g.ColorStack.Size > window->DC.StackSizesOnBegin.SizeOfColorStack)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s", window->Name, GetStyleColorName(g.ColorStack.back().Col));
|
|
||||||
PopStyleColor();
|
|
||||||
}
|
|
||||||
while (g.StyleVarStack.Size > window->DC.StackSizesOnBegin.SizeOfStyleVarStack)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name);
|
|
||||||
PopStyleVar();
|
|
||||||
}
|
|
||||||
while (g.FocusScopeStack.Size > window->DC.StackSizesOnBegin.SizeOfFocusScopeStack)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name);
|
|
||||||
PopFocusScope();
|
|
||||||
}
|
|
||||||
if (g.CurrentWindowStack.Size == 1)
|
if (g.CurrentWindowStack.Size == 1)
|
||||||
{
|
{
|
||||||
IM_ASSERT(g.CurrentWindow->IsFallbackWindow);
|
IM_ASSERT(window->IsFallbackWindow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
IM_ASSERT(window == g.CurrentWindow);
|
IM_ASSERT(window == g.CurrentWindow);
|
||||||
|
@ -7376,6 +7367,66 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must be called before End()/EndChild()
|
||||||
|
void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name);
|
||||||
|
EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
ImGuiStackSizes* stack_sizes = &g.CurrentWindowStack.back().StackSizesOnBegin;
|
||||||
|
IM_ASSERT(window != NULL);
|
||||||
|
while (g.CurrentTabBar != NULL) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'", window->Name);
|
||||||
|
EndTabBar();
|
||||||
|
}
|
||||||
|
while (window->DC.TreeDepth > 0)
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing TreePop() in '%s'", window->Name);
|
||||||
|
TreePop();
|
||||||
|
}
|
||||||
|
while (g.GroupStack.Size > stack_sizes->SizeOfGroupStack) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing EndGroup() in '%s'", window->Name);
|
||||||
|
EndGroup();
|
||||||
|
}
|
||||||
|
while (window->IDStack.Size > 1)
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing PopID() in '%s'", window->Name);
|
||||||
|
PopID();
|
||||||
|
}
|
||||||
|
while (g.DisabledStackSize > stack_sizes->SizeOfDisabledStack) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing EndDisabled() in '%s'", window->Name);
|
||||||
|
EndDisabled();
|
||||||
|
}
|
||||||
|
while (g.ColorStack.Size > stack_sizes->SizeOfColorStack)
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s", window->Name, GetStyleColorName(g.ColorStack.back().Col));
|
||||||
|
PopStyleColor();
|
||||||
|
}
|
||||||
|
while (g.ItemFlagsStack.Size > stack_sizes->SizeOfItemFlagsStack) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing PopItemFlag() in '%s'", window->Name);
|
||||||
|
PopItemFlag();
|
||||||
|
}
|
||||||
|
while (g.StyleVarStack.Size > stack_sizes->SizeOfStyleVarStack) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name);
|
||||||
|
PopStyleVar();
|
||||||
|
}
|
||||||
|
while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack) //-V1044
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name);
|
||||||
|
PopFocusScope();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save current stack sizes for later compare
|
// Save current stack sizes for later compare
|
||||||
void ImGuiStackSizes::SetToCurrentState()
|
void ImGuiStackSizes::SetToCurrentState()
|
||||||
{
|
{
|
||||||
|
@ -7387,7 +7438,9 @@ void ImGuiStackSizes::SetToCurrentState()
|
||||||
SizeOfFontStack = (short)g.FontStack.Size;
|
SizeOfFontStack = (short)g.FontStack.Size;
|
||||||
SizeOfFocusScopeStack = (short)g.FocusScopeStack.Size;
|
SizeOfFocusScopeStack = (short)g.FocusScopeStack.Size;
|
||||||
SizeOfGroupStack = (short)g.GroupStack.Size;
|
SizeOfGroupStack = (short)g.GroupStack.Size;
|
||||||
|
SizeOfItemFlagsStack = (short)g.ItemFlagsStack.Size;
|
||||||
SizeOfBeginPopupStack = (short)g.BeginPopupStack.Size;
|
SizeOfBeginPopupStack = (short)g.BeginPopupStack.Size;
|
||||||
|
SizeOfDisabledStack = (short)g.DisabledStackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare to detect usage errors
|
// Compare to detect usage errors
|
||||||
|
@ -7405,6 +7458,8 @@ void ImGuiStackSizes::CompareWithCurrentState()
|
||||||
// For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.
|
// For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.
|
||||||
IM_ASSERT(SizeOfGroupStack == g.GroupStack.Size && "BeginGroup/EndGroup Mismatch!");
|
IM_ASSERT(SizeOfGroupStack == g.GroupStack.Size && "BeginGroup/EndGroup Mismatch!");
|
||||||
IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size && "BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!");
|
IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size && "BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!");
|
||||||
|
IM_ASSERT(SizeOfDisabledStack == g.DisabledStackSize && "BeginDisabled/EndDisabled Mismatch!");
|
||||||
|
IM_ASSERT(SizeOfItemFlagsStack >= g.ItemFlagsStack.Size && "PushItemFlag/PopItemFlag Mismatch!");
|
||||||
IM_ASSERT(SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!");
|
IM_ASSERT(SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!");
|
||||||
IM_ASSERT(SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!");
|
IM_ASSERT(SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!");
|
||||||
IM_ASSERT(SizeOfFontStack >= g.FontStack.Size && "PushFont/PopFont Mismatch!");
|
IM_ASSERT(SizeOfFontStack >= g.FontStack.Size && "PushFont/PopFont Mismatch!");
|
||||||
|
@ -7536,7 +7591,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clipping test
|
// Clipping test
|
||||||
const bool is_clipped = IsClippedEx(bb, id, false);
|
const bool is_clipped = IsClippedEx(bb, id);
|
||||||
if (is_clipped)
|
if (is_clipped)
|
||||||
return false;
|
return false;
|
||||||
//if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]
|
//if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]
|
||||||
|
@ -8326,6 +8381,21 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::ClosePopupsExceptModals()
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
|
int popup_count_to_keep;
|
||||||
|
for (popup_count_to_keep = g.OpenPopupStack.Size; popup_count_to_keep > 0; popup_count_to_keep--)
|
||||||
|
{
|
||||||
|
ImGuiWindow* window = g.OpenPopupStack[popup_count_to_keep - 1].Window;
|
||||||
|
if (!window || window->Flags & ImGuiWindowFlags_Modal)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
|
||||||
|
ClosePopupToLevel(popup_count_to_keep, true);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
|
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
@ -9752,8 +9822,9 @@ static void ImGui::NavUpdateWindowing()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start CTRL-TAB or Square+L/R window selection
|
// Start CTRL-TAB or Square+L/R window selection
|
||||||
bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
const bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
||||||
|
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && nav_keyboard_active && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab);
|
||||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
||||||
{
|
{
|
||||||
|
@ -9804,7 +9875,7 @@ static void ImGui::NavUpdateWindowing()
|
||||||
// Keyboard: Press and Release ALT to toggle menu layer
|
// Keyboard: Press and Release ALT to toggle menu layer
|
||||||
// - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.
|
// - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.
|
||||||
// - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
|
// - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
|
||||||
if (io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0)
|
if (nav_keyboard_active && io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0)
|
||||||
{
|
{
|
||||||
g.NavWindowingToggleLayer = true;
|
g.NavWindowingToggleLayer = true;
|
||||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||||
|
|
|
@ -64,7 +64,7 @@ Index of this file:
|
||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.85 WIP"
|
#define IMGUI_VERSION "1.85 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18414
|
#define IMGUI_VERSION_NUM 18417
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
|
@ -522,12 +522,12 @@ namespace ImGui
|
||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Drag Sliders
|
// Widgets: Drag Sliders
|
||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
||||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||||
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
|
@ -546,7 +546,7 @@ namespace ImGui
|
||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Regular Sliders
|
// Widgets: Regular Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
|
@ -1267,7 +1267,8 @@ enum ImGuiFocusedFlags_
|
||||||
ImGuiFocusedFlags_ChildWindows = 1 << 0, // Return true if any children of the window is focused
|
ImGuiFocusedFlags_ChildWindows = 1 << 0, // Return true if any children of the window is focused
|
||||||
ImGuiFocusedFlags_RootWindow = 1 << 1, // Test from root window (top most parent of the current hierarchy)
|
ImGuiFocusedFlags_RootWindow = 1 << 1, // Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
||||||
//ImGuiFocusedFlags_DockHierarchy = 1 << 3, // Consider docking hierarchy (treat dockspace host as parent of docked window)
|
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
|
//ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1280,12 +1281,13 @@ enum ImGuiHoveredFlags_
|
||||||
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
||||||
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
||||||
//ImGuiHoveredFlags_DockHierarchy = 1 << 3, // IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window)
|
ImGuiHoveredFlags_NoPopupHierarchy = 1 << 3, // IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 4, // Return true even if a popup window is normally blocking access to this item/window
|
//ImGuiHoveredFlags_DockHierarchy = 1 << 4, // IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5, // Return true even if a popup window is normally blocking access to this item/window
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
||||||
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is obstructed or overlapped by another window
|
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
||||||
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled
|
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, // Return true even if the position is obstructed or overlapped by another window
|
||||||
|
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // Return true even if the item is disabled
|
||||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
@ -1892,8 +1894,9 @@ struct ImGuiIO
|
||||||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
||||||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
||||||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
||||||
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
|
||||||
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
||||||
|
IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually
|
||||||
|
IMGUI_API void ClearInputKeys(); // [Internal] Release all keys
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Output - Updated by NewFrame() or EndFrame()/Render()
|
// Output - Updated by NewFrame() or EndFrame()/Render()
|
||||||
|
@ -1941,6 +1944,7 @@ struct ImGuiIO
|
||||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||||
|
bool AppFocusLost;
|
||||||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
||||||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
//if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar!
|
||||||
if (ImGui::BeginMenu("Tools"))
|
if (ImGui::BeginMenu("Tools"))
|
||||||
{
|
{
|
||||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
||||||
|
@ -2185,7 +2186,7 @@ static void ShowDemoWindowWidgets()
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Querying Status (Edited/Active/Hovered etc.)"))
|
if (ImGui::TreeNode("Querying Item Status (Edited/Active/Hovered etc.)"))
|
||||||
{
|
{
|
||||||
// Select an item type
|
// Select an item type
|
||||||
const char* item_names[] =
|
const char* item_names[] =
|
||||||
|
@ -2271,43 +2272,63 @@ static void ShowDemoWindowWidgets()
|
||||||
if (item_disabled)
|
if (item_disabled)
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
char buf[1] = "";
|
||||||
|
ImGui::InputText("unused", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::SameLine();
|
||||||
|
HelpMarker("This widget is only here to be able to tab-out of the widgets above and see e.g. Deactivated() status.");
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Querying Window Status (Focused/Hovered etc.)"))
|
||||||
|
{
|
||||||
static bool embed_all_inside_a_child_window = false;
|
static bool embed_all_inside_a_child_window = false;
|
||||||
ImGui::Checkbox("Embed everything inside a child window (for additional testing)", &embed_all_inside_a_child_window);
|
ImGui::Checkbox("Embed everything inside a child window for testing _RootWindow flag.", &embed_all_inside_a_child_window);
|
||||||
if (embed_all_inside_a_child_window)
|
if (embed_all_inside_a_child_window)
|
||||||
ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20.0f), true);
|
ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20.0f), true);
|
||||||
|
|
||||||
// Testing IsWindowFocused() function with its various flags.
|
// Testing IsWindowFocused() function with its various flags.
|
||||||
// Note that the ImGuiFocusedFlags_XXX flags can be combined.
|
|
||||||
ImGui::BulletText(
|
ImGui::BulletText(
|
||||||
"IsWindowFocused() = %d\n"
|
"IsWindowFocused() = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows) = %d\n"
|
"IsWindowFocused(_ChildWindows) = %d\n"
|
||||||
|
"IsWindowFocused(_ChildWindows|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
||||||
|
"IsWindowFocused(_ChildWindows|_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_RootWindow) = %d\n"
|
"IsWindowFocused(_RootWindow) = %d\n"
|
||||||
|
"IsWindowFocused(_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_AnyWindow) = %d\n",
|
"IsWindowFocused(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowFocused(),
|
ImGui::IsWindowFocused(),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));
|
||||||
|
|
||||||
// Testing IsWindowHovered() function with its various flags.
|
// Testing IsWindowHovered() function with its various flags.
|
||||||
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
|
||||||
ImGui::BulletText(
|
ImGui::BulletText(
|
||||||
"IsWindowHovered() = %d\n"
|
"IsWindowHovered() = %d\n"
|
||||||
"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n"
|
"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n"
|
||||||
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows) = %d\n"
|
"IsWindowHovered(_ChildWindows) = %d\n"
|
||||||
|
"IsWindowHovered(_ChildWindows|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\n"
|
"IsWindowHovered(_ChildWindows|_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowHovered(_RootWindow) = %d\n"
|
"IsWindowHovered(_RootWindow) = %d\n"
|
||||||
|
"IsWindowHovered(_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
|
"IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\n"
|
||||||
"IsWindowHovered(_AnyWindow) = %d\n",
|
"IsWindowHovered(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowHovered(),
|
ImGui::IsWindowHovered(),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));
|
||||||
|
|
||||||
ImGui::BeginChild("child", ImVec2(0, 50), true);
|
ImGui::BeginChild("child", ImVec2(0, 50), true);
|
||||||
|
@ -2316,9 +2337,6 @@ static void ShowDemoWindowWidgets()
|
||||||
if (embed_all_inside_a_child_window)
|
if (embed_all_inside_a_child_window)
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
static char unused_str[] = "This widget is only here to be able to tab-out of the widgets above.";
|
|
||||||
ImGui::InputText("unused", unused_str, IM_ARRAYSIZE(unused_str), ImGuiInputTextFlags_ReadOnly);
|
|
||||||
|
|
||||||
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
||||||
// This is useful in particular if you want to create a context menu associated to the title bar of a window.
|
// This is useful in particular if you want to create a context menu associated to the title bar of a window.
|
||||||
static bool test_window = false;
|
static bool test_window = false;
|
||||||
|
|
|
@ -1123,11 +1123,29 @@ struct ImGuiLastItemData
|
||||||
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IMGUI_API ImGuiStackSizes
|
||||||
|
{
|
||||||
|
short SizeOfIDStack;
|
||||||
|
short SizeOfColorStack;
|
||||||
|
short SizeOfStyleVarStack;
|
||||||
|
short SizeOfFontStack;
|
||||||
|
short SizeOfFocusScopeStack;
|
||||||
|
short SizeOfGroupStack;
|
||||||
|
short SizeOfItemFlagsStack;
|
||||||
|
short SizeOfBeginPopupStack;
|
||||||
|
short SizeOfDisabledStack;
|
||||||
|
|
||||||
|
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
||||||
|
void SetToCurrentState();
|
||||||
|
void CompareWithCurrentState();
|
||||||
|
};
|
||||||
|
|
||||||
// Data saved for each window pushed into the stack
|
// Data saved for each window pushed into the stack
|
||||||
struct ImGuiWindowStackData
|
struct ImGuiWindowStackData
|
||||||
{
|
{
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window;
|
||||||
ImGuiLastItemData ParentLastItemDataBackup;
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||||||
|
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
|
@ -1373,21 +1391,6 @@ struct ImGuiMetricsConfig
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IMGUI_API ImGuiStackSizes
|
|
||||||
{
|
|
||||||
short SizeOfIDStack;
|
|
||||||
short SizeOfColorStack;
|
|
||||||
short SizeOfStyleVarStack;
|
|
||||||
short SizeOfFontStack;
|
|
||||||
short SizeOfFocusScopeStack;
|
|
||||||
short SizeOfGroupStack;
|
|
||||||
short SizeOfBeginPopupStack;
|
|
||||||
|
|
||||||
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
|
||||||
void SetToCurrentState();
|
|
||||||
void CompareWithCurrentState();
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Generic context hooks
|
// [SECTION] Generic context hooks
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1603,9 +1606,9 @@ struct ImGuiContext
|
||||||
ImFont InputTextPasswordFont;
|
ImFont InputTextPasswordFont;
|
||||||
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||||
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
|
float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastColor[3];
|
ImU32 ColorEditLastColor; // RGB value with alpha set to 0.
|
||||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||||
ImGuiComboPreviewData ComboPreviewData;
|
ImGuiComboPreviewData ComboPreviewData;
|
||||||
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
||||||
|
@ -1613,9 +1616,10 @@ struct ImGuiContext
|
||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
||||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
|
||||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||||
int TooltipOverrideCount;
|
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||||
|
short DisabledStackSize;
|
||||||
|
short TooltipOverrideCount;
|
||||||
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
||||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||||
|
@ -1773,13 +1777,14 @@ struct ImGuiContext
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
ColorEditLastColor = 0;
|
||||||
SliderCurrentAccum = 0.0f;
|
SliderCurrentAccum = 0.0f;
|
||||||
SliderCurrentAccumDirty = false;
|
SliderCurrentAccumDirty = false;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
DisabledAlphaBackup = 0.0f;
|
DisabledAlphaBackup = 0.0f;
|
||||||
|
DisabledStackSize = 0;
|
||||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
TooltipSlowDelay = 0.50f;
|
TooltipSlowDelay = 0.50f;
|
||||||
|
@ -1863,7 +1868,6 @@ struct IMGUI_API ImGuiWindowTempData
|
||||||
float TextWrapPos; // Current text wrap pos.
|
float TextWrapPos; // Current text wrap pos.
|
||||||
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
||||||
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
||||||
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for one window
|
// Storage for one window
|
||||||
|
@ -1946,8 +1950,9 @@ struct IMGUI_API ImGuiWindow
|
||||||
|
|
||||||
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||||||
ImDrawList DrawListInst;
|
ImDrawList DrawListInst;
|
||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup _or_ docked window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window == Top-level window.
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window. Doesn't cross through popups/dock nodes.
|
||||||
|
ImGuiWindow* RootWindowPopupTree; // Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
|
@ -2333,7 +2338,7 @@ namespace ImGui
|
||||||
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
||||||
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
||||||
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
||||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy);
|
||||||
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
||||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||||
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
||||||
|
@ -2409,7 +2414,7 @@ namespace ImGui
|
||||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0);
|
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0);
|
||||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API void ItemInputable(ImGuiWindow* window, ImGuiID id);
|
IMGUI_API void ItemInputable(ImGuiWindow* window, ImGuiID id);
|
||||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
||||||
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||||||
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||||||
|
@ -2443,6 +2448,7 @@ namespace ImGui
|
||||||
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
||||||
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
||||||
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
||||||
|
IMGUI_API void ClosePopupsExceptModals();
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
||||||
|
@ -2450,9 +2456,9 @@ namespace ImGui
|
||||||
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
||||||
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
|
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
||||||
IMGUI_API bool BeginMenuEx(const char* label, const char* icon, bool enabled = true);
|
IMGUI_API bool BeginMenuEx(const char* label, const char* icon, bool enabled = true);
|
||||||
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
||||||
|
|
||||||
|
@ -2677,6 +2683,7 @@ namespace ImGui
|
||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
|
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
||||||
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
||||||
if (use_child_window && IsClippedEx(outer_rect, 0, false))
|
if (use_child_window && IsClippedEx(outer_rect, 0))
|
||||||
{
|
{
|
||||||
ItemSize(outer_rect);
|
ItemSize(outer_rect);
|
||||||
return false;
|
return false;
|
||||||
|
@ -3988,7 +3988,7 @@ void ImGui::EndColumns()
|
||||||
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
||||||
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
if (IsClippedEx(column_hit_rect, column_id, false))
|
if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
|
|
|
@ -205,7 +205,7 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
|
||||||
ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
|
ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
|
||||||
while (line < text_end)
|
while (line < text_end)
|
||||||
{
|
{
|
||||||
if (IsClippedEx(line_rect, 0, false))
|
if (IsClippedEx(line_rect, 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
||||||
|
@ -4005,6 +4005,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
window->DC.CursorPos = backup_pos;
|
window->DC.CursorPos = backup_pos;
|
||||||
|
|
||||||
// We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.
|
// We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.
|
||||||
|
// FIXME-NAV: Pressing NavActivate will trigger general child activation right before triggering our own below. Harmless but bizarre.
|
||||||
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
||||||
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
||||||
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
||||||
|
@ -4042,7 +4043,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
const bool focus_requested_by_tabbing = (item_status_flags & ImGuiItemStatusFlags_FocusedByTabbing) != 0;
|
const bool focus_requested_by_tabbing = (item_status_flags & ImGuiItemStatusFlags_FocusedByTabbing) != 0;
|
||||||
|
|
||||||
const bool user_clicked = hovered && io.MouseClicked[0];
|
const bool user_clicked = hovered && io.MouseClicked[0];
|
||||||
const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavActivateInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard));
|
const bool user_nav_input_start = (g.ActiveId != id) && (g.NavActivateInputId == id || g.NavActivateId == id);
|
||||||
const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
||||||
const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
||||||
|
|
||||||
|
@ -4270,7 +4271,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && !is_readonly && is_undoable;
|
const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && !is_readonly && is_undoable;
|
||||||
|
|
||||||
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
||||||
const bool is_validate = IsKeyPressedMap(ImGuiKey_Enter) || IsKeyPressedMap(ImGuiKey_KeyPadEnter) || IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed) || IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed);
|
const bool is_validate_enter = IsKeyPressedMap(ImGuiKey_Enter) || IsKeyPressedMap(ImGuiKey_KeyPadEnter);
|
||||||
|
const bool is_validate_nav = (IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed) && !IsKeyPressedMap(ImGuiKey_Space)) || IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed);
|
||||||
const bool is_cancel = IsKeyPressedMap(ImGuiKey_Escape) || IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed);
|
const bool is_cancel = IsKeyPressedMap(ImGuiKey_Escape) || IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed);
|
||||||
|
|
||||||
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
||||||
|
@ -4293,7 +4295,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
}
|
}
|
||||||
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
||||||
}
|
}
|
||||||
else if (is_validate)
|
else if (is_validate_enter)
|
||||||
{
|
{
|
||||||
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
|
bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
|
||||||
if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
|
if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
|
||||||
|
@ -4307,6 +4309,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
state->OnKeyPressed((int)c);
|
state->OnKeyPressed((int)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (is_validate_nav)
|
||||||
|
{
|
||||||
|
IM_ASSERT(!is_validate_enter);
|
||||||
|
enter_pressed = clear_active_id = true;
|
||||||
|
}
|
||||||
else if (is_cancel)
|
else if (is_cancel)
|
||||||
{
|
{
|
||||||
clear_active_id = cancel_edit = true;
|
clear_active_id = cancel_edit = true;
|
||||||
|
@ -4789,6 +4796,30 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag
|
||||||
return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);
|
return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ColorEdit supports RGB and HSV inputs. In case of RGB input resulting color may have undefined hue and/or saturation.
|
||||||
|
// Since widget displays both RGB and HSV values we must preserve hue and saturation to prevent these values resetting.
|
||||||
|
static void ColorEditRestoreHS(const float* col, float* H, float* S, float* V)
|
||||||
|
{
|
||||||
|
// This check is optional. Suppose we have two color widgets side by side, both widgets display different colors, but both colors have hue and/or saturation undefined.
|
||||||
|
// With color check: hue/saturation is preserved in one widget. Editing color in one widget would reset hue/saturation in another one.
|
||||||
|
// Without color check: common hue/saturation would be displayed in all widgets that have hue/saturation undefined.
|
||||||
|
// g.ColorEditLastColor is stored as ImU32 RGB value: this essentially gives us color equality check with reduced precision.
|
||||||
|
// Tiny external color changes would not be detected and this check would still pass. This is OK, since we only restore hue/saturation _only_ if they are undefined,
|
||||||
|
// therefore this change flipping hue/saturation from undefined to a very tiny value would still be represented in color picker.
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (g.ColorEditLastColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// When S == 0, H is undefined.
|
||||||
|
// When H == 1 it wraps around to 0.
|
||||||
|
if (*S == 0.0f || (*H == 0.0f && g.ColorEditLastHue == 1))
|
||||||
|
*H = g.ColorEditLastHue;
|
||||||
|
|
||||||
|
// When V == 0, S is undefined.
|
||||||
|
if (*V == 0.0f)
|
||||||
|
*S = g.ColorEditLastSat;
|
||||||
|
}
|
||||||
|
|
||||||
// Edit colors components (each component in 0.0f..1.0f range).
|
// Edit colors components (each component in 0.0f..1.0f range).
|
||||||
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
|
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
|
||||||
// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.
|
// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.
|
||||||
|
@ -4844,13 +4875,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||||
{
|
{
|
||||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||||
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||||
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
ColorEditRestoreHS(col, &f[0], &f[1], &f[2]);
|
||||||
{
|
|
||||||
if (f[1] == 0)
|
|
||||||
f[0] = g.ColorEditLastHue;
|
|
||||||
if (f[2] == 0)
|
|
||||||
f[1] = g.ColorEditLastSat;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
|
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
|
||||||
|
|
||||||
|
@ -4985,7 +5010,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||||
g.ColorEditLastHue = f[0];
|
g.ColorEditLastHue = f[0];
|
||||||
g.ColorEditLastSat = f[1];
|
g.ColorEditLastSat = f[1];
|
||||||
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||||
memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);
|
g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0));
|
||||||
}
|
}
|
||||||
if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV))
|
if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV))
|
||||||
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||||
|
@ -5120,13 +5145,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||||
{
|
{
|
||||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||||
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
||||||
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
ColorEditRestoreHS(col, &H, &S, &V);
|
||||||
{
|
|
||||||
if (S == 0)
|
|
||||||
H = g.ColorEditLastHue;
|
|
||||||
if (V == 0)
|
|
||||||
S = g.ColorEditLastSat;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
{
|
{
|
||||||
|
@ -5179,6 +5198,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||||
{
|
{
|
||||||
S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));
|
S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));
|
||||||
V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
|
V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
|
||||||
|
|
||||||
|
// Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square.
|
||||||
|
if (g.ColorEditLastColor == ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||||
|
H = g.ColorEditLastHue;
|
||||||
value_changed = value_changed_sv = true;
|
value_changed = value_changed_sv = true;
|
||||||
}
|
}
|
||||||
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
||||||
|
@ -5252,10 +5275,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||||
{
|
{
|
||||||
if (flags & ImGuiColorEditFlags_InputRGB)
|
if (flags & ImGuiColorEditFlags_InputRGB)
|
||||||
{
|
{
|
||||||
ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10 * 1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
|
ColorConvertHSVtoRGB(H, S, V, col[0], col[1], col[2]);
|
||||||
g.ColorEditLastHue = H;
|
g.ColorEditLastHue = H;
|
||||||
g.ColorEditLastSat = S;
|
g.ColorEditLastSat = S;
|
||||||
memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);
|
g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0));
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
{
|
{
|
||||||
|
@ -5309,13 +5332,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||||
G = col[1];
|
G = col[1];
|
||||||
B = col[2];
|
B = col[2];
|
||||||
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
||||||
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0) // Fix local Hue as display below will use it immediately.
|
ColorEditRestoreHS(col, &H, &S, &V); // Fix local Hue as display below will use it immediately.
|
||||||
{
|
|
||||||
if (S == 0)
|
|
||||||
H = g.ColorEditLastHue;
|
|
||||||
if (V == 0)
|
|
||||||
S = g.ColorEditLastSat;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
{
|
{
|
||||||
|
@ -5998,7 +6015,7 @@ void ImGui::TreePush(const char* str_id)
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
Indent();
|
Indent();
|
||||||
window->DC.TreeDepth++;
|
window->DC.TreeDepth++;
|
||||||
PushID(str_id ? str_id : "#TreePush");
|
PushID(str_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::TreePush(const void* ptr_id)
|
void ImGui::TreePush(const void* ptr_id)
|
||||||
|
@ -6006,7 +6023,7 @@ void ImGui::TreePush(const void* ptr_id)
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
Indent();
|
Indent();
|
||||||
window->DC.TreeDepth++;
|
window->DC.TreeDepth++;
|
||||||
PushID(ptr_id ? ptr_id : (const void*)"#TreePush");
|
PushID(ptr_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::TreePushOverrideID(ImGuiID id)
|
void ImGui::TreePushOverrideID(ImGuiID id)
|
||||||
|
@ -6866,7 +6883,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Menu inside a menu
|
// Menu inside a regular/vertical menu
|
||||||
// (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
|
// (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
|
||||||
// Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
|
// Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
|
||||||
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
||||||
|
@ -7022,10 +7039,11 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
|
||||||
// Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
|
// Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
|
||||||
float w = label_size.x;
|
float w = label_size.x;
|
||||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
|
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
|
||||||
|
ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
|
||||||
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
||||||
pressed = Selectable("", selected, flags, ImVec2(w, 0.0f));
|
pressed = Selectable("", selected, flags, ImVec2(w, 0.0f));
|
||||||
PopStyleVar();
|
PopStyleVar();
|
||||||
RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label);
|
RenderText(text_pos, label);
|
||||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
|
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue