Improve per-monitor DPI in wxVListBoxComboPopup
Adjust the default item height before the drawing size is calculated.
This commit is contained in:
@@ -93,6 +93,7 @@ public:
|
|||||||
virtual void OnComboDoubleClick() wxOVERRIDE;
|
virtual void OnComboDoubleClick() wxOVERRIDE;
|
||||||
virtual bool LazyCreate() wxOVERRIDE;
|
virtual bool LazyCreate() wxOVERRIDE;
|
||||||
virtual bool FindItem(const wxString& item, wxString* trueItem) wxOVERRIDE;
|
virtual bool FindItem(const wxString& item, wxString* trueItem) wxOVERRIDE;
|
||||||
|
virtual void OnDPIChanged(wxDPIChangedEvent& event);
|
||||||
|
|
||||||
// Item management
|
// Item management
|
||||||
void SetSelection( int item );
|
void SetSelection( int item );
|
||||||
|
@@ -84,6 +84,10 @@ bool wxVListBoxComboPopup::Create(wxWindow* parent)
|
|||||||
// TODO: Move this to SetFont
|
// TODO: Move this to SetFont
|
||||||
m_itemHeight = m_combo->GetCharHeight();
|
m_itemHeight = m_combo->GetCharHeight();
|
||||||
|
|
||||||
|
// Bind to the DPI event of the combobox. We get our own once the popup
|
||||||
|
// is shown, but this is too late, m_itemHeight is already being used.
|
||||||
|
m_combo->Bind(wxEVT_DPI_CHANGED, &wxVListBoxComboPopup::OnDPIChanged, this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +108,11 @@ void wxVListBoxComboPopup::SetFocus()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxVListBoxComboPopup::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
m_itemHeight = m_combo->GetCharHeight();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxVListBoxComboPopup::LazyCreate()
|
bool wxVListBoxComboPopup::LazyCreate()
|
||||||
{
|
{
|
||||||
// NB: There is a bug with wxVListBox that can be avoided by creating
|
// NB: There is a bug with wxVListBox that can be avoided by creating
|
||||||
|
Reference in New Issue
Block a user