File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,3 +102,9 @@ jobs:
102102 run : |
103103 cd examples/glfw_opengl3
104104 mcpp build
105+
106+ - name : Build docking example (features=["docking"])
107+ shell : bash
108+ run : |
109+ cd examples/docking
110+ mcpp build
Original file line number Diff line number Diff line change 11{
22 "workspace" : {
3- "xim:mcpp" : " 0.0.44 "
3+ "xim:mcpp" : " 0.0.48 "
44 }
55}
Original file line number Diff line number Diff line change @@ -41,6 +41,21 @@ alias — the rest of the consumer code is identical. Cross-platform GL/GLSL
4141configuration (incl. macOS forward-compat) is handled by ` RecommendedGlConfig() ` ,
4242which ` CreateWindow ` /` Init ` use by default.
4343
44+ ## Features
45+
46+ - ` docking ` — exports the Dock* API surface (` DockSpace ` , ` DockSpaceOverViewport ` ,
47+ ` SetNextWindowDockID ` , ` IsWindowDocked ` , ...) and makes the ` imgui.app ` facade
48+ enable ` ImGuiConfigFlags_DockingEnable ` automatically:
49+
50+ ``` toml
51+ [dependencies ]
52+ imgui = { version = " 0.0.4" , features = [" docking" ] }
53+ ```
54+
55+ See ` examples/docking/ ` . Sources come from upstream's docking tag
56+ (` compat.imgui 1.92.8-docking ` , a superset of mainline — identical behavior
57+ while the feature is off).
58+
4459## Dependencies
4560
4661The root package depends on:
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " imgui-docking"
3+ version = " 0.1.0"
4+ description = " Dockable-windows demo using the imgui `docking` feature"
5+ license = " MIT"
6+
7+ [dependencies ]
8+ imgui = { path = " ../.." , features = [" docking" ] }
Original file line number Diff line number Diff line change 1+ // Docking demo — `imgui = { ..., features = ["docking"] }`.
2+ // The imgui.app facade auto-enables ImGuiConfigFlags_DockingEnable when the
3+ // feature is active; DockSpaceOverViewport turns the whole window into a
4+ // dock host, so the two panels below can be dragged into / split around it.
5+ import imgui.core;
6+ import imgui.app;
7+
8+ int main () {
9+ return ImGui::App::run ({.title = " mcpp imgui docking demo" }, [] {
10+ const auto dockspace = ImGui::DockSpaceOverViewport ();
11+
12+ // Pre-dock both panels into the dockspace on first run; they remain
13+ // freely draggable/splittable afterwards.
14+ ImGui::SetNextWindowDockID (dockspace, ImGui::Cond_FirstUseEver);
15+ ImGui::Begin (" Toolbox" );
16+ ImGui::TextUnformatted (" Drag this panel onto the dockspace." );
17+ ImGui::TextUnformatted (" Docked: " );
18+ ImGui::TextUnformatted (ImGui::IsWindowDocked () ? " yes" : " no" );
19+ ImGui::End ();
20+
21+ ImGui::SetNextWindowDockID (dockspace, ImGui::Cond_FirstUseEver);
22+ ImGui::Begin (" Inspector" );
23+ ImGui::TextUnformatted (" Split me against the Toolbox." );
24+ ImGui::End ();
25+ });
26+ }
Original file line number Diff line number Diff line change @@ -22,8 +22,14 @@ sources = [
2222 " src/backends/opengl3_impl.cpp" ,
2323]
2424
25+ [features ]
26+ default = []
27+ # docking: export the Dock* API surface and auto-enable
28+ # ImGuiConfigFlags_DockingEnable in the imgui.app facade.
29+ docking = []
30+
2531[dependencies ]
26- compat.imgui = " 1.92.8"
32+ compat.imgui = " 1.92.8-docking "
2733compat.glfw = " 3.4"
2834compat.opengl = " 2026.05.31"
2935
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ export namespace ImGui::App {
5353
5454 ImGuiContext* context = ImGui::CreateContext ();
5555 ImGui::SetCurrentContext (context);
56+ #ifdef MCPP_FEATURE_DOCKING
57+ // `docking` feature: enable dockable windows out of the box.
58+ ImGui::GetIO ().ConfigFlags |= ImGui::ConfigFlags_DockingEnable;
59+ #endif
5660
5761 if (!Backend::Init (window)) {
5862 const auto error = Backend::LastError ();
Original file line number Diff line number Diff line change @@ -26,3 +26,25 @@ export namespace ImGui {
2626 using ::ImGui::SetCurrentContext;
2727 using ::ImGui::TextUnformatted;
2828}
29+
30+ // Docking surface — gated by the `docking` feature
31+ // (`imgui = { ..., features = ["docking"] }`). Requires the upstream docking
32+ // sources (compat.imgui 1.92.8-docking); with the feature off, the docking
33+ // sources behave exactly like mainline.
34+ #ifdef MCPP_FEATURE_DOCKING
35+ // (ImGuiID / ImGuiDockNodeFlags are plain-integer typedefs; GMF typedefs
36+ // cannot be re-aliased under the same global name in a module. Consumers
37+ // take DockSpace* return values with `auto`.)
38+ export namespace ImGui {
39+ using ::ImGui::DockSpace;
40+ using ::ImGui::DockSpaceOverViewport;
41+ using ::ImGui::SetNextWindowDockID;
42+ using ::ImGui::GetWindowDockID;
43+ using ::ImGui::IsWindowDocked;
44+
45+ // Unscoped global enumerators, re-exported as namespaced constants for
46+ // module consumers.
47+ inline constexpr int ConfigFlags_DockingEnable = ::ImGuiConfigFlags_DockingEnable;
48+ inline constexpr int Cond_FirstUseEver = ::ImGuiCond_FirstUseEver;
49+ }
50+ #endif
You can’t perform that action at this time.
0 commit comments