Replace 'while' loop with 'for' loop for simple iterations
Using 'for' loop to do a simple iteration is more intuitive and makes the code simpler.
This commit is contained in:
@@ -2548,7 +2548,6 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const
|
|||||||
//
|
//
|
||||||
// iMax is used when finding property y-positions.
|
// iMax is used when finding property y-positions.
|
||||||
//
|
//
|
||||||
unsigned int i = 0;
|
|
||||||
int h = 0;
|
int h = 0;
|
||||||
|
|
||||||
if ( iMax_ == -1 )
|
if ( iMax_ == -1 )
|
||||||
@@ -2561,7 +2560,7 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const
|
|||||||
if ( !IsExpanded() && GetParent() )
|
if ( !IsExpanded() && GetParent() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while ( i < iMax )
|
for ( unsigned int i = 0; i < iMax; i++ )
|
||||||
{
|
{
|
||||||
wxPGProperty* pwc = (wxPGProperty*) Item(i);
|
wxPGProperty* pwc = (wxPGProperty*) Item(i);
|
||||||
|
|
||||||
@@ -2573,8 +2572,6 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const
|
|||||||
else
|
else
|
||||||
h += pwc->GetChildrenHeight(lh) + lh;
|
h += pwc->GetChildrenHeight(lh) + lh;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
@@ -2592,10 +2589,8 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
|
|||||||
wxPGProperty* result = NULL;
|
wxPGProperty* result = NULL;
|
||||||
wxPGProperty* current = NULL;
|
wxPGProperty* current = NULL;
|
||||||
unsigned int iy = *nextItemY;
|
unsigned int iy = *nextItemY;
|
||||||
unsigned int i = 0;
|
|
||||||
unsigned int iMax = GetChildCount();
|
|
||||||
|
|
||||||
while ( i < iMax )
|
for ( unsigned int i = 0; i < GetChildCount(); i++ )
|
||||||
{
|
{
|
||||||
wxPGProperty* pwc = Item(i);
|
wxPGProperty* pwc = Item(i);
|
||||||
|
|
||||||
@@ -2620,8 +2615,6 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
|
|||||||
|
|
||||||
current = pwc;
|
current = pwc;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Found?
|
// Found?
|
||||||
|
Reference in New Issue
Block a user