mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-16 12:03:27 +01:00
Docking: comments for DockBuilder API.
This commit is contained in:
parent
a4af3cc814
commit
d049a7988c
18
imgui.cpp
18
imgui.cpp
@ -13740,8 +13740,12 @@ void ImGui::DockBuilderSetNodeSize(ImGuiID node_id, ImVec2 size)
|
||||
node->AuthorityForSize = ImGuiDataAuthority_DockNode;
|
||||
}
|
||||
|
||||
// If you create a regular node, both ref_pos/ref_size will position the window.
|
||||
// If you create a dockspace node: ref_pos won't be used, ref_size is useful on the first frame to...
|
||||
// Make sure to use the ImGuiDockNodeFlags_DockSpace flag to create a dockspace node! Otherwise this will create a floating node!
|
||||
// - Floating node: you can then call DockBuilderSetNodePos()/DockBuilderSetNodeSize() to position and size the floating node.
|
||||
// - Dockspace node: calling DockBuilderSetNodePos() is unnecessary.
|
||||
// - If you intend to split a node immediately after creation using DockBuilderSplitNode(), make sure to call DockBuilderSetNodeSize() beforehand!
|
||||
// For various reason, the splitting code currently needs a base size otherwise space may not be allocated as precisely as you would expect.
|
||||
// - Use (id == 0) to let the system allocate a node identifier.
|
||||
ImGuiID ImGui::DockBuilderAddNode(ImGuiID id, ImGuiDockNodeFlags flags)
|
||||
{
|
||||
ImGuiContext* ctx = GImGui;
|
||||
@ -13878,8 +13882,10 @@ void ImGui::DockBuilderRemoveNodeDockedWindows(ImGuiID root_id, bool clear_persi
|
||||
}
|
||||
}
|
||||
|
||||
// If 'out_id_at_dir' or 'out_id_at_opposite_dir' are non NULL, the function will write out the ID of the two new nodes created.
|
||||
// Return value is ID of the node at the specified direction, so same as (*out_id_at_dir) if that pointer is set.
|
||||
// FIXME-DOCK: We are not exposing nor using split_outer.
|
||||
ImGuiID ImGui::DockBuilderSplitNode(ImGuiID id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_at_dir, ImGuiID* out_id_other)
|
||||
ImGuiID ImGui::DockBuilderSplitNode(ImGuiID id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_at_dir, ImGuiID* out_id_at_opposite_dir)
|
||||
{
|
||||
ImGuiContext* ctx = GImGui;
|
||||
IM_ASSERT(split_dir != ImGuiDir_None);
|
||||
@ -13905,11 +13911,11 @@ ImGuiID ImGui::DockBuilderSplitNode(ImGuiID id, ImGuiDir split_dir, float size_r
|
||||
DockContextProcessDock(ctx, &req);
|
||||
|
||||
ImGuiID id_at_dir = node->ChildNodes[(split_dir == ImGuiDir_Left || split_dir == ImGuiDir_Up) ? 0 : 1]->ID;
|
||||
ImGuiID id_other = node->ChildNodes[(split_dir == ImGuiDir_Left || split_dir == ImGuiDir_Up) ? 1 : 0]->ID;
|
||||
ImGuiID id_at_opposite_dir = node->ChildNodes[(split_dir == ImGuiDir_Left || split_dir == ImGuiDir_Up) ? 1 : 0]->ID;
|
||||
if (out_id_at_dir)
|
||||
*out_id_at_dir = id_at_dir;
|
||||
if (out_id_other)
|
||||
*out_id_other = id_other;
|
||||
if (out_id_at_opposite_dir)
|
||||
*out_id_at_opposite_dir = id_at_opposite_dir;
|
||||
return id_at_dir;
|
||||
}
|
||||
|
||||
|
@ -1800,17 +1800,21 @@ namespace ImGui
|
||||
IMGUI_API void SetWindowDock(ImGuiWindow* window, ImGuiID dock_id, ImGuiCond cond);
|
||||
|
||||
// Docking - Builder function needs to be generally called before the DockSpace() node is submitted.
|
||||
// Important: do not hold on ImGuiDockNode* pointers. They may be invalidated by any split/merge/remove operation and every frame.
|
||||
// - The DockBuilderXXX functions are designed to _eventually_ become a public API, but it is too early to expose it and guarantee stability.
|
||||
// - You can create dockspace _or_ floating nodes with this API. To create a dockspace node, make sure to set the ImGuiDockNodeFlags_DockSpace flag.
|
||||
// - If you intend to split the node immediately after creation using DockBuilderSplitNode(), make sure to call DockBuilderSetNodeSize() beforehand.
|
||||
// - Call DockBuilderFinish() after you are done.
|
||||
// - Important: do not hold on ImGuiDockNode* pointers! They may be invalidated by any split/merge/remove operation and every frame.
|
||||
IMGUI_API void DockBuilderDockWindow(const char* window_name, ImGuiID node_id);
|
||||
IMGUI_API ImGuiDockNode*DockBuilderGetNode(ImGuiID node_id);
|
||||
inline ImGuiDockNode* DockBuilderGetCentralNode(ImGuiID node_id) { ImGuiDockNode* node = DockBuilderGetNode(node_id); if (!node) return NULL; return DockNodeGetRootNode(node)->CentralNode; }
|
||||
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id, ImGuiDockNodeFlags flags = 0); // Use (flags == ImGuiDockNodeFlags_DockSpace) to create a dockspace, otherwise it'll create a floating node.
|
||||
IMGUI_API ImGuiID DockBuilderAddNode(ImGuiID node_id = 0, ImGuiDockNodeFlags flags = 0);
|
||||
IMGUI_API void DockBuilderRemoveNode(ImGuiID node_id); // Remove node and all its child, undock all windows
|
||||
IMGUI_API void DockBuilderRemoveNodeDockedWindows(ImGuiID node_id, bool clear_persistent_docking_references = true);
|
||||
IMGUI_API void DockBuilderRemoveNodeChildNodes(ImGuiID node_id); // Remove all split/hierarchy. All remaining docked windows will be re-docked to the root.
|
||||
IMGUI_API void DockBuilderSetNodePos(ImGuiID node_id, ImVec2 pos);
|
||||
IMGUI_API void DockBuilderSetNodeSize(ImGuiID node_id, ImVec2 size);
|
||||
IMGUI_API ImGuiID DockBuilderSplitNode(ImGuiID node_id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_dir, ImGuiID* out_id_other);
|
||||
IMGUI_API ImGuiID DockBuilderSplitNode(ImGuiID node_id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_at_dir, ImGuiID* out_id_at_opposite_dir);
|
||||
IMGUI_API void DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector<const char*>* in_window_remap_pairs);
|
||||
IMGUI_API void DockBuilderCopyNode(ImGuiID src_node_id, ImGuiID dst_node_id, ImVector<ImGuiID>* out_node_remap_pairs);
|
||||
IMGUI_API void DockBuilderCopyWindowSettings(const char* src_name, const char* dst_name);
|
||||
|
Loading…
Reference in New Issue
Block a user