Fix AUI tab close button size after DPI change in wxMSW

Reset close button size on DPI change to ensure that its size is
recomputed correctly using the new DPI when the tab is redrawn the next
time.

Closes #23400.
This commit is contained in:
Kumazuma 2023-03-30 09:19:36 +09:00 committed by Vadim Zeitlin
parent d5b61a16bf
commit baa2ea0273
5 changed files with 15 additions and 0 deletions

View file

@ -223,6 +223,7 @@ protected:
void OnChar(wxKeyEvent& event);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnDpiChanged(wxDPIChangedEvent& event);
protected:

View file

@ -113,6 +113,7 @@ public:
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
virtual void UpdateDpi() {}
};

View file

@ -74,6 +74,8 @@ public:
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) override;
void UpdateDpi() override;
private:
bool m_themed;
wxSize m_closeBtnSize;

View file

@ -1003,6 +1003,7 @@ wxBEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl)
EVT_CHAR(wxAuiTabCtrl::OnChar)
EVT_MOUSE_CAPTURE_LOST(wxAuiTabCtrl::OnCaptureLost)
EVT_SYS_COLOUR_CHANGED(wxAuiTabCtrl::OnSysColourChanged)
EVT_DPI_CHANGED(wxAuiTabCtrl::OnDpiChanged)
wxEND_EVENT_TABLE()
@ -1505,6 +1506,12 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event)
event.Skip();
}
void wxAuiTabCtrl::OnDpiChanged(wxDPIChangedEvent& event)
{
m_art->UpdateDpi();
event.Skip();
}
// wxTabFrame is an interesting case. It's important that all child pages
// of the multi-notebook control are all actually children of that control
// (and not grandchildren). wxTabFrame facilitates this. There is one

View file

@ -458,5 +458,9 @@ bool wxAuiMSWTabArt::IsThemed() const
!(m_flags & wxAUI_NB_BOTTOM); // Native theme does not support bottom tabs
}
void wxAuiMSWTabArt::UpdateDpi()
{
m_closeBtnSize = wxDefaultSize;
}
#endif // wxUSE_AUI && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__)