Window rectangles: Changed WorkRect to cover the whole region including scrolling (toward obsolete ContentsRegionRect) + using full WindowPadding*1 padding.
Tweaked InnerClipRect.
TreeNode, CollapsingHeader: Fixed highlight frame not covering horizontal area fully when using horizontal scrolling. (#2211, #2579)
TabBar: Fixed BeginTabBar() within a window with horizontal scrolling from creating a feedback loop with the horizontal contents size.
Columns: Fixed Columns() within a window with horizontal scrolling from not covering the full horizontal area (previously only worked with an explicit contents size). (#125)
Demo: Added demo code to test contentsrect/workrect
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be
// or used in threads. This might be a pattern you will want to use in your code, but most of the real data you would be editing is
// reentrant or used in multiple threads. This might be a pattern you will want to use in your code, but most of the real data
// likely going to be stored outside your functions.
// you would be editing is likely going to be stored outside your functions.
// The Demo code is this file is designed to be easy to copy-and-paste in into your application!
// Because of this:
// - We never omit the ImGui:: namespace when calling functions, even though most of our code is already in the same namespace.
// - We try to declare static variables in the local scope, as close as possible to the code using them.
// - We never use any of the helpers/facilities used internally by dear imgui, unless it has been exposed in the public API (imgui.h).
// - We never use maths operators on ImVec2/ImVec4. For other imgui sources files, they are provided by imgui_internal.h w/ IMGUI_DEFINE_MATH_OPERATORS,
// for your own sources file they are optional and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h.
// Because we don't want to assume anything about your support of maths operators, we don't use them in imgui_demo.cpp.
HelpMarker("Test of different widgets react and impact the work rectangle growing when horizontal scrolling is enabled.\n\nUse 'Metrics->Tools->Show windows rectangles' to visualize rectangles.");
ImGui::Checkbox("H-scrollbar",&show_h_scrollbar);
ImGui::Checkbox("Button",&show_button);// Will grow contents size (unless explicitly overwritten)
ImGui::Checkbox("Tree nodes",&show_tree_nodes);// Will grow contents size and display highlight over full width
ImGui::Checkbox("Columns",&show_columns);// Will use contents size
ImGui::Checkbox("Tab bar",&show_tab_bar);// Will use contents size
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
ImVector<ImGuiID>IDStack;// ID stack. ID are hashes seeded with the value at the top of the stack
ImVector<ImGuiID>IDStack;// ID stack. ID are hashes seeded with the value at the top of the stack
ImRectOuterRectClipped;// == WindowRect just after setup in Begin(). == window->Rect() for root window.
// The best way to understand what those rectangles are is to use the 'Metrics -> Tools -> Show windows rectangles' viewer.
ImRectInnerRect;// Inner rectangle
// The main 'OuterRect', omitted as a field, is window->Rect().
ImRectInnerClipRect;// == InnerRect minus WindowPadding.x, clipped within viewport or parent clip rect.
ImRectOuterRectClipped;// == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
ImRectWorkRect;// == InnerRect minus WindowPadding.x
ImRectInnerRect;// Inner rectangle (omit title bar, menu bar)
ImRectContentsRegionRect;// FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
ImRectInnerClipRect;// == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
ImRectWorkRect;// Cover the whole scrolling region, shrunk by WindowPadding*1.0f on each side. This is meant to replace ContentsRegionRect over time (from 1.71+ onward).
ImRectClipRect;// Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
ImRectContentsRegionRect;// FIXME: This is currently confusing/misleading. It is essentially WorkRect but not handling of scrolling. We currently rely on it as right/bottom aligned sizing operation need some size to rely on.
intLastFrameActive;// Last frame number the window was Active.
intLastFrameActive;// Last frame number the window was Active.
floatItemWidthDefault;
floatItemWidthDefault;
ImGuiMenuColumnsMenuColumns;// Simplified columns storage for menu items
ImGuiMenuColumnsMenuColumns;// Simplified columns storage for menu items