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
Clarified that BeginMenuMainBar() had an incorrect knowledge of its height (which was previously harmless).
Designed to easily allow for status bars although we don't have/use them yet, but custom code could use them.
if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
5274
5274
size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));
5275
5275
5276
+
// FIXME-VIEWPORT-WORKAREA: May want to use GetWorkSize() instead of Size depending on the type of windows?
// Tips: Use with ImGuiDockNodeFlags_PassthruCentralNode!
13853
13864
// The limitation with this call is that your window won't have a menu bar.
13854
13865
// Even though we could pass window flags, it would also require the user to be able to call BeginMenuBar() somehow meaning we can't Begin/End in a single function.
13855
-
// So if you want a menu bar you need to repeat this code manually ourselves. As with advanced other Docking API, we may change this function signature.
13866
+
// But you can also use BeginMainMenuBar(). If you really want a menu bar inside the same window as the one hosting the dockspace, you will need to copy this code somewhere and tweak it.
Copy file name to clipboardexpand all lines: imgui.h
+12-4
Original file line number
Diff line number
Diff line change
@@ -2468,14 +2468,18 @@ enum ImGuiViewportFlags_
2468
2468
ImGuiViewportFlags_CanHostOtherWindows = 1 << 9// Main viewport: can host multiple imgui windows (secondary viewports are associated to a single window).
2469
2469
};
2470
2470
2471
-
// The viewports created and managed by imgui. The role of the platform back-end is to create the platform/OS windows corresponding to each viewport.
2471
+
// The viewports created and managed by Dear ImGui. The role of the platform back-end is to create the platform/OS windows corresponding to each viewport.
2472
+
// - Main Area = entire viewport.
2473
+
// - Work Area = entire viewport minus sections optionally used by menu bars, status bars. Some positioning code will prefer to use this. Window are also trying to stay within this area.
2472
2474
structImGuiViewport
2473
2475
{
2474
2476
ImGuiID ID; // Unique identifier for the viewport
2475
2477
ImGuiViewportFlags Flags; // See ImGuiViewportFlags_
2476
-
ImVec2 Pos; // Position of viewport both in imgui space and in OS desktop/native space
2477
-
ImVec2 Size; // Size of viewport in pixel
2478
-
float DpiScale; // 1.0f = 96 DPI = No extra scale
2478
+
ImVec2 Pos; // Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates)
2479
+
ImVec2 Size; // Main Area: Size of the viewport.
2480
+
ImVec2 WorkOffsetMin; // Work Area: Offset from Pos to top-left corner of Work Area. Generally (0,0) or (0,+main_menu_bar_height). Work Area is Full Area but without menu-bars/status-bars (so WorkArea always fit inside Pos/Size!)
2481
+
ImVec2 WorkOffsetMax; // Work Area: Offset from Pos+Size to bottom-right corner of Work Area. Generally (0,0) or (0,-status_bar_height).
2482
+
float DpiScale; // 1.0f = 96 DPI = No extra scale.
2479
2483
ImDrawData* DrawData; // The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame().
2480
2484
ImGuiID ParentViewportId; // (Advanced) 0: no parent. Instruct the platform back-end to setup a parent/child relationship between platform windows.
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!"); // Exceptionally add an extra assert here for people confused with initial dear imgui setup
223
223
224
224
// Examples Apps (accessible from the "Examples" menu)
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
239
240
if (show_app_dockspace) ShowExampleAppDockSpace(&show_app_dockspace); // Process the Docking app first, as explicit DockSpace() nodes needs to be submitted early (read comments near the DockSpace function)
240
241
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); // Process the Document app next, as it may also use a DockSpace()
241
-
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
242
242
if (show_app_console) ShowExampleAppConsole(&show_app_console);
243
243
if (show_app_log) ShowExampleAppLog(&show_app_log);
244
244
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
287
287
288
288
// We specify a default position/size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming.
ImVec2 MenuBarOffsetMinVal; //*Always on* This is not exposed publicly, so we don't clear it.
997
+
ImVec2 MenuBarOffsetMinVal; //(Always on) This is not exposed publicly, so we don't clear it and it doesn't have a corresponding flag (could we? for consistency?)
SetNextWindowViewport(viewport->ID); // Enforce viewport so we don't create our onw viewport when ImGuiConfigFlags_ViewportsNoMerge is set.
6192
+
6193
+
// Get our rectangle in the work area, and report the size we need for next frame.
6194
+
// We don't attempt to calculate our height ahead, as it depends on the per-viewport font size. However menu-bar will affect the minimum window size so we'll get the right height.
PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0)); // Lift normal size constraint, however the presence of a menu-bar will give us the minimum height we want.
0 commit comments