MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / RenderWindowDecorations

Method RenderWindowDecorations

KBotExt/imgui/imgui.cpp:5971–6056  ·  view source on GitHub ↗

Draw background and borders Draw and handle scrollbars

Source from the content-addressed store, hash-verified

5969// Draw background and borders
5970// Draw and handle scrollbars
5971void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
5972{
5973 ImGuiContext& g = *GImGui;
5974 ImGuiStyle& style = g.Style;
5975 ImGuiWindowFlags flags = window->Flags;
5976
5977 // Ensure that ScrollBar doesn't read last frame's SkipItems
5978 IM_ASSERT(window->BeginCount == 0);
5979 window->SkipItems = false;
5980
5981 // Draw window + handle manual resize
5982 // As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame.
5983 const float window_rounding = window->WindowRounding;
5984 const float window_border_size = window->WindowBorderSize;
5985 if (window->Collapsed)
5986 {
5987 // Title bar only
5988 const float backup_border_size = style.FrameBorderSize;
5989 g.Style.FrameBorderSize = window->WindowBorderSize;
5990 ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
5991 RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
5992 g.Style.FrameBorderSize = backup_border_size;
5993 }
5994 else
5995 {
5996 // Window background
5997 if (!(flags & ImGuiWindowFlags_NoBackground))
5998 {
5999 ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window));
6000 bool override_alpha = false;
6001 float alpha = 1.0f;
6002 if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha)
6003 {
6004 alpha = g.NextWindowData.BgAlphaVal;
6005 override_alpha = true;
6006 }
6007 if (override_alpha)
6008 bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
6009 window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 0 : ImDrawFlags_RoundCornersBottom);
6010 }
6011
6012 // Title bar
6013 if (!(flags & ImGuiWindowFlags_NoTitleBar))
6014 {
6015 ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
6016 window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop);
6017 }
6018
6019 // Menu bar
6020 if (flags & ImGuiWindowFlags_MenuBar)
6021 {
6022 ImRect menu_bar_rect = window->MenuBarRect();
6023 menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
6024 window->DrawList->AddRectFilled(menu_bar_rect.Min + ImVec2(window_border_size, 0), menu_bar_rect.Max - ImVec2(window_border_size, 0), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawFlags_RoundCornersTop);
6025 if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
6026 window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
6027 }
6028

Callers

nothing calls this directly

Calls 8

GetWindowBgColorIdxFunction · 0.85
ImVec2Function · 0.85
ImLerpFunction · 0.85
AddRectFilledMethod · 0.80
AddLineMethod · 0.80
PathLineToMethod · 0.80
PathArcToFastMethod · 0.80
PathFillConvexMethod · 0.80

Tested by

no test coverage detected