Draw background and borders Draw and handle scrollbars
| 5530 | // Draw background and borders |
| 5531 | // Draw and handle scrollbars |
| 5532 | 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) |
| 5533 | { |
| 5534 | ImGuiContext& g = *GImGui; |
| 5535 | ImGuiStyle& style = g.Style; |
| 5536 | ImGuiWindowFlags flags = window->Flags; |
| 5537 | |
| 5538 | // Ensure that ScrollBar doesn't read last frame's SkipItems |
| 5539 | IM_ASSERT(window->BeginCount == 0); |
| 5540 | window->SkipItems = false; |
| 5541 | |
| 5542 | // Draw window + handle manual resize |
| 5543 | // 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. |
| 5544 | const float window_rounding = window->WindowRounding; |
| 5545 | const float window_border_size = window->WindowBorderSize; |
| 5546 | if (window->Collapsed) |
| 5547 | { |
| 5548 | // Title bar only |
| 5549 | float backup_border_size = style.FrameBorderSize; |
| 5550 | g.Style.FrameBorderSize = window->WindowBorderSize; |
| 5551 | ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed); |
| 5552 | RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding); |
| 5553 | g.Style.FrameBorderSize = backup_border_size; |
| 5554 | } |
| 5555 | else |
| 5556 | { |
| 5557 | // Window background |
| 5558 | if (!(flags & ImGuiWindowFlags_NoBackground)) |
| 5559 | { |
| 5560 | ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags)); |
| 5561 | bool override_alpha = false; |
| 5562 | float alpha = 1.0f; |
| 5563 | if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha) |
| 5564 | { |
| 5565 | alpha = g.NextWindowData.BgAlphaVal; |
| 5566 | override_alpha = true; |
| 5567 | } |
| 5568 | if (override_alpha) |
| 5569 | bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT); |
| 5570 | window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 0 : ImDrawFlags_RoundCornersBottom); |
| 5571 | } |
| 5572 | |
| 5573 | // Title bar |
| 5574 | if (!(flags & ImGuiWindowFlags_NoTitleBar)) |
| 5575 | { |
| 5576 | ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg); |
| 5577 | window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop); |
| 5578 | } |
| 5579 | |
| 5580 | // Menu bar |
| 5581 | if (flags & ImGuiWindowFlags_MenuBar) |
| 5582 | { |
| 5583 | ImRect menu_bar_rect = window->MenuBarRect(); |
| 5584 | 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. |
| 5585 | 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); |
| 5586 | if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y) |
| 5587 | window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); |
| 5588 | } |
| 5589 |
nothing calls this directly
no test coverage detected