diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 0822136402..1c4fc0126a 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -1255,8 +1255,7 @@ public: // Common values are disabled by the default for all properties. void EnableCommonValue( bool enable = true ) { - if ( enable ) SetFlag( wxPG_PROP_USES_COMMON_VALUE ); - else ClearFlag( wxPG_PROP_USES_COMMON_VALUE ); + ChangeFlag(wxPG_PROP_USES_COMMON_VALUE, enable); } // Composes text from values of child properties. @@ -1682,8 +1681,7 @@ public: void SetExpanded( bool expanded ) { - if ( !expanded ) m_flags |= wxPG_PROP_COLLAPSED; - else m_flags &= ~wxPG_PROP_COLLAPSED; + ChangeFlag(wxPG_PROP_COLLAPSED, !expanded); } // Sets or clears given property flag. Mainly for internal use. diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index b863f30fbe..b1956d974f 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1593,11 +1593,7 @@ bool wxSystemColourProperty::DoSetAttribute( const wxString& name, wxVariant& va } else if ( name == wxPG_COLOUR_HAS_ALPHA ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_COLOUR_HAS_ALPHA; - else - m_flags &= ~(wxPG_PROP_COLOUR_HAS_ALPHA); - + ChangeFlag(wxPG_PROP_COLOUR_HAS_ALPHA, value.GetBool()); return true; } return wxEnumProperty::DoSetAttribute(name, value); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 8d8f0f525b..812ab80ac9 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1627,10 +1627,7 @@ void wxPGProperty::Enable( bool enable ) void wxPGProperty::DoEnable( bool enable ) { - if ( enable ) - ClearFlag(wxPG_PROP_DISABLED); - else - SetFlag(wxPG_PROP_DISABLED); + ChangeFlag(wxPG_PROP_DISABLED, !enable); // Apply same to sub-properties as well for ( unsigned int i = 0; i < GetChildCount(); i++ ) @@ -2154,10 +2151,7 @@ bool wxPGProperty::Hide( bool hide, int flags ) bool wxPGProperty::DoHide( bool hide, int flags ) { - if ( !hide ) - ClearFlag( wxPG_PROP_HIDDEN ); - else - SetFlag( wxPG_PROP_HIDDEN ); + ChangeFlag(wxPG_PROP_HIDDEN, hide); if ( flags & wxPG_RECURSE ) { diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 9df24d4b26..f3038e17b6 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -142,10 +142,7 @@ bool wxStringProperty::DoSetAttribute( const wxString& name, wxVariant& value ) { if ( name == wxPG_STRING_PASSWORD ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_PASSWORD; - else - m_flags &= ~(wxPG_PROP_PASSWORD); + ChangeFlag(wxPG_PROP_PASSWORD, value.GetBool()); RecreateEditor(); return true; } @@ -1166,19 +1163,13 @@ bool wxBoolProperty::DoSetAttribute( const wxString& name, wxVariant& value ) #if wxPG_INCLUDE_CHECKBOX if ( name == wxPG_BOOL_USE_CHECKBOX ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_USE_CHECKBOX; - else - m_flags &= ~(wxPG_PROP_USE_CHECKBOX); + ChangeFlag(wxPG_PROP_USE_CHECKBOX, value.GetBool()); return true; } #endif if ( name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_USE_DCC; - else - m_flags &= ~(wxPG_PROP_USE_DCC); + ChangeFlag(wxPG_PROP_USE_DCC, value.GetBool()); return true; } return wxPGProperty::DoSetAttribute(name, value); @@ -1830,10 +1821,7 @@ bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value ) { if ( name == wxPG_BOOL_USE_CHECKBOX ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_USE_CHECKBOX; - else - m_flags &= ~(wxPG_PROP_USE_CHECKBOX); + ChangeFlag(wxPG_PROP_USE_CHECKBOX, value.GetBool()); for ( size_t i = 0; i < GetChildCount(); i++ ) { @@ -1843,10 +1831,7 @@ bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value ) } else if ( name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_USE_DCC; - else - m_flags &= ~(wxPG_PROP_USE_DCC); + ChangeFlag(wxPG_PROP_USE_DCC, value.GetBool()); for ( size_t i = 0; i < GetChildCount(); i++ ) { @@ -2136,10 +2121,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value ) // stored in m_attributes. if ( name == wxPG_FILE_SHOW_FULL_PATH ) { - if ( value.GetBool() ) - m_flags |= wxPG_PROP_SHOW_FULL_FILENAME; - else - m_flags &= ~(wxPG_PROP_SHOW_FULL_FILENAME); + ChangeFlag(wxPG_PROP_SHOW_FULL_FILENAME, value.GetBool()); return true; } else if ( name == wxPG_FILE_WILDCARD )