mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-17 21:56:36 +00:00
Merge 2545d75c3b
from Nav - Tidying up, removed two unnecessary window flags from being exposed in imgui.h
This commit is contained in:
parent
d5b0d51274
commit
50b3a14d0a
15
imgui.cpp
15
imgui.cpp
@ -1775,6 +1775,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
PopupId = 0;
|
||||
AutoFitFramesX = AutoFitFramesY = -1;
|
||||
AutoFitOnlyGrows = false;
|
||||
AutoFitChildAxises = 0x00;
|
||||
AutoPosLastDirection = -1;
|
||||
HiddenFrames = 0;
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
|
||||
@ -3636,18 +3637,11 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
||||
|
||||
const ImVec2 content_avail = ImGui::GetContentRegionAvail();
|
||||
ImVec2 size = ImFloor(size_arg);
|
||||
const int auto_fit_axises = ((size.x == 0.0f) ? 0x01 : 0x00) | ((size.y == 0.0f) ? 0x02 : 0x00);
|
||||
if (size.x <= 0.0f)
|
||||
{
|
||||
if (size.x == 0.0f)
|
||||
flags |= ImGuiWindowFlags_ChildWindowAutoFitX;
|
||||
size.x = ImMax(content_avail.x, 4.0f) - fabsf(size.x); // Arbitrary minimum zero-ish child size of 4.0f (0.0f causing too much issues)
|
||||
}
|
||||
if (size.y <= 0.0f)
|
||||
{
|
||||
if (size.y == 0.0f)
|
||||
flags |= ImGuiWindowFlags_ChildWindowAutoFitY;
|
||||
size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y);
|
||||
}
|
||||
if (border)
|
||||
flags |= ImGuiWindowFlags_ShowBorders;
|
||||
flags |= extra_flags;
|
||||
@ -3660,6 +3654,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
||||
|
||||
bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
|
||||
ImGuiWindow* child_window = ImGui::GetCurrentWindow();
|
||||
child_window->AutoFitChildAxises = auto_fit_axises;
|
||||
if (!(parent_window->Flags & ImGuiWindowFlags_ShowBorders))
|
||||
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
||||
|
||||
@ -3690,9 +3685,9 @@ void ImGui::EndChild()
|
||||
{
|
||||
// When using auto-filling child window, we don't provide full width/height to ItemSize so that it doesn't feed back into automatic size-fitting.
|
||||
ImVec2 sz = GetWindowSize();
|
||||
if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitX) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
|
||||
if (window->AutoFitChildAxises & 0x01) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
|
||||
sz.x = ImMax(4.0f, sz.x);
|
||||
if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitY)
|
||||
if (window->AutoFitChildAxises & 0x02)
|
||||
sz.y = ImMax(4.0f, sz.y);
|
||||
|
||||
ImGui::End();
|
||||
|
4
imgui.h
4
imgui.h
@ -512,9 +512,7 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x)
|
||||
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
|
||||
// [Internal]
|
||||
ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 22, // Don't use! For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ChildWindow = 1 << 22, // Don't use! For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ComboBox = 1 << 23, // Don't use! For internal use by ComboBox()
|
||||
ImGuiWindowFlags_Tooltip = 1 << 24, // Don't use! For internal use by BeginTooltip()
|
||||
ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup()
|
||||
|
@ -679,6 +679,7 @@ struct IMGUI_API ImGuiWindow
|
||||
ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
|
||||
int AutoFitFramesX, AutoFitFramesY;
|
||||
bool AutoFitOnlyGrows;
|
||||
int AutoFitChildAxises;
|
||||
int AutoPosLastDirection;
|
||||
int HiddenFrames;
|
||||
ImGuiCond SetWindowPosAllowFlags; // store condition flags for next SetWindowPos() call.
|
||||
|
Loading…
Reference in New Issue
Block a user