| 10635 | } |
| 10636 | |
| 10637 | void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col) |
| 10638 | { |
| 10639 | // 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. |
| 10640 | ImGuiContext& g = *GImGui; |
| 10641 | const float width = bb.GetWidth(); |
| 10642 | IM_UNUSED(flags); |
| 10643 | IM_ASSERT(width > 0.0f); |
| 10644 | const float rounding = ImMax(0.0f, ImMin((flags & ImGuiTabItemFlags_Button) ? g.Style.FrameRounding : g.Style.TabRounding, width * 0.5f - 1.0f)); |
| 10645 | const float y1 = bb.Min.y + 1.0f; |
| 10646 | const float y2 = bb.Max.y - g.Style.TabBarBorderSize; |
| 10647 | draw_list->PathLineTo(ImVec2(bb.Min.x, y2)); |
| 10648 | draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9); |
| 10649 | draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12); |
| 10650 | draw_list->PathLineTo(ImVec2(bb.Max.x, y2)); |
| 10651 | draw_list->PathFillConvex(col); |
| 10652 | if (g.Style.TabBorderSize > 0.0f) |
| 10653 | { |
| 10654 | draw_list->PathLineTo(ImVec2(bb.Min.x + 0.5f, y2)); |
| 10655 | draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding + 0.5f, y1 + rounding + 0.5f), rounding, 6, 9); |
| 10656 | draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding - 0.5f, y1 + rounding + 0.5f), rounding, 9, 12); |
| 10657 | draw_list->PathLineTo(ImVec2(bb.Max.x - 0.5f, y2)); |
| 10658 | draw_list->PathStroke(GetColorU32(ImGuiCol_Border), 0, g.Style.TabBorderSize); |
| 10659 | } |
| 10660 | } |
| 10661 | |
| 10662 | // Render text label (with custom clipping) + Unsaved Document marker + Close Button logic |
| 10663 | // We tend to lock style.FramePadding for a given tab-bar, hence the 'frame_padding' parameter. |
nothing calls this directly
no test coverage detected