mirror of
https://github.com/Drezil/imgui.git
synced 2025-01-23 21:16:34 +00:00
BeginChild() return a bool analoguous to Begin(). if true you can skip submitting content.
This commit is contained in:
parent
8f75cffc09
commit
4deeaea93c
11
imgui.cpp
11
imgui.cpp
@ -2494,7 +2494,7 @@ void ImGui::EndTooltip()
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
|
bool ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
|
||||||
{
|
{
|
||||||
ImGuiState& g = *GImGui;
|
ImGuiState& g = *GImGui;
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
@ -2523,17 +2523,20 @@ void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindow
|
|||||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
|
||||||
|
|
||||||
const float alpha = 1.0f;
|
const float alpha = 1.0f;
|
||||||
ImGui::Begin(title, NULL, size, alpha, flags);
|
bool ret = ImGui::Begin(title, NULL, size, alpha, flags);
|
||||||
|
|
||||||
if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
|
if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
|
||||||
g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::BeginChild(ImGuiID id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
|
bool ImGui::BeginChild(ImGuiID id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
|
||||||
{
|
{
|
||||||
char str_id[32];
|
char str_id[32];
|
||||||
ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id);
|
ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%x", id);
|
||||||
ImGui::BeginChild(str_id, size, border, extra_flags);
|
bool ret = ImGui::BeginChild(str_id, size, border, extra_flags);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndChild()
|
void ImGui::EndChild()
|
||||||
|
4
imgui.h
4
imgui.h
@ -159,8 +159,8 @@ namespace ImGui
|
|||||||
// Window
|
// Window
|
||||||
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 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 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 bool 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 bool BeginChild(ImGuiID id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
||||||
IMGUI_API void EndChild();
|
IMGUI_API void EndChild();
|
||||||
IMGUI_API bool GetWindowIsFocused();
|
IMGUI_API bool GetWindowIsFocused();
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
||||||
|
Loading…
Reference in New Issue
Block a user