mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-14 23:24:00 +00:00
Begin: Work toward obsoleting the 5-arguments Begin() overload. Internal BeginEx() becomes the normal public Begin() again! (4)
This commit is contained in:
parent
2739b6ebcd
commit
78a85ba3fe
23
imgui.cpp
23
imgui.cpp
@ -4022,18 +4022,6 @@ static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
|
|||||||
return ImGuiCol_WindowBg;
|
return ImGuiCol_WindowBg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push a new ImGui window to add widgets to.
|
|
||||||
// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.
|
|
||||||
// - Begin/End can be called multiple times during the frame with the same window name to append content.
|
|
||||||
// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).
|
|
||||||
// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.
|
|
||||||
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
|
|
||||||
// - Passing 'bool* p_open' 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.
|
|
||||||
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
||||||
{
|
|
||||||
return BeginEx(name, p_open, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME-OBSOLETE: Old Begin() API, avoid calling this version directly!
|
// FIXME-OBSOLETE: Old Begin() API, avoid calling this version directly!
|
||||||
bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override, ImGuiWindowFlags flags)
|
bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override, ImGuiWindowFlags flags)
|
||||||
{
|
{
|
||||||
@ -4052,14 +4040,21 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|||||||
if (bg_alpha_override >= 0.0f)
|
if (bg_alpha_override >= 0.0f)
|
||||||
g.Style.Colors[bg_color_idx].w = bg_alpha_override;
|
g.Style.Colors[bg_color_idx].w = bg_alpha_override;
|
||||||
|
|
||||||
bool ret = BeginEx(name, p_open, flags);
|
bool ret = Begin(name, p_open, flags);
|
||||||
|
|
||||||
if (bg_alpha_override >= 0.0f)
|
if (bg_alpha_override >= 0.0f)
|
||||||
g.Style.Colors[bg_color_idx] = bg_color_backup;
|
g.Style.Colors[bg_color_idx] = bg_color_backup;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::BeginEx(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
// Push a new ImGui window to add widgets to.
|
||||||
|
// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.
|
||||||
|
// - Begin/End can be called multiple times during the frame with the same window name to append content.
|
||||||
|
// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).
|
||||||
|
// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.
|
||||||
|
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
|
||||||
|
// - Passing 'bool* p_open' 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.
|
||||||
|
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
|
@ -782,8 +782,6 @@ namespace ImGui
|
|||||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
|
|
||||||
IMGUI_API bool BeginEx(const char* name, bool* p_open, ImGuiWindowFlags flags);
|
|
||||||
|
|
||||||
IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing);
|
IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing);
|
||||||
IMGUI_API void ClosePopup(ImGuiID id);
|
IMGUI_API void ClosePopup(ImGuiID id);
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user