Add DemoMarker() function to formalize access for other demos than imgui_demo.cpp (#9261, #3689)

This commit is contained in:
ocornut
2026-02-25 19:25:57 +01:00
parent dd5c604768
commit 8a15a1064d
3 changed files with 20 additions and 6 deletions
+4 -6
View File
@@ -283,12 +283,10 @@ static void HelpMarker(const char* desc)
}
// Helper to wire demo markers located in code to an interactive browser (e.g. imgui_manual)
typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data);
extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
extern void* GImGuiDemoMarkerCallbackUserData;
ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL;
void* GImGuiDemoMarkerCallbackUserData = NULL;
#define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback("imgui_demo.cpp", __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0)
#if IMGUI_VERSION_NUM >= 19263
namespace ImGui { extern IMGUI_API void DemoMarker(const char* file, int line, const char* section); };
#define IMGUI_DEMO_MARKER(section) do { ImGui::DemoMarker("imgui_demo.cpp", __LINE__, section); } while (0)
#endif
// Sneakily forward declare functions which aren't worth putting in public API yet
namespace ImGui