Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Doc] imgui_demo.cpp: Add DEMO_MARKERS and DemoCodeWindow
This commit provides the ability to pinpoint the exact location of the code of all the demos in imgui_demo.cpp: when the "Code Lookup" checkbox is ticked, the code location (file and line number) of any demo currently hovered by the mouse will be shown in a tooltip. Furthermore a basic code viewer is provided (which reads the code from the imgui_demo.cpp file); as well as a "View on github" button. Implementation notes: - This feature is provided by the "DEMO_MARKER" macro. See example usage below - Most of the code for this feature is grouped inside the namespace `DemoMarkerTools`. Origin: These modifications are the basis for a more complete interactive imgui manual (https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html). This manual was first presented in the "Gallery/screenshots (part 11)" discussion (ocornut#3075) // Example usage of the DEMO_MARKER macro (with hierarchical demos): DEMO_MARKER("Widgets"); // For clarity, calls to the DEMO_MARKER macro DEMO_MARKER("Widgets/Basic"); // should try to be hierarchical (via the use of "/" separators) ... DEMO_MARKER("Widgets/Basic/Checkbox"); // Here the call to DEMO_MARKER will start a new rectangular bounding static bool check = true; // around the next widget(s). Whenever the user clicks the "Help/Code Lookup" ImGui::Checkbox("checkbox", &check); // button and then click this bounding, he will be shown the source code location, // of this DEMO_MARKER call. DEMO_MARKER("Widgets/Basic/RadioButton"); // End of the previous bounding, start of a new one static int e = 0; ImGui::RadioButton("radio a", &e, 0); ImGui::SameLine(); ----
- Loading branch information