MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / RenderWindowDecorations

Method RenderWindowDecorations

lib/imgui/imgui.cpp:5141–5221  ·  view source on GitHub ↗

Draw background and borders Draw and handle scrollbars

Source from the content-addressed store, hash-verified

5139// Draw background and borders
5140// Draw and handle scrollbars
5141void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
5142{
5143 ImGuiContext& g = *GImGui;
5144 ImGuiStyle& style = g.Style;
5145 ImGuiWindowFlags flags = window->Flags;
5146
5147 // Ensure that ScrollBar doesn't read last frame's SkipItems
5148 window->SkipItems = false;
5149
5150 // Draw window + handle manual resize
5151 // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.
5152 const float window_rounding = window->WindowRounding;
5153 const float window_border_size = window->WindowBorderSize;
5154 if (window->Collapsed)
5155 {
5156 // Title bar only
5157 float backup_border_size = style.FrameBorderSize;
5158 g.Style.FrameBorderSize = window->WindowBorderSize;
5159 ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
5160 RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
5161 g.Style.FrameBorderSize = backup_border_size;
5162 }
5163 else
5164 {
5165 // Window background
5166 if (!(flags & ImGuiWindowFlags_NoBackground))
5167 {
5168 ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
5169 bool override_alpha = false;
5170 float alpha = 1.0f;
5171 if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha)
5172 {
5173 alpha = g.NextWindowData.BgAlphaVal;
5174 override_alpha = true;
5175 }
5176 if (override_alpha)
5177 bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
5178 window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
5179 }
5180
5181 // Title bar
5182 if (!(flags & ImGuiWindowFlags_NoTitleBar))
5183 {
5184 ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
5185 window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawCornerFlags_Top);
5186 }
5187
5188 // Menu bar
5189 if (flags & ImGuiWindowFlags_MenuBar)
5190 {
5191 ImRect menu_bar_rect = window->MenuBarRect();
5192 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.
5193 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, ImDrawCornerFlags_Top);
5194 if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
5195 window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
5196 }
5197
5198 // Scrollbars

Callers

nothing calls this directly

Calls 8

ImVec2Class · 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