From 8532da3f52149843a07f4262edd753ccb823d12e Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Feb 2015 19:12:48 +0000 Subject: [PATCH] Added BeginChild() variant that takes an ImGuiID --- imgui.cpp | 7 +++++++ imgui.h | 1 + 2 files changed, 8 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 73f93826..c592f034 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2464,6 +2464,13 @@ void ImGui::EndTooltip() ImGui::End(); } +void ImGui::BeginChild(ImGuiID id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags) +{ + char str_id[32]; + ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id); + ImGui::BeginChild(str_id, size, border, extra_flags); +} + void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags) { ImGuiState& g = *GImGui; diff --git a/imgui.h b/imgui.h index 9adcbc4b..38470f11 100644 --- a/imgui.h +++ b/imgui.h @@ -159,6 +159,7 @@ namespace ImGui IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, ImVec2 size = ImVec2(0,0), float fill_alpha = -1.0f, ImGuiWindowFlags flags = 0);// return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed. IMGUI_API void End(); IMGUI_API void BeginChild(const char* str_id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis. + IMGUI_API void BeginChild(ImGuiID id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // " IMGUI_API void EndChild(); IMGUI_API bool GetWindowIsFocused(); IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries