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

Method TabItemBackground

3rdparty/imgui/src/imgui_widgets.cpp:10866–10889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10864}
10865
10866void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
10867{
10868 // While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
10869 ImGuiContext& g = *GImGui;
10870 const float width = bb.GetWidth();
10871 IM_UNUSED(flags);
10872 IM_ASSERT(width > 0.0f);
10873 const float rounding = ImMax(0.0f, ImMin((flags & ImGuiTabItemFlags_Button) ? g.Style.FrameRounding : g.Style.TabRounding, width * 0.5f - 1.0f));
10874 const float y1 = bb.Min.y + 1.0f;
10875 const float y2 = bb.Max.y - g.Style.TabBarBorderSize;
10876 draw_list->PathLineTo(ImVec2(bb.Min.x, y2));
10877 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9);
10878 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12);
10879 draw_list->PathLineTo(ImVec2(bb.Max.x, y2));
10880 draw_list->PathFillConvex(col);
10881 if (g.Style.TabBorderSize > 0.0f)
10882 {
10883 draw_list->PathLineTo(ImVec2(bb.Min.x + 0.5f, y2));
10884 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding + 0.5f, y1 + rounding + 0.5f), rounding, 6, 9);
10885 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding - 0.5f, y1 + rounding + 0.5f), rounding, 9, 12);
10886 draw_list->PathLineTo(ImVec2(bb.Max.x - 0.5f, y2));
10887 draw_list->PathStroke(GetColorU32(ImGuiCol_Border), g.Style.TabBorderSize);
10888 }
10889}
10890
10891// Render text label (with custom clipping) + Unsaved Document marker + Close Button logic
10892// We tend to lock style.FramePadding for a given tab-bar, hence the 'frame_padding' parameter.

Callers

nothing calls this directly

Calls 8

ImMaxFunction · 0.85
ImMinFunction · 0.85
PathLineToMethod · 0.80
PathArcToFastMethod · 0.80
PathFillConvexMethod · 0.80
PathStrokeMethod · 0.80
ImVec2Function · 0.50
GetWidthMethod · 0.45

Tested by

no test coverage detected