MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / RenderWindowDecorations

Method RenderWindowDecorations

3rdparty/imgui/src/imgui.cpp:7187–7281  ·  view source on GitHub ↗

Draw background and borders Draw and handle scrollbars

Source from the content-addressed store, hash-verified

7185// Draw background and borders
7186// Draw and handle scrollbars
7187void 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)
7188{
7189 ImGuiContext& g = *GImGui;
7190 ImGuiStyle& style = g.Style;
7191 ImGuiWindowFlags flags = window->Flags;
7192
7193 // Ensure that Scrollbar() doesn't read last frame's SkipItems
7194 IM_ASSERT(window->BeginCount == 0);
7195 window->SkipItems = false;
7196 window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
7197
7198 // Draw window + handle manual resize
7199 // As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame.
7200 const float window_rounding = window->WindowRounding;
7201 const float window_border_size = window->WindowBorderSize;
7202 if (window->Collapsed)
7203 {
7204 // Title bar only
7205 const float backup_border_size = style.FrameBorderSize;
7206 g.Style.FrameBorderSize = window->WindowBorderSize;
7207 ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && g.NavCursorVisible) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
7208 RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
7209 g.Style.FrameBorderSize = backup_border_size;
7210 }
7211 else
7212 {
7213 // Window background
7214 if (!(flags & ImGuiWindowFlags_NoBackground))
7215 {
7216 ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window));
7217 bool override_alpha = false;
7218 float alpha = 1.0f;
7219 if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasBgAlpha)
7220 {
7221 alpha = g.NextWindowData.BgAlphaVal;
7222 override_alpha = true;
7223 }
7224 if (override_alpha)
7225 bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
7226 if (bg_col & IM_COL32_A_MASK)
7227 {
7228 ImRect bg_rect(window->Pos + ImVec2(0, window->TitleBarHeight), window->Pos + window->Size);
7229 ImDrawFlags bg_rounding_flags = (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersBottom;
7230 ImDrawList* bg_draw_list = window->DrawList;
7231 bg_draw_list->AddRectFilled(bg_rect.Min, bg_rect.Max, bg_col, window_rounding, bg_rounding_flags);
7232 }
7233 }
7234
7235 // Title bar
7236 if (!(flags & ImGuiWindowFlags_NoTitleBar))
7237 {
7238 ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
7239 window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop);
7240 }
7241
7242 // Menu bar
7243 if (flags & ImGuiWindowFlags_MenuBar)
7244 {

Callers

nothing calls this directly

Calls 8

GetWindowBgColorIdxFunction · 0.85
ImLerpFunction · 0.85
AddRectFilledMethod · 0.80
AddLineHMethod · 0.80
PathLineToMethod · 0.80
PathArcToFastMethod · 0.80
PathFillConvexMethod · 0.80
ImVec2Function · 0.50

Tested by

no test coverage detected