|
@@ -214,6 +214,11 @@
|
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
|
|
|
|
+ - 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up.
|
|
|
|
|
+ Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions.
|
|
|
|
|
+ - 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency.
|
|
|
|
|
+ - 2017/11/18 (1.53) - Style: renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg.
|
|
|
|
|
+ - 2017/11/18 (1.53) - Style: renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding.
|
|
|
- 2017/11/02 (1.53) - marked IsRootWindowOrAnyChildHovered() as obsolete is favor of using IsWindowHovered(ImGuiHoveredFlags_FlattenChilds);
|
|
- 2017/11/02 (1.53) - marked IsRootWindowOrAnyChildHovered() as obsolete is favor of using IsWindowHovered(ImGuiHoveredFlags_FlattenChilds);
|
|
|
- 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency.
|
|
- 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency.
|
|
|
- 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it.
|
|
- 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it.
|
|
@@ -705,12 +710,17 @@ ImGuiStyle::ImGuiStyle()
|
|
|
{
|
|
{
|
|
|
Alpha = 1.0f; // Global alpha applies to everything in ImGui
|
|
Alpha = 1.0f; // Global alpha applies to everything in ImGui
|
|
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
|
|
- WindowMinSize = ImVec2(32,32); // Minimum window size
|
|
|
|
|
WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
|
WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
|
|
|
|
+ WindowBorderSize = 0.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
|
|
+ WindowMinSize = ImVec2(32,32); // Minimum window size
|
|
|
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
|
|
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
|
|
|
- ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
|
|
|
|
|
|
+ ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
|
|
|
|
+ ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
|
|
+ PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
|
|
|
|
|
+ PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
|
|
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
|
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
|
|
|
|
+ FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
|
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
|
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
|
@@ -731,26 +741,27 @@ ImGuiStyle::ImGuiStyle()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.
|
|
// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.
|
|
|
-// Tips: if you need to change your scale multiple times, prefer calling this on a freshly initialized ImGuiStyle structure rather than scaling multiple times (because floating point multiplications are lossy).
|
|
|
|
|
|
|
+// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times.
|
|
|
void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|
void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|
|
{
|
|
{
|
|
|
- WindowPadding *= scale_factor;
|
|
|
|
|
- WindowMinSize *= scale_factor;
|
|
|
|
|
- WindowRounding *= scale_factor;
|
|
|
|
|
- ChildWindowRounding *= scale_factor;
|
|
|
|
|
- FramePadding *= scale_factor;
|
|
|
|
|
- FrameRounding *= scale_factor;
|
|
|
|
|
- ItemSpacing *= scale_factor;
|
|
|
|
|
- ItemInnerSpacing *= scale_factor;
|
|
|
|
|
- TouchExtraPadding *= scale_factor;
|
|
|
|
|
- IndentSpacing *= scale_factor;
|
|
|
|
|
- ColumnsMinSpacing *= scale_factor;
|
|
|
|
|
- ScrollbarSize *= scale_factor;
|
|
|
|
|
- ScrollbarRounding *= scale_factor;
|
|
|
|
|
- GrabMinSize *= scale_factor;
|
|
|
|
|
- GrabRounding *= scale_factor;
|
|
|
|
|
- DisplayWindowPadding *= scale_factor;
|
|
|
|
|
- DisplaySafeAreaPadding *= scale_factor;
|
|
|
|
|
|
|
+ WindowPadding = ImFloor(WindowPadding * scale_factor);
|
|
|
|
|
+ WindowRounding = ImFloor(WindowRounding * scale_factor);
|
|
|
|
|
+ WindowMinSize = ImFloor(WindowMinSize * scale_factor);
|
|
|
|
|
+ ChildRounding = ImFloor(ChildRounding * scale_factor);
|
|
|
|
|
+ PopupRounding = ImFloor(PopupRounding * scale_factor);
|
|
|
|
|
+ FramePadding = ImFloor(FramePadding * scale_factor);
|
|
|
|
|
+ FrameRounding = ImFloor(FrameRounding * scale_factor);
|
|
|
|
|
+ ItemSpacing = ImFloor(ItemSpacing * scale_factor);
|
|
|
|
|
+ ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor);
|
|
|
|
|
+ TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor);
|
|
|
|
|
+ IndentSpacing = ImFloor(IndentSpacing * scale_factor);
|
|
|
|
|
+ ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor);
|
|
|
|
|
+ ScrollbarSize = ImFloor(ScrollbarSize * scale_factor);
|
|
|
|
|
+ ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);
|
|
|
|
|
+ GrabMinSize = ImFloor(GrabMinSize * scale_factor);
|
|
|
|
|
+ GrabRounding = ImFloor(GrabRounding * scale_factor);
|
|
|
|
|
+ DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
|
|
|
|
|
+ DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ImGuiIO::ImGuiIO()
|
|
ImGuiIO::ImGuiIO()
|
|
@@ -1793,15 +1804,16 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|
|
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
|
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
|
|
SizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f);
|
|
SizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f);
|
|
|
WindowPadding = ImVec2(0.0f, 0.0f);
|
|
WindowPadding = ImVec2(0.0f, 0.0f);
|
|
|
|
|
+ WindowRounding = 0.0f;
|
|
|
|
|
+ WindowBorderSize = 0.0f;
|
|
|
MoveId = GetID("#MOVE");
|
|
MoveId = GetID("#MOVE");
|
|
|
Scroll = ImVec2(0.0f, 0.0f);
|
|
Scroll = ImVec2(0.0f, 0.0f);
|
|
|
ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
|
|
ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
|
|
|
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
|
|
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
|
|
|
ScrollbarX = ScrollbarY = false;
|
|
ScrollbarX = ScrollbarY = false;
|
|
|
ScrollbarSizes = ImVec2(0.0f, 0.0f);
|
|
ScrollbarSizes = ImVec2(0.0f, 0.0f);
|
|
|
- BorderSize = 0.0f;
|
|
|
|
|
Active = WasActive = false;
|
|
Active = WasActive = false;
|
|
|
- Accessed = false;
|
|
|
|
|
|
|
+ WriteAccessed = false;
|
|
|
Collapsed = false;
|
|
Collapsed = false;
|
|
|
SkipItems = false;
|
|
SkipItems = false;
|
|
|
Appearing = false;
|
|
Appearing = false;
|
|
@@ -2011,6 +2023,9 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|
|
return false;
|
|
return false;
|
|
|
if (window->DC.ItemFlags & ImGuiItemFlags_Disabled)
|
|
if (window->DC.ItemFlags & ImGuiItemFlags_Disabled)
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+ // Special handling for the 1st item after Begin() which represent the title bar. When the window is collapsed (SkipItems==true) that last item will never be overwritten.
|
|
|
|
|
+ if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
|
|
|
|
|
+ return false;
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2201,12 +2216,14 @@ void ImGui::NewFrame()
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
|
|
|
// Check user data
|
|
// Check user data
|
|
|
- IM_ASSERT(g.IO.DeltaTime >= 0.0f); // Need a positive DeltaTime (zero is tolerated but will cause some timing issues)
|
|
|
|
|
- IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f);
|
|
|
|
|
- IM_ASSERT(g.IO.Fonts->Fonts.Size > 0); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
|
|
|
|
|
- IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
|
|
|
|
|
- IM_ASSERT(g.Style.CurveTessellationTol > 0.0f); // Invalid style setting
|
|
|
|
|
- IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f); // Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)
|
|
|
|
|
|
|
+ // (We pass an error message in the assert expression as a trick to get it visible to programmers who are not using a debugger, as most assert handlers display their argument)
|
|
|
|
|
+ IM_ASSERT(g.IO.DeltaTime >= 0.0f && "Need a positive DeltaTime (zero is tolerated but will cause some timing issues)");
|
|
|
|
|
+ IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value");
|
|
|
|
|
+ IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?");
|
|
|
|
|
+ IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?");
|
|
|
|
|
+ IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting");
|
|
|
|
|
+ IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)");
|
|
|
|
|
+ IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
|
|
|
|
|
|
|
|
// Initialize on first frame
|
|
// Initialize on first frame
|
|
|
if (!g.Initialized)
|
|
if (!g.Initialized)
|
|
@@ -2412,7 +2429,7 @@ void ImGui::NewFrame()
|
|
|
ImGuiWindow* window = g.Windows[i];
|
|
ImGuiWindow* window = g.Windows[i];
|
|
|
window->WasActive = window->Active;
|
|
window->WasActive = window->Active;
|
|
|
window->Active = false;
|
|
window->Active = false;
|
|
|
- window->Accessed = false;
|
|
|
|
|
|
|
+ window->WriteAccessed = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Closing the focused window restore focus to the first active root window in descending z-order
|
|
// Closing the focused window restore focus to the first active root window in descending z-order
|
|
@@ -2739,7 +2756,8 @@ void ImGui::EndFrame()
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
|
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
|
|
- IM_ASSERT(g.FrameCountEnded != g.FrameCount); // ImGui::EndFrame() called multiple times, or forgot to call ImGui::NewFrame() again
|
|
|
|
|
|
|
+ if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times.
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
|
|
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
|
|
|
if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.OsImePosRequest - g.OsImePosSet) > 0.0001f)
|
|
if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.OsImePosRequest - g.OsImePosSet) > 0.0001f)
|
|
@@ -2750,7 +2768,7 @@ void ImGui::EndFrame()
|
|
|
|
|
|
|
|
// Hide implicit "Debug" window if it hasn't been used
|
|
// Hide implicit "Debug" window if it hasn't been used
|
|
|
IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls
|
|
IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls
|
|
|
- if (g.CurrentWindow && !g.CurrentWindow->Accessed)
|
|
|
|
|
|
|
+ if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
|
|
g.CurrentWindow->Active = false;
|
|
g.CurrentWindow->Active = false;
|
|
|
ImGui::End();
|
|
ImGui::End();
|
|
|
|
|
|
|
@@ -3068,10 +3086,11 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
|
|
- if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
|
|
|
|
+ const float border_size = g.Style.FrameBorderSize;
|
|
|
|
|
+ if (border && border_size > 0.0f)
|
|
|
{
|
|
{
|
|
|
- window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding);
|
|
|
|
|
- window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding);
|
|
|
|
|
|
|
+ window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size);
|
|
|
|
|
+ window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3079,10 +3098,11 @@ void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
- if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
|
|
+ const float border_size = g.Style.FrameBorderSize;
|
|
|
|
|
+ if (border_size > 0.0f)
|
|
|
{
|
|
{
|
|
|
- window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding);
|
|
|
|
|
- window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding);
|
|
|
|
|
|
|
+ window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size);
|
|
|
|
|
+ window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3658,14 +3678,12 @@ static inline void ClearSetNextWindowData()
|
|
|
bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
|
|
bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
- ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
if (!IsPopupOpen(id))
|
|
if (!IsPopupOpen(id))
|
|
|
{
|
|
{
|
|
|
ClearSetNextWindowData(); // We behave like Begin() and need to consume those values
|
|
ClearSetNextWindowData(); // We behave like Begin() and need to consume those values
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
|
|
|
|
ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings;
|
|
ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings;
|
|
|
|
|
|
|
|
char name[20];
|
|
char name[20];
|
|
@@ -3675,9 +3693,7 @@ bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
|
|
|
ImFormatString(name, IM_ARRAYSIZE(name), "##popup_%08x", id); // Not recycling, so we can close/open during the same frame
|
|
ImFormatString(name, IM_ARRAYSIZE(name), "##popup_%08x", id); // Not recycling, so we can close/open during the same frame
|
|
|
|
|
|
|
|
bool is_open = Begin(name, NULL, flags);
|
|
bool is_open = Begin(name, NULL, flags);
|
|
|
- if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
|
|
- g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
|
|
|
|
- if (!is_open) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
|
|
|
|
|
|
+ if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)
|
|
|
EndPopup();
|
|
EndPopup();
|
|
|
|
|
|
|
|
return is_open;
|
|
return is_open;
|
|
@@ -3691,7 +3707,7 @@ bool ImGui::BeginPopup(const char* str_id)
|
|
|
ClearSetNextWindowData(); // We behave like Begin() and need to consume those values
|
|
ClearSetNextWindowData(); // We behave like Begin() and need to consume those values
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- return BeginPopupEx(g.CurrentWindow->GetID(str_id), ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
|
|
|
|
+ return BeginPopupEx(g.CurrentWindow->GetID(str_id), ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::IsPopupOpen(ImGuiID id)
|
|
bool ImGui::IsPopupOpen(ImGuiID id)
|
|
@@ -3740,8 +3756,6 @@ void ImGui::EndPopup()
|
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
|
|
|
IM_ASSERT(GImGui->CurrentPopupStack.Size > 0);
|
|
IM_ASSERT(GImGui->CurrentPopupStack.Size > 0);
|
|
|
End();
|
|
End();
|
|
|
- if (!(window->Flags & ImGuiWindowFlags_Modal))
|
|
|
|
|
- PopStyleVar();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)
|
|
bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)
|
|
@@ -3767,7 +3781,7 @@ bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
|
|
|
IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
|
IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
|
|
if (IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
if (IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
|
OpenPopupEx(id, true);
|
|
OpenPopupEx(id, true);
|
|
|
- return BeginPopupEx(id, ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
|
|
|
|
+ return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items)
|
|
bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items)
|
|
@@ -3779,7 +3793,7 @@ bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool a
|
|
|
if (IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
if (IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
|
if (also_over_items || !IsAnyItemHovered())
|
|
if (also_over_items || !IsAnyItemHovered())
|
|
|
OpenPopupEx(id, true);
|
|
OpenPopupEx(id, true);
|
|
|
- return BeginPopupEx(id, ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
|
|
|
|
+ return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
|
bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
|
@@ -3789,11 +3803,12 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
|
|
ImGuiID id = GImGui->CurrentWindow->GetID(str_id);
|
|
ImGuiID id = GImGui->CurrentWindow->GetID(str_id);
|
|
|
if (!IsAnyWindowHovered() && IsMouseClicked(mouse_button))
|
|
if (!IsAnyWindowHovered() && IsMouseClicked(mouse_button))
|
|
|
OpenPopupEx(id, true);
|
|
OpenPopupEx(id, true);
|
|
|
- return BeginPopupEx(id, ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
|
|
|
|
+ return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
|
|
static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
|
|
|
{
|
|
{
|
|
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
|
|
ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
|
|
|
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
|
|
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
|
|
|
flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag
|
|
flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag
|
|
@@ -3805,8 +3820,10 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|
|
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)
|
|
|
size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y);
|
|
size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y);
|
|
|
- if (border)
|
|
|
|
|
- flags |= ImGuiWindowFlags_ShowBorders;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const float backup_border_size = g.Style.ChildBorderSize;
|
|
|
|
|
+ if (!border)
|
|
|
|
|
+ g.Style.ChildBorderSize = 0.0f;
|
|
|
flags |= extra_flags;
|
|
flags |= extra_flags;
|
|
|
|
|
|
|
|
char title[256];
|
|
char title[256];
|
|
@@ -3819,8 +3836,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|
|
bool ret = ImGui::Begin(title, NULL, flags);
|
|
bool ret = ImGui::Begin(title, NULL, flags);
|
|
|
ImGuiWindow* child_window = ImGui::GetCurrentWindow();
|
|
ImGuiWindow* child_window = ImGui::GetCurrentWindow();
|
|
|
child_window->AutoFitChildAxises = auto_fit_axises;
|
|
child_window->AutoFitChildAxises = auto_fit_axises;
|
|
|
- if (!(parent_window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
|
|
- child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
|
|
|
|
|
|
+ g.Style.ChildBorderSize = backup_border_size;
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
@@ -3867,16 +3883,17 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
|
|
|
{
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
const ImGuiStyle& style = g.Style;
|
|
|
- PushStyleColor(ImGuiCol_ChildWindowBg, style.Colors[ImGuiCol_FrameBg]);
|
|
|
|
|
- PushStyleVar(ImGuiStyleVar_ChildWindowRounding, style.FrameRounding);
|
|
|
|
|
|
|
+ PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
|
|
|
|
+ PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
|
|
|
|
+ PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
|
|
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
|
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
|
|
- return BeginChild(id, size, (g.CurrentWindow->Flags & ImGuiWindowFlags_ShowBorders) ? true : false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
|
|
|
|
|
|
|
+ return BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ImGui::EndChildFrame()
|
|
void ImGui::EndChildFrame()
|
|
|
{
|
|
{
|
|
|
EndChild();
|
|
EndChild();
|
|
|
- PopStyleVar(2);
|
|
|
|
|
|
|
+ PopStyleVar(3);
|
|
|
PopStyleColor();
|
|
PopStyleColor();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4071,12 +4088,10 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
|
|
|
|
|
|
|
|
static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
|
|
static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
|
|
|
{
|
|
{
|
|
|
- if (flags & ImGuiWindowFlags_ComboBox)
|
|
|
|
|
- return ImGuiCol_ComboBg;
|
|
|
|
|
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
|
|
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
|
|
|
return ImGuiCol_PopupBg;
|
|
return ImGuiCol_PopupBg;
|
|
|
if (flags & ImGuiWindowFlags_ChildWindow)
|
|
if (flags & ImGuiWindowFlags_ChildWindow)
|
|
|
- return ImGuiCol_ChildWindowBg;
|
|
|
|
|
|
|
+ return ImGuiCol_ChildBg;
|
|
|
return ImGuiCol_WindowBg;
|
|
return ImGuiCol_WindowBg;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4260,10 +4275,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Lock window padding so that altering the ShowBorders flag for children doesn't have side-effects.
|
|
|
|
|
|
|
+ // Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects.
|
|
|
|
|
+ window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;
|
|
|
|
|
+ window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
|
|
|
window->WindowPadding = style.WindowPadding;
|
|
window->WindowPadding = style.WindowPadding;
|
|
|
- if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup)))
|
|
|
|
|
|
|
+ if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f)
|
|
|
window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
|
|
window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
|
|
|
|
|
+ const float window_rounding = window->WindowRounding;
|
|
|
|
|
+ const float window_border_size = window->WindowBorderSize;
|
|
|
|
|
+// const ImVec2 window_padding = window->WindowPadding;
|
|
|
|
|
|
|
|
// Calculate auto-fit size, handle automatic resize
|
|
// Calculate auto-fit size, handle automatic resize
|
|
|
const ImVec2 size_auto_fit = CalcSizeAutoFit(window);
|
|
const ImVec2 size_auto_fit = CalcSizeAutoFit(window);
|
|
@@ -4312,7 +4332,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
if (window->ScrollbarX && !window->ScrollbarY)
|
|
if (window->ScrollbarX && !window->ScrollbarY)
|
|
|
window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
|
- window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// POSITION
|
|
// POSITION
|
|
@@ -4395,11 +4414,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
|
|
// Draw window + handle manual resize
|
|
// Draw window + handle manual resize
|
|
|
ImRect title_bar_rect = window->TitleBarRect();
|
|
ImRect title_bar_rect = window->TitleBarRect();
|
|
|
- const float window_rounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
|
|
|
|
|
if (window->Collapsed)
|
|
if (window->Collapsed)
|
|
|
{
|
|
{
|
|
|
// Title bar only
|
|
// Title bar only
|
|
|
|
|
+ float backup_border_size = style.FrameBorderSize;
|
|
|
|
|
+ g.Style.FrameBorderSize = window->WindowBorderSize;
|
|
|
RenderFrame(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding);
|
|
RenderFrame(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding);
|
|
|
|
|
+ g.Style.FrameBorderSize = backup_border_size;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -4442,20 +4463,20 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
|
|
// Window background, Default Alpha
|
|
// Window background, Default Alpha
|
|
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
|
|
- window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImGuiCorner_All : ImGuiCorner_BotLeft|ImGuiCorner_BotRight);
|
|
|
|
|
|
|
+ window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
|
|
|
|
|
|
// Title bar
|
|
// Title bar
|
|
|
const bool is_focused = g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow;
|
|
const bool is_focused = g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow;
|
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
- window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32(is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImGuiCorner_TopLeft|ImGuiCorner_TopRight);
|
|
|
|
|
|
|
+ window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32(is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top);
|
|
|
|
|
|
|
|
// Menu bar
|
|
// Menu bar
|
|
|
if (flags & ImGuiWindowFlags_MenuBar)
|
|
if (flags & ImGuiWindowFlags_MenuBar)
|
|
|
{
|
|
{
|
|
|
ImRect menu_bar_rect = window->MenuBarRect();
|
|
ImRect menu_bar_rect = window->MenuBarRect();
|
|
|
- if (flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
- window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border));
|
|
|
|
|
- window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImGuiCorner_TopLeft|ImGuiCorner_TopRight);
|
|
|
|
|
|
|
+ window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top);
|
|
|
|
|
+ if (style.FrameBorderSize > 0.0f)
|
|
|
|
|
+ window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Scrollbars
|
|
// Scrollbars
|
|
@@ -4469,20 +4490,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
if (!(flags & ImGuiWindowFlags_NoResize))
|
|
if (!(flags & ImGuiWindowFlags_NoResize))
|
|
|
{
|
|
{
|
|
|
const ImVec2 br = window->Rect().GetBR();
|
|
const ImVec2 br = window->Rect().GetBR();
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window->BorderSize));
|
|
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(-window->BorderSize, -resize_corner_size));
|
|
|
|
|
- window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window->BorderSize, br.y - window_rounding - window->BorderSize), window_rounding, 0, 3);
|
|
|
|
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window_border_size));
|
|
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-window_border_size, -resize_corner_size));
|
|
|
|
|
+ window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window_border_size, br.y - window_rounding - window_border_size), window_rounding, 0, 3);
|
|
|
window->DrawList->PathFillConvex(resize_col);
|
|
window->DrawList->PathFillConvex(resize_col);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Borders
|
|
// Borders
|
|
|
- if (flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
- {
|
|
|
|
|
- window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), window_rounding);
|
|
|
|
|
- window->DrawList->AddRect(window->Pos, window->Pos+window->Size, GetColorU32(ImGuiCol_Border), window_rounding);
|
|
|
|
|
- if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
|
|
- window->DrawList->AddLine(title_bar_rect.GetBL()+ImVec2(1,0), title_bar_rect.GetBR()-ImVec2(1,0), GetColorU32(ImGuiCol_Border));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (window_border_size > 0.0f)
|
|
|
|
|
+ window->DrawList->AddRect(window->Pos, window->Pos+window->Size, GetColorU32(ImGuiCol_Border), window_rounding, ImDrawCornerFlags_All, window_border_size);
|
|
|
|
|
+ if (style.FrameBorderSize > 0 && !(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
|
|
+ window->DrawList->AddLine(title_bar_rect.GetBL()+ImVec2(1,-1), title_bar_rect.GetBR()+ImVec2(-1,-1), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Update ContentsRegionMax. All the variable it depends on are set above in this function.
|
|
// Update ContentsRegionMax. All the variable it depends on are set above in this function.
|
|
@@ -4602,7 +4620,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
|
|
// Inner clipping rectangle
|
|
// Inner clipping rectangle
|
|
|
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
|
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
|
|
- const float border_size = window->BorderSize;
|
|
|
|
|
|
|
+ const float border_size = window->WindowBorderSize;
|
|
|
ImRect clip_rect;
|
|
ImRect clip_rect;
|
|
|
clip_rect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
|
clip_rect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f)));
|
|
|
clip_rect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + border_size);
|
|
clip_rect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + border_size);
|
|
@@ -4612,7 +4630,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
|
|
// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
|
|
// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
|
|
|
if (first_begin_of_the_frame)
|
|
if (first_begin_of_the_frame)
|
|
|
- window->Accessed = false;
|
|
|
|
|
|
|
+ window->WriteAccessed = false;
|
|
|
|
|
|
|
|
window->BeginCount++;
|
|
window->BeginCount++;
|
|
|
g.SetNextWindowSizeConstraint = false;
|
|
g.SetNextWindowSizeConstraint = false;
|
|
@@ -4706,7 +4724,7 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
|
|
|
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
|
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
|
|
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
|
|
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
|
|
|
const ImRect window_rect = window->Rect();
|
|
const ImRect window_rect = window->Rect();
|
|
|
- const float border_size = window->BorderSize;
|
|
|
|
|
|
|
+ const float border_size = window->WindowBorderSize;
|
|
|
ImRect bb = horizontal
|
|
ImRect bb = horizontal
|
|
|
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)
|
|
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)
|
|
|
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);
|
|
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);
|
|
@@ -4715,13 +4733,12 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
|
|
|
if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f)
|
|
if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
- float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
|
|
|
|
|
int window_rounding_corners;
|
|
int window_rounding_corners;
|
|
|
if (horizontal)
|
|
if (horizontal)
|
|
|
- window_rounding_corners = ImGuiCorner_BotLeft | (other_scrollbar ? 0 : ImGuiCorner_BotRight);
|
|
|
|
|
|
|
+ window_rounding_corners = ImDrawCornerFlags_BotLeft | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);
|
|
|
else
|
|
else
|
|
|
- window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImGuiCorner_TopRight : 0) | (other_scrollbar ? 0 : ImGuiCorner_BotRight);
|
|
|
|
|
- window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
|
|
|
|
|
|
|
+ window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0) | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);
|
|
|
|
|
+ window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, window_rounding_corners);
|
|
|
bb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
|
bb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
|
|
|
|
|
|
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
|
@@ -5037,10 +5054,15 @@ static const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] =
|
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha
|
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding
|
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowBorderSize) }, // ImGuiStyleVar_WindowBorderSize
|
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize
|
|
|
- { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildWindowRounding) }, // ImGuiStyleVar_ChildWindowRounding
|
|
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildRounding) }, // ImGuiStyleVar_ChildRounding
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildBorderSize) }, // ImGuiStyleVar_ChildBorderSize
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupRounding) }, // ImGuiStyleVar_PopupRounding
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize
|
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding
|
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding
|
|
|
|
|
+ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize
|
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing
|
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing
|
|
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing
|
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing
|
|
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing
|
|
@@ -5106,7 +5128,7 @@ const char* ImGui::GetStyleColorName(ImGuiCol idx)
|
|
|
case ImGuiCol_Text: return "Text";
|
|
case ImGuiCol_Text: return "Text";
|
|
|
case ImGuiCol_TextDisabled: return "TextDisabled";
|
|
case ImGuiCol_TextDisabled: return "TextDisabled";
|
|
|
case ImGuiCol_WindowBg: return "WindowBg";
|
|
case ImGuiCol_WindowBg: return "WindowBg";
|
|
|
- case ImGuiCol_ChildWindowBg: return "ChildWindowBg";
|
|
|
|
|
|
|
+ case ImGuiCol_ChildBg: return "ChildBg";
|
|
|
case ImGuiCol_PopupBg: return "PopupBg";
|
|
case ImGuiCol_PopupBg: return "PopupBg";
|
|
|
case ImGuiCol_Border: return "Border";
|
|
case ImGuiCol_Border: return "Border";
|
|
|
case ImGuiCol_BorderShadow: return "BorderShadow";
|
|
case ImGuiCol_BorderShadow: return "BorderShadow";
|
|
@@ -5121,7 +5143,6 @@ const char* ImGui::GetStyleColorName(ImGuiCol idx)
|
|
|
case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab";
|
|
case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab";
|
|
|
case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered";
|
|
case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered";
|
|
|
case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive";
|
|
case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive";
|
|
|
- case ImGuiCol_ComboBg: return "ComboBg";
|
|
|
|
|
case ImGuiCol_CheckMark: return "CheckMark";
|
|
case ImGuiCol_CheckMark: return "CheckMark";
|
|
|
case ImGuiCol_SliderGrab: return "SliderGrab";
|
|
case ImGuiCol_SliderGrab: return "SliderGrab";
|
|
|
case ImGuiCol_SliderGrabActive: return "SliderGrabActive";
|
|
case ImGuiCol_SliderGrabActive: return "SliderGrabActive";
|
|
@@ -7615,7 +7636,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
|
|
|
// Render
|
|
// Render
|
|
|
fraction = ImSaturate(fraction);
|
|
fraction = ImSaturate(fraction);
|
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
- bb.Expand(ImVec2(-window->BorderSize, -window->BorderSize));
|
|
|
|
|
|
|
+ bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));
|
|
|
const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
|
|
const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
|
|
|
RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);
|
|
RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);
|
|
|
|
|
|
|
@@ -7738,10 +7759,10 @@ bool ImGui::RadioButton(const char* label, bool active)
|
|
|
window->DrawList->AddCircleFilled(center, radius-pad, GetColorU32(ImGuiCol_CheckMark), 16);
|
|
window->DrawList->AddCircleFilled(center, radius-pad, GetColorU32(ImGuiCol_CheckMark), 16);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
|
|
+ if (style.FrameBorderSize > 0.0f)
|
|
|
{
|
|
{
|
|
|
- window->DrawList->AddCircle(center+ImVec2(1,1), radius, GetColorU32(ImGuiCol_BorderShadow), 16);
|
|
|
|
|
- window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16);
|
|
|
|
|
|
|
+ window->DrawList->AddCircle(center+ImVec2(1,1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize);
|
|
|
|
|
+ window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (g.LogEnabled)
|
|
if (g.LogEnabled)
|
|
@@ -8880,18 +8901,17 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popu
|
|
|
// Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement)
|
|
// Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement)
|
|
|
popup_y1 = ImClamp(frame_bb.Min.y - popup_size.y, style.DisplaySafeAreaPadding.y, frame_bb.Min.y);
|
|
popup_y1 = ImClamp(frame_bb.Min.y - popup_size.y, style.DisplaySafeAreaPadding.y, frame_bb.Min.y);
|
|
|
popup_y2 = frame_bb.Min.y;
|
|
popup_y2 = frame_bb.Min.y;
|
|
|
- SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Min.y), ImGuiCond_Always, ImVec2(0.0f, 1.0f));
|
|
|
|
|
|
|
+ SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FrameBorderSize), ImGuiCond_Always, ImVec2(0.0f, 1.0f));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
// Position our combo below
|
|
// Position our combo below
|
|
|
- SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Max.y), ImGuiCond_Always, ImVec2(0.0f, 0.0f));
|
|
|
|
|
|
|
+ SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Max.y - style.FrameBorderSize), ImGuiCond_Always, ImVec2(0.0f, 0.0f));
|
|
|
}
|
|
}
|
|
|
SetNextWindowSize(ImVec2(popup_size.x, popup_y2 - popup_y1), ImGuiCond_Appearing);
|
|
SetNextWindowSize(ImVec2(popup_size.x, popup_y2 - popup_y1), ImGuiCond_Appearing);
|
|
|
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
|
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
|
|
|
|
|
|
|
- const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ((window->Flags & ImGuiWindowFlags_ShowBorders) ? ImGuiWindowFlags_ShowBorders : 0);
|
|
|
|
|
- if (!BeginPopupEx(id, flags))
|
|
|
|
|
|
|
+ if (!BeginPopupEx(id, ImGuiWindowFlags_ComboBox))
|
|
|
{
|
|
{
|
|
|
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
|
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
|
|
return false;
|
|
return false;
|
|
@@ -9224,7 +9244,7 @@ bool ImGui::BeginMenuBar()
|
|
|
PushID("##menubar");
|
|
PushID("##menubar");
|
|
|
ImRect rect = window->MenuBarRect();
|
|
ImRect rect = window->MenuBarRect();
|
|
|
rect.Max.x = ImMax(rect.Min.x, rect.Max.x - g.Style.WindowRounding);
|
|
rect.Max.x = ImMax(rect.Min.x, rect.Max.x - g.Style.WindowRounding);
|
|
|
- PushClipRect(ImVec2(ImFloor(rect.Min.x+0.5f), ImFloor(rect.Min.y + window->BorderSize + 0.5f)), ImVec2(ImFloor(rect.Max.x+0.5f), ImFloor(rect.Max.y+0.5f)), false);
|
|
|
|
|
|
|
+ PushClipRect(ImVec2(ImFloor(rect.Min.x+0.5f), ImFloor(rect.Min.y + window->WindowBorderSize + 0.5f)), ImVec2(ImFloor(rect.Max.x+0.5f), ImFloor(rect.Max.y+0.5f)), false);
|
|
|
window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y);
|
|
window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y);
|
|
|
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
|
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
|
|
window->DC.MenuBarAppending = true;
|
|
window->DC.MenuBarAppending = true;
|
|
@@ -9357,7 +9377,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
if (menu_is_open)
|
|
if (menu_is_open)
|
|
|
{
|
|
{
|
|
|
SetNextWindowPos(popup_pos, ImGuiCond_Always);
|
|
SetNextWindowPos(popup_pos, ImGuiCond_Always);
|
|
|
- ImGuiWindowFlags flags = ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_AlwaysAutoResize | ((window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu|ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu);
|
|
|
|
|
|
|
+ ImGuiWindowFlags flags = ImGuiWindowFlags_AlwaysAutoResize | ((window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu|ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu);
|
|
|
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
|
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -9426,8 +9446,8 @@ void ImGui::RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU
|
|
|
if (x2 <= x1)
|
|
if (x2 <= x1)
|
|
|
continue;
|
|
continue;
|
|
|
int rounding_corners_flags_cell = 0;
|
|
int rounding_corners_flags_cell = 0;
|
|
|
- if (y1 <= p_min.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImGuiCorner_TopLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImGuiCorner_TopRight; }
|
|
|
|
|
- if (y2 >= p_max.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImGuiCorner_BotLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImGuiCorner_BotRight; }
|
|
|
|
|
|
|
+ if (y1 <= p_min.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopRight; }
|
|
|
|
|
+ if (y2 >= p_max.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotRight; }
|
|
|
rounding_corners_flags_cell &= rounding_corners_flags;
|
|
rounding_corners_flags_cell &= rounding_corners_flags;
|
|
|
window->DrawList->AddRectFilled(ImVec2(x1,y1), ImVec2(x2,y2), col_bg2, rounding_corners_flags_cell ? rounding : 0.0f, rounding_corners_flags_cell);
|
|
window->DrawList->AddRectFilled(ImVec2(x1,y1), ImVec2(x2,y2), col_bg2, rounding_corners_flags_cell ? rounding : 0.0f, rounding_corners_flags_cell);
|
|
|
}
|
|
}
|
|
@@ -9490,8 +9510,8 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
|
|
|
if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col.w < 1.0f)
|
|
if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col.w < 1.0f)
|
|
|
{
|
|
{
|
|
|
float mid_x = (float)(int)((bb_inner.Min.x + bb_inner.Max.x) * 0.5f + 0.5f);
|
|
float mid_x = (float)(int)((bb_inner.Min.x + bb_inner.Max.x) * 0.5f + 0.5f);
|
|
|
- RenderColorRectWithAlphaCheckerboard(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col), grid_step, ImVec2(-grid_step + off, off), rounding, ImGuiCorner_TopRight|ImGuiCorner_BotRight);
|
|
|
|
|
- window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_without_alpha), rounding, ImGuiCorner_TopLeft|ImGuiCorner_BotLeft);
|
|
|
|
|
|
|
+ RenderColorRectWithAlphaCheckerboard(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawCornerFlags_TopRight| ImDrawCornerFlags_BotRight);
|
|
|
|
|
+ window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_without_alpha), rounding, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotLeft);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -9500,9 +9520,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
|
|
|
if (col_source.w < 1.0f)
|
|
if (col_source.w < 1.0f)
|
|
|
RenderColorRectWithAlphaCheckerboard(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding);
|
|
RenderColorRectWithAlphaCheckerboard(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding);
|
|
|
else
|
|
else
|
|
|
- window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding, ~0);
|
|
|
|
|
|
|
+ window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding, ImDrawCornerFlags_All);
|
|
|
}
|
|
}
|
|
|
- if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
|
|
+ if (g.Style.FrameBorderSize > 0.0f)
|
|
|
RenderFrameBorder(bb.Min, bb.Max, rounding);
|
|
RenderFrameBorder(bb.Min, bb.Max, rounding);
|
|
|
else
|
|
else
|
|
|
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border
|
|
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border
|
|
@@ -10026,14 +10046,15 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
{
|
|
{
|
|
|
const float a0 = (n) /6.0f * 2.0f * IM_PI - aeps;
|
|
const float a0 = (n) /6.0f * 2.0f * IM_PI - aeps;
|
|
|
const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps;
|
|
const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps;
|
|
|
- int vert_start_idx = draw_list->_VtxCurrentIdx;
|
|
|
|
|
|
|
+ const int vert_start_idx = draw_list->VtxBuffer.Size;
|
|
|
draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);
|
|
draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);
|
|
|
draw_list->PathStroke(IM_COL32_WHITE, false, wheel_thickness);
|
|
draw_list->PathStroke(IM_COL32_WHITE, false, wheel_thickness);
|
|
|
|
|
+ const int vert_end_idx = draw_list->VtxBuffer.Size;
|
|
|
|
|
|
|
|
// Paint colors over existing vertices
|
|
// Paint colors over existing vertices
|
|
|
ImVec2 gradient_p0(wheel_center.x + cosf(a0) * wheel_r_inner, wheel_center.y + sinf(a0) * wheel_r_inner);
|
|
ImVec2 gradient_p0(wheel_center.x + cosf(a0) * wheel_r_inner, wheel_center.y + sinf(a0) * wheel_r_inner);
|
|
|
ImVec2 gradient_p1(wheel_center.x + cosf(a1) * wheel_r_inner, wheel_center.y + sinf(a1) * wheel_r_inner);
|
|
ImVec2 gradient_p1(wheel_center.x + cosf(a1) * wheel_r_inner, wheel_center.y + sinf(a1) * wheel_r_inner);
|
|
|
- ShadeVertsLinearColorGradientKeepAlpha(draw_list->_VtxWritePtr - (draw_list->_VtxCurrentIdx - vert_start_idx), draw_list->_VtxWritePtr, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]);
|
|
|
|
|
|
|
+ ShadeVertsLinearColorGradientKeepAlpha(draw_list->VtxBuffer.Data + vert_start_idx, draw_list->VtxBuffer.Data + vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Render Cursor + preview on Hue Wheel
|
|
// Render Cursor + preview on Hue Wheel
|
|
@@ -10873,7 +10894,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
if (ImGui::IsItemHovered())
|
|
if (ImGui::IsItemHovered())
|
|
|
GImGui->OverlayDrawList.AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255,255,0,255));
|
|
GImGui->OverlayDrawList.AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255,255,0,255));
|
|
|
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
|
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
|
|
- ImGui::BulletText("Active: %d, Accessed: %d", window->Active, window->Accessed);
|
|
|
|
|
|
|
+ ImGui::BulletText("Active: %d, WriteAccessed: %d", window->Active, window->WriteAccessed);
|
|
|
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
|
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
|
|
if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows");
|
|
if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows");
|
|
|
ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));
|
|
ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));
|