Begin: Work toward obsoleting the 5-arguments Begin() overload. Internal BeginEx() becomes the normal public Begin() again! (4)

This commit is contained in:
omar 2017-10-17 16:15:46 +02:00
parent 2739b6ebcd
commit 78a85ba3fe
2 changed files with 9 additions and 16 deletions

View File

@ -4022,18 +4022,6 @@ static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
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!
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)
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)
g.Style.Colors[bg_color_idx] = bg_color_backup;
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;
const ImGuiStyle& style = g.Style;

View File

@ -782,8 +782,6 @@ namespace ImGui
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
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 ClosePopup(ImGuiID id);
IMGUI_API bool IsPopupOpen(ImGuiID id);