Use conditional operators to simplify statements

This commit is contained in:
Artur Wieczorek
2020-01-23 19:45:51 +01:00
parent 750f3cb783
commit 9ac6c7906a

View File

@@ -509,10 +509,8 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
wxPGCell& cell = m_cells[i]; wxPGCell& cell = m_cells[i];
if ( cell.IsInvalid() ) if ( cell.IsInvalid() )
{ {
if ( !HasFlag(wxPG_PROP_CATEGORY) ) cell = HasFlag(wxPG_PROP_CATEGORY) ? propgrid->GetCategoryDefaultCell()
cell = propgrid->GetPropertyDefaultCell(); : propgrid->GetPropertyDefaultCell();
else
cell = propgrid->GetCategoryDefaultCell();
} }
} }
@@ -737,9 +735,7 @@ wxString wxPGProperty::GetName() const
wxPropertyGrid* wxPGProperty::GetGrid() const wxPropertyGrid* wxPGProperty::GetGrid() const
{ {
if ( !m_parentState ) return m_parentState ? m_parentState->GetGrid() : NULL;
return NULL;
return m_parentState->GetGrid();
} }
int wxPGProperty::Index( const wxPGProperty* p ) const int wxPGProperty::Index( const wxPGProperty* p ) const
@@ -1603,10 +1599,8 @@ void wxPGProperty::EnsureCells( unsigned int column )
if ( pg ) if ( pg )
{ {
if ( !HasFlag(wxPG_PROP_CATEGORY) ) defaultCell = HasFlag(wxPG_PROP_CATEGORY) ? pg->GetCategoryDefaultCell()
defaultCell = pg->GetPropertyDefaultCell(); : pg->GetPropertyDefaultCell();
else
defaultCell = pg->GetCategoryDefaultCell();
} }
// Alloc new default cells. // Alloc new default cells.
@@ -1699,10 +1693,8 @@ const wxPGCell& wxPGProperty::GetCell( unsigned int column ) const
return invalidCell; return invalidCell;
} }
if ( IsCategory() ) return IsCategory() ? pg->GetCategoryDefaultCell()
return pg->GetCategoryDefaultCell(); : pg->GetPropertyDefaultCell();
return pg->GetPropertyDefaultCell();
} }
wxPGCell& wxPGProperty::GetOrCreateCell( unsigned int column ) wxPGCell& wxPGProperty::GetOrCreateCell( unsigned int column )