You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. (ocornut#2211, ocornut#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). (ocornut#125)
Demo: Added demo code to test contentsrect/workrect
Copy file name to clipboardexpand all lines: imgui_demo.cpp
+89-3
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,18 @@
17
17
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
18
18
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
19
19
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
20
-
// 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
21
-
// 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
22
-
// likely going to be stored outside your functions.
20
+
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be
21
+
// 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
22
+
// you would be editing is likely going to be stored outside your functions.
23
+
24
+
// The Demo code is this file is designed to be easy to copy-and-paste in into your application!
25
+
// Because of this:
26
+
// - We never omit the ImGui:: namespace when calling functions, even though most of our code is already in the same namespace.
27
+
// - We try to declare static variables in the local scope, as close as possible to the code using them.
28
+
// - We never use any of the helpers/facilities used internally by dear imgui, unless it has been exposed in the public API (imgui.h).
29
+
// - 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,
30
+
// 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.
31
+
// 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.");
ImGuiWindowTempData DC; // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
1296
1296
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
ImRect OuterRectClipped; // == WindowRect just after setup in Begin(). == window->Rect() for root window.
1299
-
ImRect InnerRect; // Inner rectangle
1300
-
ImRect InnerClipRect; // == InnerRect minus WindowPadding.x, clipped within viewport or parent clip rect.
1301
-
ImRect WorkRect; // == InnerRect minus WindowPadding.x
1302
-
ImRect ContentsRegionRect; // FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
1297
+
1298
+
// The best way to understand what those rectangles are is to use the 'Metrics -> Tools -> Show windows rectangles' viewer.
1299
+
// The main 'OuterRect', omitted as a field, is window->Rect().
1300
+
ImRect OuterRectClipped; // == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
1301
+
ImRect InnerRect; // Inner rectangle (omit title bar, menu bar)
1302
+
ImRect InnerClipRect; // == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
1303
+
ImRect WorkRect; // 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).
1304
+
ImRect ClipRect; // Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
1305
+
ImRect ContentsRegionRect; // 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.
1306
+
1303
1307
int LastFrameActive; // Last frame number the window was Active.
1304
1308
float ItemWidthDefault;
1305
1309
ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items
0 commit comments