Add wxDPIChangedEvent::Scale() and use it in this event handlers
This is more concise and less error-prone than multiplying/dividing DPI values manually. No real changes except, maybe, in wxSlider code where the rounding was done differently before for some reason.
This commit is contained in:
@@ -5669,12 +5669,12 @@ void wxDataViewCtrl::OnDPIChanged(wxDPIChangedEvent& event)
|
||||
{
|
||||
int minWidth = m_cols[i]->GetMinWidth();
|
||||
if ( minWidth > 0 )
|
||||
minWidth = minWidth * event.GetNewDPI().x / event.GetOldDPI().x;
|
||||
minWidth = event.ScaleX(minWidth);
|
||||
m_cols[i]->SetMinWidth(minWidth);
|
||||
|
||||
int width = m_cols[i]->WXGetSpecifiedWidth();
|
||||
if ( width > 0 )
|
||||
width = width * event.GetNewDPI().x / event.GetOldDPI().x;
|
||||
width = event.ScaleX(width);
|
||||
m_cols[i]->SetWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user