Use for-loop to iterate sizer and window children

This commit is contained in:
Maarten Bent
2019-11-01 21:23:51 +01:00
parent 918e102533
commit 140b138494

View File

@@ -4887,11 +4887,12 @@ wxWindowMSW::MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI)
// update sizers // update sizers
if ( GetSizer() ) if ( GetSizer() )
{ {
wxSizerItemList::compatibility_iterator current = for ( wxSizerItemList::compatibility_iterator
GetSizer()->GetChildren().GetFirst(); node = GetSizer()->GetChildren().GetFirst();
while ( current ) node;
node = node->GetNext() )
{ {
wxSizerItem* sizerItem = current->GetData(); wxSizerItem* sizerItem = node->GetData();
int border = sizerItem->GetBorder(); int border = sizerItem->GetBorder();
ScaleCoordIfSet(border, scaleFactor); ScaleCoordIfSet(border, scaleFactor);
@@ -4910,16 +4911,15 @@ wxWindowMSW::MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI)
ScaleCoordIfSet(size.y, scaleFactor); ScaleCoordIfSet(size.y, scaleFactor);
sizerItem->SetDimension(wxDefaultPosition, size); sizerItem->SetDimension(wxDefaultPosition, size);
} }
current = current->GetNext();
} }
} }
// update children // update children
wxWindowList::compatibility_iterator current = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( current ) node;
node = node->GetNext() )
{ {
wxWindow *childWin = current->GetData(); wxWindow *childWin = node->GetData();
// Update all children, except other top-level windows. // Update all children, except other top-level windows.
// These could be on a different monitor and will get their own // These could be on a different monitor and will get their own
// dpi-changed event. // dpi-changed event.
@@ -4927,8 +4927,6 @@ wxWindowMSW::MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI)
{ {
childWin->MSWUpdateOnDPIChange(oldDPI, newDPI); childWin->MSWUpdateOnDPIChange(oldDPI, newDPI);
} }
current = current->GetNext();
} }
wxDPIChangedEvent event(oldDPI, newDPI); wxDPIChangedEvent event(oldDPI, newDPI);