mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 14:56:35 +00:00
Docking: comments (#4189)
This commit is contained in:
parent
5e528d9eea
commit
f53db3541a
12
imgui.h
12
imgui.h
@ -779,13 +779,17 @@ namespace ImGui
|
||||
// Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking!
|
||||
// - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking.
|
||||
// - Drag from window menu button (upper-left button) to undock an entire node (all windows).
|
||||
// About DockSpace:
|
||||
// About dockspaces:
|
||||
// - Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details.
|
||||
// - DockSpace() needs to be submitted _before_ any window they can host. If you use a dockspace, submit it early in your app.
|
||||
// - Use DockSpaceOverViewport() to create an explicit dock node covering the screen or a specific viewport.
|
||||
// This is often used with ImGuiDockNodeFlags_PassthruCentralNode.
|
||||
// - Important: Dockspaces need to be submitted _before_ any window they can host. Submit it early in your frame!
|
||||
// - Important: Dockspaces need to be kept alive if hidden, otherwise windows docked into it will be undocked.
|
||||
// e.g. if you have multiple tabs with a dockspace inside each tab: submit the non-visible dockspaces with ImGuiDockNodeFlags_KeepAliveOnly.
|
||||
IMGUI_API ImGuiID DockSpace(ImGuiID id, const ImVec2& size = ImVec2(0, 0), ImGuiDockNodeFlags flags = 0, const ImGuiWindowClass* window_class = NULL);
|
||||
IMGUI_API ImGuiID DockSpaceOverViewport(const ImGuiViewport* viewport = NULL, ImGuiDockNodeFlags flags = 0, const ImGuiWindowClass* window_class = NULL);
|
||||
IMGUI_API void SetNextWindowDockID(ImGuiID dock_id, ImGuiCond cond = 0); // set next window dock id (FIXME-DOCK)
|
||||
IMGUI_API void SetNextWindowClass(const ImGuiWindowClass* window_class); // set next window class (rare/advanced uses: provide hints to the platform backend via altered viewport flags and parent/child info)
|
||||
IMGUI_API void SetNextWindowDockID(ImGuiID dock_id, ImGuiCond cond = 0); // set next window dock id
|
||||
IMGUI_API void SetNextWindowClass(const ImGuiWindowClass* window_class); // set next window class (control docking compatibility + provide hints to platform backend via custom viewport flags and platform parent/child relationship)
|
||||
IMGUI_API ImGuiID GetWindowDockID();
|
||||
IMGUI_API bool IsWindowDocked(); // is current window docked into another window?
|
||||
|
||||
|
@ -7401,13 +7401,23 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Demonstrate using DockSpace() to create an explicit docking node within an existing window.
|
||||
// Note that you dock windows into each others _without_ a dockspace, by just clicking on
|
||||
// a window title bar or tab and moving it.
|
||||
// DockSpace() and DockSpaceOverViewport() are only useful to construct a central docking
|
||||
// location for your application.
|
||||
// Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking!
|
||||
// - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking.
|
||||
// - Drag from window menu button (upper-left button) to undock an entire node (all windows).
|
||||
// About dockspaces:
|
||||
// - Use DockSpace() to create an explicit dock node _within_ an existing window.
|
||||
// - Use DockSpaceOverViewport() to create an explicit dock node covering the screen or a specific viewport.
|
||||
// This is often used with ImGuiDockNodeFlags_PassthruCentralNode.
|
||||
// - Important: Dockspaces need to be submitted _before_ any window they can host. Submit it early in your frame! (*)
|
||||
// - Important: Dockspaces need to be kept alive if hidden, otherwise windows docked into it will be undocked.
|
||||
// e.g. if you have multiple tabs with a dockspace inside each tab: submit the non-visible dockspaces with ImGuiDockNodeFlags_KeepAliveOnly.
|
||||
// (*) because of this constraint, the implicit \"Debug\" window can not be docked into an explicit DockSpace() node,
|
||||
// because that window is submitted as part of the part of the NewFrame() call. An easy workaround is that you can create
|
||||
// your own implicit "Debug##2" window after calling DockSpace() and leave it in the window stack for anyone to use.
|
||||
void ShowExampleAppDockSpace(bool* p_open)
|
||||
{
|
||||
// In 99% case you should be able to just call DockSpaceOverViewport() and ignore all the code below!
|
||||
// If you strip some features of, this demo is pretty much equivalent to calling DockSpaceOverViewport()!
|
||||
// In most cases you should be able to just call DockSpaceOverViewport() and ignore all the code below!
|
||||
// In this specific demo, we are not using DockSpaceOverViewport() because:
|
||||
// - we allow the host window to be floating/moveable instead of filling the viewport (when opt_fullscreen == false)
|
||||
// - we allow the host window to have padding (when opt_padding == true)
|
||||
@ -7461,7 +7471,7 @@ void ShowExampleAppDockSpace(bool* p_open)
|
||||
if (opt_fullscreen)
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
// DockSpace
|
||||
// Submit the DockSpace
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||
{
|
||||
@ -7500,10 +7510,8 @@ void ShowExampleAppDockSpace(bool* p_open)
|
||||
"- Drag from window menu button (upper-left button) to undock an entire node (all windows)." "\n"
|
||||
"- Hold SHIFT to disable docking." "\n"
|
||||
"This demo app has nothing to do with it!" "\n\n"
|
||||
"This demo app only demonstrate the use of ImGui::DockSpace() which allows you to manually create a docking node _within_ another window. This is useful so you can decorate your main application window (e.g. with a menu bar)." "\n\n"
|
||||
"ImGui::DockSpace() comes with one hard constraint: it needs to be submitted _before_ any window which may be docked into it. Therefore, if you use a dock spot as the central point of your application, you'll probably want it to be part of the very first window you are submitting to imgui every frame." "\n\n"
|
||||
"(NB: because of this constraint, the implicit \"Debug\" window can not be docked into an explicit DockSpace() node, because that window is submitted as part of the NewFrame() call. An easy workaround is that you can create your own implicit \"Debug##2\" window after calling DockSpace() and leave it in the window stack for anyone to use.)"
|
||||
);
|
||||
"This demo app only demonstrate the use of ImGui::DockSpace() which allows you to manually create a docking node _within_ another window." "\n\n"
|
||||
"Read comments in ShowExampleAppDockSpace() for more details.");
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user