Handle DPI change in wxSTCListBox popup

This commit is contained in:
Maarten Bent
2020-06-01 15:56:06 +02:00
parent 4700298c26
commit 83a98e1a3c

View File

@@ -2649,6 +2649,7 @@ protected:
void OnSelection(wxCommandEvent&); void OnSelection(wxCommandEvent&);
void OnDClick(wxCommandEvent&); void OnDClick(wxCommandEvent&);
void OnSysColourChanged(wxSysColourChangedEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnDPIChanged(wxDPIChangedEvent& event);
void OnMouseMotion(wxMouseEvent& event); void OnMouseMotion(wxMouseEvent& event);
void OnMouseLeaveWindow(wxMouseEvent& event); void OnMouseLeaveWindow(wxMouseEvent& event);
@@ -2704,6 +2705,7 @@ wxSTCListBox::wxSTCListBox(wxWindow* parent, wxSTCListBoxVisualData* v, int ht)
Bind(wxEVT_LISTBOX, &wxSTCListBox::OnSelection, this); Bind(wxEVT_LISTBOX, &wxSTCListBox::OnSelection, this);
Bind(wxEVT_LISTBOX_DCLICK, &wxSTCListBox::OnDClick, this); Bind(wxEVT_LISTBOX_DCLICK, &wxSTCListBox::OnDClick, this);
Bind(wxEVT_SYS_COLOUR_CHANGED, &wxSTCListBox::OnSysColourChanged, this); Bind(wxEVT_SYS_COLOUR_CHANGED, &wxSTCListBox::OnSysColourChanged, this);
Bind(wxEVT_DPI_CHANGED, &wxSTCListBox::OnDPIChanged, this);
if ( m_visualData->HasListCtrlAppearance() ) if ( m_visualData->HasListCtrlAppearance() )
{ {
@@ -2943,6 +2945,18 @@ void wxSTCListBox::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
GetParent()->Refresh(); GetParent()->Refresh();
} }
void wxSTCListBox::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event))
{
m_imagePadding = FromDIP(1);
m_textBoxToTextGap = FromDIP(3);
m_textExtraVerticalPadding = FromDIP(1);
int w;
GetTextExtent(EXTENT_TEST, &w, &m_textHeight);
RecalculateItemHeight();
}
void wxSTCListBox::OnMouseLeaveWindow(wxMouseEvent& event) void wxSTCListBox::OnMouseLeaveWindow(wxMouseEvent& event)
{ {
const int old = m_currentRow; const int old = m_currentRow;