diff --git a/imgui.cpp b/imgui.cpp index f1abeaae..a03e6003 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4087,7 +4087,7 @@ void ImGui::EndFrame() } // Hide implicit "Debug" window if it hasn't been used - IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls + IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls, did you forget to call end on g.CurrentWindow->Name? if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) g.CurrentWindow->Active = false; End(); @@ -11220,7 +11220,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl return false; } - // We use NoHoldingActiveID on menus so that use can click and hold on menu and drag to browse child entries + // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries ImGuiButtonFlags button_flags = 0; if (flags & ImGuiSelectableFlags_NoHoldingActiveID) button_flags |= ImGuiButtonFlags_NoHoldingActiveID; if (flags & ImGuiSelectableFlags_PressedOnClick) button_flags |= ImGuiButtonFlags_PressedOnClick; diff --git a/imgui_internal.h b/imgui_internal.h index d6772953..6a424dd0 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -33,16 +33,25 @@ // Forward Declarations //----------------------------------------------------------------------------- -struct ImRect; -struct ImGuiColMod; -struct ImGuiStyleMod; -struct ImGuiGroupData; -struct ImGuiMenuColumns; -struct ImGuiDrawContext; -struct ImGuiTextEditState; -struct ImGuiPopupRef; -struct ImGuiWindow; -struct ImGuiWindowSettings; +struct ImRect; // An axis-aligned rectangle (2 points) +struct ImDrawDataBuilder; // Helper to build a ImDrawData instance +struct ImDrawListSharedData; // Data shared between all ImDrawList instances +struct ImGuiColMod; // Stacked color modifier, backup of modified data so we can restore it +struct ImGuiColumnData; // Storage data for a single column +struct ImGuiColumnsSet; // Storage data for a columns set +struct ImGuiContext; // Main imgui context +struct ImGuiGroupData; // Stacked storage data for BeginGroup()/EndGroup() +struct ImGuiItemHoveredDataBackup; // Backup and restore IsItemHovered() internal data +struct ImGuiMenuColumns; // Simple column measurement, currently used for MenuItem() only +struct ImGuiNavMoveResult; // Result of a directional navigation move query result +struct ImGuiNextWindowData; // Storage for SetNexWindow** functions +struct ImGuiPopupRef; // Storage for current popup stack +struct ImGuiSettingsHandler; +struct ImGuiStyleMod; // Stacked style modifier, backup of modified data so we can restore it +struct ImGuiTextEditState; // Internal state of the currently focused/edited text input box +struct ImGuiWindow; // Storage for one window +struct ImGuiWindowTempData; // Temporary storage for one, that's the data which in theory we could ditch at the end of the frame +struct ImGuiWindowSettings; // Storage for window settings stored in .ini file (we keep one of those even if the actual window wasn't instanced during this session) typedef int ImGuiLayoutType; // enum: horizontal or vertical // enum ImGuiLayoutType_ typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_ @@ -372,7 +381,7 @@ struct ImGuiStyleMod ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; } }; -// Stacked data for BeginGroup()/EndGroup() +// Stacked storage data for BeginGroup()/EndGroup() struct ImGuiGroupData { ImVec2 BackupCursorPos; @@ -386,7 +395,7 @@ struct ImGuiGroupData bool AdvanceCursor; }; -// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper. +// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper. struct IMGUI_API ImGuiMenuColumns { int Count; @@ -424,7 +433,7 @@ struct IMGUI_API ImGuiTextEditState void OnKeyPressed(int key); }; -// Data saved in imgui.ini file +// Windows data saved in imgui.ini file struct ImGuiWindowSettings { char* Name; @@ -501,6 +510,7 @@ struct ImGuiColumnsSet } }; +// Data shared between all ImDrawList instances struct IMGUI_API ImDrawListSharedData { ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas @@ -579,7 +589,7 @@ struct ImGuiNextWindowData } }; -// Main state for ImGui +// Main imgui context struct ImGuiContext { bool Initialized; @@ -832,9 +842,9 @@ enum ImGuiItemFlags_ ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus }; -// Transient per-window data, reset at the beginning of the frame -// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiDrawContext is quite tenuous and could be reconsidered. -struct IMGUI_API ImGuiDrawContext +// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow. +// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered. +struct IMGUI_API ImGuiWindowTempData { ImVec2 CursorPos; ImVec2 CursorPosPrevLine; @@ -879,7 +889,7 @@ struct IMGUI_API ImGuiDrawContext float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API. ImGuiColumnsSet* ColumnsSet; // Current columns set - ImGuiDrawContext() + ImGuiWindowTempData() { CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f); CurrentLineHeight = PrevLineHeight = 0.0f; @@ -911,7 +921,7 @@ struct IMGUI_API ImGuiDrawContext } }; -// Windows data +// Storage for one window struct IMGUI_API ImGuiWindow { char* Name; @@ -956,7 +966,7 @@ struct IMGUI_API ImGuiWindow ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right. - ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame + ImGuiWindowTempData DC; // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name. ImVector IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack ImRect ClipRect; // Current clipping rectangle. = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2. ImRect OuterRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window.