MCPcopy Create free account
hub / github.com/RenderKit/embree / TabItemBackground

Method TabItemBackground

tutorials/common/imgui/imgui_widgets.cpp:8301–8324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8299}
8300
8301void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
8302{
8303 // 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.
8304 ImGuiContext& g = *GImGui;
8305 const float width = bb.GetWidth();
8306 IM_UNUSED(flags);
8307 IM_ASSERT(width > 0.0f);
8308 const float rounding = ImMax(0.0f, ImMin((flags & ImGuiTabItemFlags_Button) ? g.Style.FrameRounding : g.Style.TabRounding, width * 0.5f - 1.0f));
8309 const float y1 = bb.Min.y + 1.0f;
8310 const float y2 = bb.Max.y - 1.0f;
8311 draw_list->PathLineTo(ImVec2(bb.Min.x, y2));
8312 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9);
8313 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12);
8314 draw_list->PathLineTo(ImVec2(bb.Max.x, y2));
8315 draw_list->PathFillConvex(col);
8316 if (g.Style.TabBorderSize > 0.0f)
8317 {
8318 draw_list->PathLineTo(ImVec2(bb.Min.x + 0.5f, y2));
8319 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding + 0.5f, y1 + rounding + 0.5f), rounding, 6, 9);
8320 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding - 0.5f, y1 + rounding + 0.5f), rounding, 9, 12);
8321 draw_list->PathLineTo(ImVec2(bb.Max.x - 0.5f, y2));
8322 draw_list->PathStroke(GetColorU32(ImGuiCol_Border), 0, g.Style.TabBorderSize);
8323 }
8324}
8325
8326// Render text label (with custom clipping) + Unsaved Document marker + Close Button logic
8327// We tend to lock style.FramePadding for a given tab-bar, hence the 'frame_padding' parameter.

Callers

nothing calls this directly

Calls 7

ImMaxFunction · 0.85
ImMinFunction · 0.85
ImVec2Function · 0.85
PathLineToMethod · 0.80
PathArcToFastMethod · 0.80
PathFillConvexMethod · 0.80
PathStrokeMethod · 0.80

Tested by

no test coverage detected