mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
Tidying up, removed two unnecessary window flags from being exposed in imgui.h
This commit is contained in:
parent
b3cba62b80
commit
2545d75c3b
15
imgui.cpp
15
imgui.cpp
@ -1743,6 +1743,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|||||||
NavLastId = 0;
|
NavLastId = 0;
|
||||||
AutoFitFramesX = AutoFitFramesY = -1;
|
AutoFitFramesX = AutoFitFramesY = -1;
|
||||||
AutoFitOnlyGrows = false;
|
AutoFitOnlyGrows = false;
|
||||||
|
AutoFitChildAxises = 0x00;
|
||||||
AutoPosLastDirection = -1;
|
AutoPosLastDirection = -1;
|
||||||
HiddenFrames = 0;
|
HiddenFrames = 0;
|
||||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing;
|
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing;
|
||||||
@ -4161,18 +4162,11 @@ bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border,
|
|||||||
|
|
||||||
const ImVec2 content_avail = GetContentRegionAvail();
|
const ImVec2 content_avail = GetContentRegionAvail();
|
||||||
ImVec2 size = ImFloor(size_arg);
|
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)
|
||||||
{
|
|
||||||
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)
|
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)
|
||||||
{
|
|
||||||
if (size.y == 0.0f)
|
|
||||||
flags |= ImGuiWindowFlags_ChildWindowAutoFitY;
|
|
||||||
size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y);
|
size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y);
|
||||||
}
|
|
||||||
if (border)
|
if (border)
|
||||||
flags |= ImGuiWindowFlags_ShowBorders;
|
flags |= ImGuiWindowFlags_ShowBorders;
|
||||||
flags |= extra_flags;
|
flags |= extra_flags;
|
||||||
@ -4182,6 +4176,7 @@ bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border,
|
|||||||
|
|
||||||
bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
|
bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
|
||||||
ImGuiWindow* child_window = GetCurrentWindow();
|
ImGuiWindow* child_window = GetCurrentWindow();
|
||||||
|
child_window->AutoFitChildAxises = auto_fit_axises;
|
||||||
if (!(parent_window->Flags & ImGuiWindowFlags_ShowBorders))
|
if (!(parent_window->Flags & ImGuiWindowFlags_ShowBorders))
|
||||||
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
||||||
|
|
||||||
@ -4218,9 +4213,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.
|
// 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();
|
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);
|
sz.x = ImMax(4.0f, sz.x);
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildWindowAutoFitY)
|
if (window->AutoFitChildAxises & 0x02)
|
||||||
sz.y = ImMax(4.0f, sz.y);
|
sz.y = ImMax(4.0f, sz.y);
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
4
imgui.h
4
imgui.h
@ -513,9 +513,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
||||||
ImGuiWindowFlags_NavFlattened = 1 << 19, // Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
ImGuiWindowFlags_NavFlattened = 1 << 19, // Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindow = 1 << 22, // 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_ComboBox = 1 << 23, // Don't use! For internal use by ComboBox()
|
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_Tooltip = 1 << 24, // Don't use! For internal use by BeginTooltip()
|
||||||
ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup()
|
ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup()
|
||||||
|
@ -700,6 +700,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImGuiID NavLastId; // Last known NavId for this window, for nav layer 0 only.
|
ImGuiID NavLastId; // Last known NavId for this window, for nav layer 0 only.
|
||||||
int AutoFitFramesX, AutoFitFramesY;
|
int AutoFitFramesX, AutoFitFramesY;
|
||||||
bool AutoFitOnlyGrows;
|
bool AutoFitOnlyGrows;
|
||||||
|
int AutoFitChildAxises;
|
||||||
int AutoPosLastDirection;
|
int AutoPosLastDirection;
|
||||||
int HiddenFrames;
|
int HiddenFrames;
|
||||||
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call will succeed with this particular flag.
|
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call will succeed with this particular flag.
|
||||||
|
Loading…
Reference in New Issue
Block a user