|
|
@@ -477,6 +477,7 @@
|
|
|
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
|
|
- slider & drag: int data passing through a float
|
|
|
- drag float: up/down axis
|
|
|
+ - drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
|
|
- text edit: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
|
|
- text edit: centered text for slider as input text so it matches typical positioning.
|
|
|
- text edit: flag to disable live update of the user buffer.
|
|
|
@@ -492,6 +493,7 @@
|
|
|
- style: color-box not always square?
|
|
|
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
|
|
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
|
|
+ - style: global scale setting.
|
|
|
- text: simple markup language for color change?
|
|
|
- font: helper to add glyph redirect/replacements (e.g. redirect alternate apostrophe unicode code points to ascii one, etc.)
|
|
|
- log: LogButtons() options for specifying depth and/or hiding depth slider
|
|
|
@@ -2594,7 +2596,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
|
|
|
if (text_len > 0)
|
|
|
{
|
|
|
// Render
|
|
|
- window->DrawList->AddText(g.Font, g.FontSize, pos, window->Color(ImGuiCol_Text), text, text_display_end);
|
|
|
+ window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);
|
|
|
|
|
|
// Log as text
|
|
|
if (g.LogEnabled)
|
|
|
@@ -2613,7 +2615,7 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
|
|
|
const int text_len = (int)(text_end - text);
|
|
|
if (text_len > 0)
|
|
|
{
|
|
|
- window->DrawList->AddText(g.Font, g.FontSize, pos, window->Color(ImGuiCol_Text), text, text_end, wrap_width);
|
|
|
+ window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);
|
|
|
if (g.LogEnabled)
|
|
|
LogRenderedText(pos, text, text_end);
|
|
|
}
|
|
|
@@ -2648,11 +2650,11 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons
|
|
|
if (need_clipping)
|
|
|
{
|
|
|
ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y);
|
|
|
- window->DrawList->AddText(g.Font, g.FontSize, pos, window->Color(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);
|
|
|
+ window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- window->DrawList->AddText(g.Font, g.FontSize, pos, window->Color(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);
|
|
|
+ window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);
|
|
|
}
|
|
|
if (g.LogEnabled)
|
|
|
LogRenderedText(pos, text, text_display_end);
|
|
|
@@ -2666,8 +2668,8 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
|
|
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
|
|
if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
{
|
|
|
- window->DrawList->AddRect(p_min+ImVec2(1,1), p_max, window->Color(ImGuiCol_BorderShadow), rounding);
|
|
|
- window->DrawList->AddRect(p_min, p_max-ImVec2(1,1), window->Color(ImGuiCol_Border), rounding);
|
|
|
+ window->DrawList->AddRect(p_min+ImVec2(1,1), p_max, GetColorU32(ImGuiCol_BorderShadow), rounding);
|
|
|
+ window->DrawList->AddRect(p_min, p_max-ImVec2(1,1), GetColorU32(ImGuiCol_Border), rounding);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2697,8 +2699,8 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool opened, float scale, bool
|
|
|
}
|
|
|
|
|
|
if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0)
|
|
|
- window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), window->Color(ImGuiCol_BorderShadow));
|
|
|
- window->DrawList->AddTriangleFilled(a, b, c, window->Color(ImGuiCol_Text));
|
|
|
+ window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), GetColorU32(ImGuiCol_BorderShadow));
|
|
|
+ window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text));
|
|
|
}
|
|
|
|
|
|
void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col)
|
|
|
@@ -2743,6 +2745,7 @@ ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_tex
|
|
|
const float character_spacing_x = 1.0f * font_scale;
|
|
|
if (text_size.x > 0.0f)
|
|
|
text_size.x -= character_spacing_x;
|
|
|
+ text_size.x = (float)(int)(text_size.x + 0.95f);
|
|
|
|
|
|
return text_size;
|
|
|
}
|
|
|
@@ -3680,8 +3683,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// SIZE
|
|
|
|
|
|
// Save contents size from last frame for auto-fitting (unless explicitly specified)
|
|
|
- window->SizeContents.x = (window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x);
|
|
|
- window->SizeContents.y = (window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y);
|
|
|
+ window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
|
|
+ window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
|
|
|
|
|
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
|
|
|
if (window->HiddenFrames > 0)
|
|
|
@@ -3866,7 +3869,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
|
|
{
|
|
|
ImRect fullscreen_rect = GetVisibleRect();
|
|
|
- window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, window->Color(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
|
+ window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
|
}
|
|
|
|
|
|
// Draw window + handle manual resize
|
|
|
@@ -3875,12 +3878,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
if (window->Collapsed)
|
|
|
{
|
|
|
// Draw title bar only
|
|
|
- window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), window->Color(ImGuiCol_TitleBgCollapsed), window_rounding);
|
|
|
- if (flags & ImGuiWindowFlags_ShowBorders)
|
|
|
- {
|
|
|
- window->DrawList->AddRect(title_bar_rect.GetTL()+ImVec2(1,1), title_bar_rect.GetBR()+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), window_rounding);
|
|
|
- window->DrawList->AddRect(title_bar_rect.GetTL(), title_bar_rect.GetBR(), window->Color(ImGuiCol_Border), window_rounding);
|
|
|
- }
|
|
|
+ RenderFrame(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -3894,7 +3892,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
const ImGuiID resize_id = window->GetID("#RESIZE");
|
|
|
bool hovered, held;
|
|
|
ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds);
|
|
|
- resize_col = window->Color(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);
|
|
|
+ resize_col = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);
|
|
|
|
|
|
if (hovered || held)
|
|
|
g.MouseCursor = ImGuiMouseCursor_ResizeNWSE;
|
|
|
@@ -3937,27 +3935,18 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
col_idx = ImGuiCol_ChildWindowBg;
|
|
|
else
|
|
|
col_idx = ImGuiCol_WindowBg;
|
|
|
- window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(col_idx, bg_alpha), window_rounding);
|
|
|
+ window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, GetColorU32(col_idx, bg_alpha), window_rounding);
|
|
|
}
|
|
|
|
|
|
// Title bar
|
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
- window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), window->Color((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, 1|2);
|
|
|
+ window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, 1|2);
|
|
|
|
|
|
// Menu bar
|
|
|
if (flags & ImGuiWindowFlags_MenuBar)
|
|
|
{
|
|
|
ImRect menu_bar_rect = window->MenuBarRect();
|
|
|
- window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), window->Color(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, 1|2);
|
|
|
- }
|
|
|
-
|
|
|
- // Borders
|
|
|
- if (flags & ImGuiWindowFlags_ShowBorders)
|
|
|
- {
|
|
|
- window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), window_rounding);
|
|
|
- window->DrawList->AddRect(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_Border), window_rounding);
|
|
|
- if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
- window->DrawList->AddLine(title_bar_rect.GetBL(), title_bar_rect.GetBR(), window->Color(ImGuiCol_Border));
|
|
|
+ window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, 1|2);
|
|
|
}
|
|
|
|
|
|
// Scrollbars
|
|
|
@@ -3970,12 +3959,22 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// (after the input handling so we don't have a frame of latency)
|
|
|
if (!(flags & ImGuiWindowFlags_NoResize))
|
|
|
{
|
|
|
+ const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
const ImVec2 br = window->Rect().GetBR();
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, 0.0f));
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(0.0f, -resize_corner_size));
|
|
|
- window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding, br.y - window_rounding), window_rounding, 0, 3);
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -border_size));
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-border_size, -resize_corner_size));
|
|
|
+ window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - border_size, br.y - window_rounding - border_size), window_rounding, 0, 3);
|
|
|
window->DrawList->PathFill(resize_col);
|
|
|
}
|
|
|
+
|
|
|
+ // Borders
|
|
|
+ if (flags & ImGuiWindowFlags_ShowBorders)
|
|
|
+ {
|
|
|
+ window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size, GetColorU32(ImGuiCol_BorderShadow), window_rounding);
|
|
|
+ window->DrawList->AddRect(window->Pos, window->Pos+window->Size-ImVec2(1,1), 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));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Setup drawing context
|
|
|
@@ -4054,11 +4053,13 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
|
|
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
|
|
const ImRect title_bar_rect = window->TitleBarRect();
|
|
|
- ImRect clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding.x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Pos.x+window->Size.x-window->WindowPadding.x*0.5f, window->Pos.y+window->Size.y);
|
|
|
- if ((flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_ShowBorders))
|
|
|
- clip_rect.Min += ImVec2(1.0f,1.0f);
|
|
|
- clip_rect.Max.x -= window->ScrollbarY ? style.ScrollbarSize : 0.0f;
|
|
|
- clip_rect.Max.y -= window->ScrollbarX ? style.ScrollbarSize : 0.0f;
|
|
|
+ const float border_size = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
+ ImRect clip_rect;
|
|
|
+ clip_rect.Min.x = title_bar_rect.Min.x + 0.5f + ImMax(border_size, window->WindowPadding.x*0.5f);
|
|
|
+ clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size;
|
|
|
+ clip_rect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, window->WindowPadding.x*0.5f);
|
|
|
+ clip_rect.Max.y = window->Pos.y + window->Size.y - border_size - window->ScrollbarSizes.y;
|
|
|
+
|
|
|
PushClipRect(clip_rect);
|
|
|
|
|
|
// Clear 'accessed' flag last thing
|
|
|
@@ -4125,12 +4126,12 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|
|
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
|
|
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
|
|
|
const ImRect window_rect = window->Rect();
|
|
|
- const float border_offset = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
+ const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
ImRect bb = horizontal
|
|
|
- ? ImRect(window->Pos.x + border_offset, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w, window_rect.Max.y)
|
|
|
- : ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_offset, window_rect.Max.x, window_rect.Max.y - other_scrollbar_size_w);
|
|
|
+ ? 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);
|
|
|
if (!horizontal)
|
|
|
- bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() - border_offset : 0.0f);
|
|
|
+ bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() - border_size : 0.0f);
|
|
|
|
|
|
float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
|
|
|
int window_rounding_corners;
|
|
|
@@ -4138,7 +4139,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|
|
window_rounding_corners = 8 | (other_scrollbar ? 0 : 4);
|
|
|
else
|
|
|
window_rounding_corners = ((window->Flags & ImGuiWindowFlags_NoTitleBar) ? 2 : 0) | (other_scrollbar ? 0 : 4);
|
|
|
- window->DrawList->AddRectFilled(bb.Min, bb.Max, window->Color(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
|
|
|
+ window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
|
|
|
bb.Reduce(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 axis of the scrollbar
|
|
|
@@ -4205,7 +4206,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|
|
}
|
|
|
|
|
|
// Render
|
|
|
- const ImU32 grab_col = window->Color(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
|
|
|
+ const ImU32 grab_col = ImGui::GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
|
|
|
if (horizontal)
|
|
|
window->DrawList->AddRectFilled(ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y), ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y), grab_col, style.ScrollbarRounding);
|
|
|
else
|
|
|
@@ -5268,7 +5269,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
|
|
|
|
|
// Render
|
|
|
- const ImU32 col = window->Color((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
|
+ const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
|
|
RenderTextClipped(bb.Min, bb.Max, label, NULL, &label_size, ImGuiAlign_Center | ImGuiAlign_VCenter);
|
|
|
|
|
|
@@ -5329,15 +5330,15 @@ static bool CloseWindowButton(bool* p_opened)
|
|
|
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held);
|
|
|
|
|
|
// Render
|
|
|
- const ImU32 col = window->Color((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
|
|
|
+ const ImU32 col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
|
|
|
const ImVec2 center = bb.GetCenter();
|
|
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f,size*0.5f), col, 16);
|
|
|
|
|
|
const float cross_extent = (size * 0.5f * 0.7071f) - 1.0f;
|
|
|
if (hovered)
|
|
|
{
|
|
|
- window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), window->Color(ImGuiCol_Text));
|
|
|
- window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), window->Color(ImGuiCol_Text));
|
|
|
+ window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), ImGui::GetColorU32(ImGuiCol_Text));
|
|
|
+ window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), ImGui::GetColorU32(ImGuiCol_Text));
|
|
|
}
|
|
|
|
|
|
if (p_opened != NULL && pressed)
|
|
|
@@ -5361,12 +5362,12 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
|
|
|
|
|
|
if (border_col.w > 0.0f)
|
|
|
{
|
|
|
- window->DrawList->AddRect(bb.Min, bb.Max, window->Color(border_col), 0.0f);
|
|
|
- window->DrawList->AddImage(user_texture_id, bb.Min+ImVec2(1,1), bb.Max-ImVec2(1,1), uv0, uv1, window->Color(tint_col));
|
|
|
+ window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);
|
|
|
+ window->DrawList->AddImage(user_texture_id, bb.Min+ImVec2(1,1), bb.Max-ImVec2(1,1), uv0, uv1, GetColorU32(tint_col));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, window->Color(tint_col));
|
|
|
+ window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -5400,11 +5401,11 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
|
|
|
|
|
// Render
|
|
|
- const ImU32 col = window->Color((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
|
+ const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
|
|
RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding));
|
|
|
if (bg_col.w > 0.0f)
|
|
|
- window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, window->Color(bg_col));
|
|
|
- window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, window->Color(tint_col));
|
|
|
+ window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, GetColorU32(bg_col));
|
|
|
+ window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, GetColorU32(tint_col));
|
|
|
|
|
|
return pressed;
|
|
|
}
|
|
|
@@ -5583,7 +5584,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
|
// We vertically grow up to current line height up the typical widget height.
|
|
|
- const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset - padding.y);
|
|
|
+ const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset - padding.y); // Latch before ItemSize changes it
|
|
|
const float frame_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), label_size.y + padding.y*2);
|
|
|
ImRect bb = ImRect(window->DC.CursorPos, ImVec2(window->Pos.x + GetContentRegionMax().x, window->DC.CursorPos.y + frame_height));
|
|
|
if (display_frame)
|
|
|
@@ -5593,8 +5594,8 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
|
|
|
bb.Max.x += (float)(int)(window->WindowPadding.x*0.5f) - 1;
|
|
|
}
|
|
|
|
|
|
- const float collapser_width = g.FontSize + padding.x*2;
|
|
|
- const float text_width = collapser_width + (label_size.x > 0.0f ? label_size.x + padding.x*2 : 0.0f); // Include collapser
|
|
|
+ const float collapser_width = g.FontSize + (display_frame ? padding.x*2 : padding.x);
|
|
|
+ const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x*2 : 0.0f); // Include collapser
|
|
|
ItemSize(ImVec2(text_width, frame_height), text_base_offset_y);
|
|
|
|
|
|
// For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing
|
|
|
@@ -5613,7 +5614,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
|
|
|
}
|
|
|
|
|
|
// Render
|
|
|
- const ImU32 col = window->Color((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
|
|
+ const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
|
|
const ImVec2 text_pos = bb.Min + padding + ImVec2(collapser_width, text_base_offset_y);
|
|
|
if (display_frame)
|
|
|
{
|
|
|
@@ -5657,21 +5658,21 @@ void ImGui::Bullet()
|
|
|
|
|
|
ImGuiState& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
- const float line_height = g.FontSize;
|
|
|
- const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(line_height, line_height));
|
|
|
+ const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize);
|
|
|
+ const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height));
|
|
|
ItemSize(bb);
|
|
|
if (!ItemAdd(bb, NULL))
|
|
|
{
|
|
|
- ImGui::SameLine(0, -1);
|
|
|
+ ImGui::SameLine(0, style.FramePadding.x*2);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// Render
|
|
|
- const float bullet_size = line_height*0.15f;
|
|
|
- window->DrawList->AddCircleFilled(bb.Min + ImVec2(style.FramePadding.x + line_height*0.5f, line_height*0.5f), bullet_size, window->Color(ImGuiCol_Text));
|
|
|
+ const float bullet_size = g.FontSize*0.15f;
|
|
|
+ window->DrawList->AddCircleFilled(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f), bullet_size, GetColorU32(ImGuiCol_Text));
|
|
|
|
|
|
// Stay on same line
|
|
|
- ImGui::SameLine(0, -1);
|
|
|
+ ImGui::SameLine(0, style.FramePadding.x*2);
|
|
|
}
|
|
|
|
|
|
// Text with a little bullet aligned to the typical tree node.
|
|
|
@@ -5686,17 +5687,18 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
|
|
|
|
|
const char* text_begin = g.TempBuffer;
|
|
|
const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
|
|
|
- const float line_height = g.FontSize;
|
|
|
const ImVec2 label_size = CalcTextSize(text_begin, text_end, true);
|
|
|
- const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(line_height + (label_size.x > 0.0f ? (style.FramePadding.x*2) : 0.0f),0) + label_size); // Empty text doesn't add padding
|
|
|
+ const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it
|
|
|
+ const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize);
|
|
|
+ const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x*2) : 0.0f), ImMax(line_height, label_size.y))); // Empty text doesn't add padding
|
|
|
ItemSize(bb);
|
|
|
if (!ItemAdd(bb, NULL))
|
|
|
return;
|
|
|
|
|
|
// Render
|
|
|
- const float bullet_size = line_height*0.15f;
|
|
|
- window->DrawList->AddCircleFilled(bb.Min + ImVec2(style.FramePadding.x + line_height*0.5f, line_height*0.5f), bullet_size, window->Color(ImGuiCol_Text));
|
|
|
- RenderText(bb.Min+ImVec2(g.FontSize + style.FramePadding.x*2,0), text_begin, text_end);
|
|
|
+ const float bullet_size = g.FontSize*0.15f;
|
|
|
+ window->DrawList->AddCircleFilled(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f), bullet_size, GetColorU32(ImGuiCol_Text));
|
|
|
+ RenderText(bb.Min+ImVec2(g.FontSize + style.FramePadding.x*2, text_base_offset_y), text_begin, text_end);
|
|
|
}
|
|
|
|
|
|
void ImGui::BulletText(const char* fmt, ...)
|
|
|
@@ -6005,7 +6007,7 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
|
|
|
// Draw frame
|
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
|
|
|
const bool is_non_linear = fabsf(power - 1.0f) > 0.0001f;
|
|
|
const bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0;
|
|
|
@@ -6121,7 +6123,7 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
|
|
|
grab_bb = ImRect(ImVec2(grab_pos - grab_sz*0.5f, frame_bb.Min.y + grab_padding), ImVec2(grab_pos + grab_sz*0.5f, frame_bb.Max.y - grab_padding));
|
|
|
else
|
|
|
grab_bb = ImRect(ImVec2(frame_bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f), ImVec2(frame_bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f));
|
|
|
- window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, window->Color(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
|
|
|
+ window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
|
|
|
|
|
|
return value_changed;
|
|
|
}
|
|
|
@@ -6357,11 +6359,10 @@ bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const
|
|
|
bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
|
|
|
{
|
|
|
ImGuiState& g = *GImGui;
|
|
|
- ImGuiWindow* window = GetCurrentWindow();
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
|
|
|
// Draw frame
|
|
|
- const ImU32 frame_col = window->Color(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
|
|
+ const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
|
|
RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding);
|
|
|
|
|
|
bool value_changed = false;
|
|
|
@@ -6677,7 +6678,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
|
|
scale_max = v_max;
|
|
|
}
|
|
|
|
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
|
|
|
int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
|
|
|
int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
|
|
|
@@ -6705,8 +6706,8 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
|
|
float t0 = 0.0f;
|
|
|
ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) ); // Point in the normalized space of our target rectangle
|
|
|
|
|
|
- const ImU32 col_base = window->Color((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);
|
|
|
- const ImU32 col_hovered = window->Color((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);
|
|
|
+ const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);
|
|
|
+ const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);
|
|
|
|
|
|
for (int n = 0; n < res_w; n++)
|
|
|
{
|
|
|
@@ -6778,6 +6779,41 @@ void ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data,
|
|
|
PlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
|
|
|
}
|
|
|
|
|
|
+// size_arg (for each axis) < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size
|
|
|
+void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay)
|
|
|
+{
|
|
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
|
+ if (window->SkipItems)
|
|
|
+ return;
|
|
|
+
|
|
|
+ ImGuiState& g = *GImGui;
|
|
|
+ const ImGuiStyle& style = g.Style;
|
|
|
+
|
|
|
+ ImVec2 pos = window->DC.CursorPos;
|
|
|
+ const ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x*2.0f, g.FontSize + style.FramePadding.y*2.0f));
|
|
|
+ ItemSize(bb, style.FramePadding.y);
|
|
|
+ if (!ItemAdd(bb, NULL))
|
|
|
+ return;
|
|
|
+
|
|
|
+ // Render
|
|
|
+ fraction = ImSaturate(fraction);
|
|
|
+ const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
|
|
|
+ RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, style.FrameRounding);
|
|
|
+
|
|
|
+ // Default displaying the fraction as percentage string, but user can override it
|
|
|
+ char overlay_buf[32];
|
|
|
+ if (!overlay)
|
|
|
+ {
|
|
|
+ ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), "%.0f%%", fraction*100+0.01f);
|
|
|
+ overlay = overlay_buf;
|
|
|
+ }
|
|
|
+
|
|
|
+ ImVec2 overlay_size = CalcTextSize(overlay, NULL);
|
|
|
+ if (overlay_size.x > 0.0f)
|
|
|
+ RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImGuiAlign_Left|ImGuiAlign_VCenter, &bb.Min, &bb.Max);
|
|
|
+}
|
|
|
+
|
|
|
bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
@@ -6810,12 +6846,12 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
if (pressed)
|
|
|
*v = !(*v);
|
|
|
|
|
|
- RenderFrame(check_bb.Min, check_bb.Max, window->Color((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
if (*v)
|
|
|
{
|
|
|
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
|
|
const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f));
|
|
|
- window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), window->Color(ImGuiCol_CheckMark), style.FrameRounding);
|
|
|
+ window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding);
|
|
|
}
|
|
|
|
|
|
if (g.LogEnabled)
|
|
|
@@ -6871,18 +6907,18 @@ bool ImGui::RadioButton(const char* label, bool active)
|
|
|
bool hovered, held;
|
|
|
bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
|
|
|
|
|
|
- window->DrawList->AddCircleFilled(center, radius, window->Color((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);
|
|
|
+ window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);
|
|
|
if (active)
|
|
|
{
|
|
|
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
|
|
const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f));
|
|
|
- window->DrawList->AddCircleFilled(center, radius-pad, window->Color(ImGuiCol_CheckMark), 16);
|
|
|
+ window->DrawList->AddCircleFilled(center, radius-pad, GetColorU32(ImGuiCol_CheckMark), 16);
|
|
|
}
|
|
|
|
|
|
if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
|
|
{
|
|
|
- window->DrawList->AddCircle(center+ImVec2(1,1), radius, window->Color(ImGuiCol_BorderShadow), 16);
|
|
|
- window->DrawList->AddCircle(center, radius, window->Color(ImGuiCol_Border), 16);
|
|
|
+ window->DrawList->AddCircle(center+ImVec2(1,1), radius, GetColorU32(ImGuiCol_BorderShadow), 16);
|
|
|
+ window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16);
|
|
|
}
|
|
|
|
|
|
if (g.LogEnabled)
|
|
|
@@ -7310,7 +7346,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
stb_textedit_click(&edit_state, &edit_state.StbState, mouse_x, mouse_y);
|
|
|
edit_state.CursorAnimReset();
|
|
|
}
|
|
|
- else if (io.MouseDown[0] && !edit_state.SelectedAllMouseLock)
|
|
|
+ else if (io.MouseDown[0] && !edit_state.SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f))
|
|
|
{
|
|
|
stb_textedit_drag(&edit_state, &edit_state.StbState, mouse_x, mouse_y);
|
|
|
edit_state.CursorAnimReset();
|
|
|
@@ -7522,7 +7558,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
}
|
|
|
|
|
|
if (!is_multiline)
|
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
|
|
|
// Render
|
|
|
const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x + style.FramePadding.x*2.0f, frame_bb.Min.y + size.y + style.FramePadding.y*2.0f);
|
|
|
@@ -7624,7 +7660,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
|
|
|
float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.
|
|
|
float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
|
|
|
- ImU32 bg_color = draw_window->Color(ImGuiCol_TextSelectedBg);
|
|
|
+ ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg);
|
|
|
ImVec2 rect_pos = render_pos + select_start_offset - render_scroll;
|
|
|
for (const ImWchar* p = text_selected_begin; p < text_selected_end; )
|
|
|
{
|
|
|
@@ -7650,13 +7686,13 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, draw_window->Color(ImGuiCol_Text), buf, buf+edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
|
+ draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf, buf+edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
|
|
|
|
// Draw blinking cursor
|
|
|
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
|
|
bool cursor_is_visible = (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
|
|
if (cursor_is_visible)
|
|
|
- draw_window->DrawList->AddLine(cursor_screen_pos + ImVec2(0.0f,-g.FontSize+0.5f), cursor_screen_pos + ImVec2(0.0f,-1.5f), window->Color(ImGuiCol_Text));
|
|
|
+ draw_window->DrawList->AddLine(cursor_screen_pos + ImVec2(0.0f,-g.FontSize+0.5f), cursor_screen_pos + ImVec2(0.0f,-1.5f), GetColorU32(ImGuiCol_Text));
|
|
|
|
|
|
// Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
|
|
|
if (is_editable)
|
|
|
@@ -7668,7 +7704,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
const char* buf_end = NULL;
|
|
|
if (is_multiline)
|
|
|
text_size = ImVec2(size.x, InputTextCalcTextLenAndLineCount(buf, &buf_end) * g.FontSize); // We don't need width
|
|
|
- draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos, draw_window->Color(ImGuiCol_Text), buf, buf_end, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
|
+ draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), buf, buf_end, 0.0f, is_multiline ? NULL : &clip_rect);
|
|
|
}
|
|
|
|
|
|
if (is_multiline)
|
|
|
@@ -7944,8 +7980,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|
|
const bool hovered = IsHovered(frame_bb, id);
|
|
|
|
|
|
const ImRect value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f));
|
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
- RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING
|
|
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
+ RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, GetColorU32(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING
|
|
|
RenderCollapseTriangle(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y) + style.FramePadding, true);
|
|
|
|
|
|
if (*current_item >= 0 && *current_item < items_count)
|
|
|
@@ -8080,7 +8116,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
// Render
|
|
|
if (hovered || selected)
|
|
|
{
|
|
|
- const ImU32 col = window->Color((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
|
|
+ const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
|
|
RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f);
|
|
|
}
|
|
|
|
|
|
@@ -8225,7 +8261,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|
|
}
|
|
|
|
|
|
if (selected)
|
|
|
- RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), window->Color(ImGuiCol_Text));
|
|
|
+ RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), GetColorU32(ImGuiCol_Text));
|
|
|
|
|
|
return pressed;
|
|
|
}
|
|
|
@@ -8278,7 +8314,8 @@ bool ImGui::BeginMenuBar()
|
|
|
ImGui::BeginGroup(); // Save position
|
|
|
ImGui::PushID("##menubar");
|
|
|
ImRect rect = window->MenuBarRect();
|
|
|
- PushClipRect(ImVec4(rect.Min.x+0.5f, rect.Min.y-0.5f, rect.Max.x+0.5f, rect.Max.y-1.5f), false);
|
|
|
+ float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
+ PushClipRect(ImVec4(rect.Min.x+0.5f, rect.Min.y-0.5f+border_size, rect.Max.x+0.5f, 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.LayoutType = ImGuiLayoutType_Horizontal;
|
|
|
window->DC.MenuBarAppending = true;
|
|
|
@@ -8430,7 +8467,7 @@ bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_borde
|
|
|
|
|
|
bool hovered, held;
|
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
|
|
- RenderFrame(bb.Min, bb.Max, window->Color(col), outline_border, style.FrameRounding);
|
|
|
+ RenderFrame(bb.Min, bb.Max, GetColorU32(col), outline_border, style.FrameRounding);
|
|
|
|
|
|
if (hovered)
|
|
|
ImGui::SetTooltip("Color:\n(%.2f,%.2f,%.2f,%.2f)\n#%02X%02X%02X%02X", col.x, col.y, col.z, col.w, IM_F32_TO_INT8(col.x), IM_F32_TO_INT8(col.y), IM_F32_TO_INT8(col.z), IM_F32_TO_INT8(col.z));
|
|
|
@@ -8619,7 +8656,7 @@ void ImGui::Separator()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- window->DrawList->AddLine(bb.Min, bb.Max, window->Color(ImGuiCol_Border));
|
|
|
+ window->DrawList->AddLine(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border));
|
|
|
|
|
|
ImGuiState& g = *GImGui;
|
|
|
if (g.LogEnabled)
|
|
|
@@ -8894,7 +8931,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
|
|
g.MouseCursor = ImGuiMouseCursor_ResizeEW;
|
|
|
|
|
|
// Draw before resize so our items positioning are in sync with the line being drawn
|
|
|
- const ImU32 col = window->Color(held ? ImGuiCol_ColumnActive : hovered ? ImGuiCol_ColumnHovered : ImGuiCol_Column);
|
|
|
+ const ImU32 col = GetColorU32(held ? ImGuiCol_ColumnActive : hovered ? ImGuiCol_ColumnHovered : ImGuiCol_Column);
|
|
|
const float xi = (float)(int)x;
|
|
|
window->DrawList->AddLine(ImVec2(xi, y1+1.0f), ImVec2(xi, y2), col);
|
|
|
|