Draw background and borders Draw and handle scrollbars
| 6078 | // Draw background and borders |
| 6079 | // Draw and handle scrollbars |
| 6080 | void 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) |
| 6081 | { |
| 6082 | ImGuiContext& g = *GImGui; |
| 6083 | ImGuiStyle& style = g.Style; |
| 6084 | ImGuiWindowFlags flags = window->Flags; |
| 6085 | |
| 6086 | // Ensure that ScrollBar doesn't read last frame's SkipItems |
| 6087 | IM_ASSERT(window->BeginCount == 0); |
| 6088 | window->SkipItems = false; |
| 6089 | |
| 6090 | // Draw window + handle manual resize |
| 6091 | // As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame. |
| 6092 | const float window_rounding = window->WindowRounding; |
| 6093 | const float window_border_size = window->WindowBorderSize; |
| 6094 | if (window->Collapsed) |
| 6095 | { |
| 6096 | // Title bar only |
| 6097 | float backup_border_size = style.FrameBorderSize; |
| 6098 | g.Style.FrameBorderSize = window->WindowBorderSize; |
| 6099 | ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed); |
| 6100 | RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding); |
| 6101 | g.Style.FrameBorderSize = backup_border_size; |
| 6102 | } |
| 6103 | else |
| 6104 | { |
| 6105 | // Window background |
| 6106 | if (!(flags & ImGuiWindowFlags_NoBackground)) |
| 6107 | { |
| 6108 | ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window)); |
| 6109 | bool override_alpha = false; |
| 6110 | float alpha = 1.0f; |
| 6111 | if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha) |
| 6112 | { |
| 6113 | alpha = g.NextWindowData.BgAlphaVal; |
| 6114 | override_alpha = true; |
| 6115 | } |
| 6116 | if (override_alpha) |
| 6117 | bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT); |
| 6118 | window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 0 : ImDrawFlags_RoundCornersBottom); |
| 6119 | } |
| 6120 | |
| 6121 | // Title bar |
| 6122 | if (!(flags & ImGuiWindowFlags_NoTitleBar)) |
| 6123 | { |
| 6124 | ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg); |
| 6125 | window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop); |
| 6126 | } |
| 6127 | |
| 6128 | // Menu bar |
| 6129 | if (flags & ImGuiWindowFlags_MenuBar) |
| 6130 | { |
| 6131 | ImRect menu_bar_rect = window->MenuBarRect(); |
| 6132 | 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. |
| 6133 | 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); |
| 6134 | if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y) |
| 6135 | window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); |
| 6136 | } |
| 6137 |
nothing calls this directly
no test coverage detected