MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / RenderWindowDecorations

Method RenderWindowDecorations

extern/imgui/imgui.cpp:6450–6588  ·  view source on GitHub ↗

Draw background and borders Draw and handle scrollbars

Source from the content-addressed store, hash-verified

6448// Draw background and borders
6449// Draw and handle scrollbars
6450void 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)
6451{
6452 ImGuiContext& g = *GImGui;
6453 ImGuiStyle& style = g.Style;
6454 ImGuiWindowFlags flags = window->Flags;
6455
6456 // Ensure that ScrollBar doesn't read last frame's SkipItems
6457 IM_ASSERT(window->BeginCount == 0);
6458 window->SkipItems = false;
6459
6460 // Draw window + handle manual resize
6461 // As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame.
6462 const float window_rounding = window->WindowRounding;
6463 const float window_border_size = window->WindowBorderSize;
6464 if (window->Collapsed)
6465 {
6466 // Title bar only
6467 const float backup_border_size = style.FrameBorderSize;
6468 g.Style.FrameBorderSize = window->WindowBorderSize;
6469 ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
6470 if (window->ViewportOwned)
6471 title_bar_col |= IM_COL32_A_MASK; // No alpha (we don't support is_docking_transparent_payload here because simpler and less meaningful, but could with a bit of code shuffle/reuse)
6472 RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
6473 g.Style.FrameBorderSize = backup_border_size;
6474 }
6475 else
6476 {
6477 // Window background
6478 if (!(flags & ImGuiWindowFlags_NoBackground))
6479 {
6480 bool is_docking_transparent_payload = false;
6481 if (g.DragDropActive && (g.FrameCount - g.DragDropAcceptFrameCount) <= 1 && g.IO.ConfigDockingTransparentPayload)
6482 if (g.DragDropPayload.IsDataType(IMGUI_PAYLOAD_TYPE_WINDOW) && *(ImGuiWindow**)g.DragDropPayload.Data == window)
6483 is_docking_transparent_payload = true;
6484
6485 ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window));
6486 if (window->ViewportOwned)
6487 {
6488 bg_col |= IM_COL32_A_MASK; // No alpha
6489 if (is_docking_transparent_payload)
6490 window->Viewport->Alpha *= DOCKING_TRANSPARENT_PAYLOAD_ALPHA;
6491 }
6492 else
6493 {
6494 // Adjust alpha. For docking
6495 bool override_alpha = false;
6496 float alpha = 1.0f;
6497 if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha)
6498 {
6499 alpha = g.NextWindowData.BgAlphaVal;
6500 override_alpha = true;
6501 }
6502 if (is_docking_transparent_payload)
6503 {
6504 alpha *= DOCKING_TRANSPARENT_PAYLOAD_ALPHA; // FIXME-DOCK: Should that be an override?
6505 override_alpha = true;
6506 }
6507 if (override_alpha)

Callers

nothing calls this directly

Calls 13

GetWindowBgColorIdxFunction · 0.85
ImVec2Function · 0.85
ImFloorFunction · 0.85
ImLerpFunction · 0.85
IsDataTypeMethod · 0.80
ChannelsSetCurrentMethod · 0.80
AddRectFilledMethod · 0.80
AddLineMethod · 0.80
GetIDMethod · 0.80
AddTriangleFilledMethod · 0.80
PathLineToMethod · 0.80
PathArcToFastMethod · 0.80

Tested by

no test coverage detected