Re-realize wxAuiToolBar on DPI change to fix its layout
The layout of the toolbar depends on the size of its bitmaps, which changes when the DPI does, so call Realize() again when this happens. This fixes the layout of the toolbars in the aui sample when moving it between screens using different DPI.
This commit is contained in:
@@ -642,6 +642,7 @@ protected: // handlers
|
||||
|
||||
void OnSize(wxSizeEvent& evt);
|
||||
void OnIdle(wxIdleEvent& evt);
|
||||
void OnDPIChanged(wxDPIChangedEvent& evt);
|
||||
void OnPaint(wxPaintEvent& evt);
|
||||
void OnEraseBackground(wxEraseEvent& evt);
|
||||
void OnLeftDown(wxMouseEvent& evt);
|
||||
|
||||
@@ -825,6 +825,7 @@ static wxOrientation GetOrientation(long style)
|
||||
wxBEGIN_EVENT_TABLE(wxAuiToolBar, wxControl)
|
||||
EVT_SIZE(wxAuiToolBar::OnSize)
|
||||
EVT_IDLE(wxAuiToolBar::OnIdle)
|
||||
EVT_DPI_CHANGED(wxAuiToolBar::OnDPIChanged)
|
||||
EVT_ERASE_BACKGROUND(wxAuiToolBar::OnEraseBackground)
|
||||
EVT_PAINT(wxAuiToolBar::OnPaint)
|
||||
EVT_LEFT_DOWN(wxAuiToolBar::OnLeftDown)
|
||||
@@ -2383,6 +2384,11 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt)
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
void wxAuiToolBar::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event))
|
||||
{
|
||||
Realize();
|
||||
}
|
||||
|
||||
void wxAuiToolBar::UpdateWindowUI(long flags)
|
||||
{
|
||||
if ( flags & wxUPDATE_UI_FROMIDLE )
|
||||
|
||||
Reference in New Issue
Block a user