Tab improvements (#5210)

* Update selected tab underline color

* Disable using bold font for Selected tab

* Revert changes

* Calculate tab width from bold font to fix tab position changes
This commit is contained in:
yw4z 2024-04-30 16:40:30 +03:00 committed by GitHub
parent 423f557c34
commit 872f729d75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -106,6 +106,10 @@ int TabCtrl::AppendItem(const wxString &item,
btn->SetBackgroundColor(StateColor());
btn->SetCornerRadius(0);
btn->SetPaddingSize({TAB_BUTTON_PADDING});
wxClientDC dc(this); // ORCA calculate tab width from bold font to prevent tab movements on tab change
dc.SetFont(this->bold);
btn->SetMinSize(wxSize(dc.GetTextExtent(item).x + TAB_BUTTON_PADDING_X * 2, btn->GetSize().GetHeight()));
dc.Clear();
btns.push_back(btn);
if (btns.size() > 1)
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
@ -304,7 +308,7 @@ void TabCtrl::doRender(wxDC& dc)
#else
dc.SetPen(wxPen(border_color.colorForStates(states), border_width));
dc.DrawLine(0, size.y - BS2, size.x, size.y - BS2);
wxColour c(0xf2, 0x75, 0x4e, 0xff);
wxColour c = wxColour("#009688"); // ORCA: Controls under line color on selected tab
dc.SetPen(wxPen(c, 1));
dc.SetBrush(c);
dc.DrawRoundedRectangle(x1 - radius, size.y - BS2 - border_width * 3, x2 + radius * 2 - x1, border_width * 3, radius);