X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e00b90802a3856692d41a84622dac20ff0c7496..b80fdc029995a0c2ce04910e26d652292c64d7bc:/src/propgrid/propgridiface.cpp diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index ea0b4ee072..1984ce6bb4 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -102,7 +102,7 @@ void wxPropertyGridInterface::RefreshGrid( wxPropertyGridPageState* state ) wxPGProperty* wxPropertyGridInterface::Append( wxPGProperty* property ) { wxPGProperty* retp = m_pState->DoAppend(property); - + wxPropertyGrid* grid = m_pState->GetGrid(); if ( grid ) grid->RefreshGrid(); @@ -147,10 +147,6 @@ void wxPropertyGridInterface::DeleteProperty( wxPGPropArg id ) wxPG_PROP_ARG_CALL_PROLOG() wxPropertyGridPageState* state = p->GetParentState(); - wxPropertyGrid* grid = state->GetGrid(); - - if ( grid->GetState() == state ) - grid->DoSelectProperty(NULL, wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE); state->DoDelete( p, true ); @@ -167,13 +163,6 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id ) wxNullProperty); wxPropertyGridPageState* state = p->GetParentState(); - wxPropertyGrid* grid = state->GetGrid(); - - if ( grid->GetState() == state ) - { - grid->DoSelectProperty(NULL, - wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE); - } state->DoDelete( p, false ); @@ -218,11 +207,29 @@ wxPGProperty* wxPropertyGridInterface::ReplaceProperty( wxPGPropArg id, wxPGProp // wxPropertyGridInterface property operations // ----------------------------------------------------------------------- +wxPGProperty* wxPropertyGridInterface::GetSelection() const +{ + return m_pState->GetSelection(); +} + +// ----------------------------------------------------------------------- + bool wxPropertyGridInterface::ClearSelection( bool validation ) { - int flags = 0; + bool res = DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT); + wxPropertyGrid* pg = GetPropertyGrid(); + if ( pg ) + pg->Refresh(); + return res; +} + +// ----------------------------------------------------------------------- + +bool wxPropertyGridInterface::DoClearSelection( bool validation, + int selFlags ) +{ if ( !validation ) - flags |= wxPG_SEL_NOVALIDATE; + selFlags |= wxPG_SEL_NOVALIDATE; wxPropertyGridPageState* state = m_pState; @@ -230,9 +237,9 @@ bool wxPropertyGridInterface::ClearSelection( bool validation ) { wxPropertyGrid* pg = state->GetGrid(); if ( pg->GetState() == state ) - return pg->DoSelectProperty(NULL, flags); + return pg->DoSelectProperty(NULL, selFlags); else - state->SetSelection(NULL); + state->DoSetSelection(NULL); } return true; @@ -297,7 +304,7 @@ bool wxPropertyGridInterface::ExpandAll( bool doExpand ) if ( GetSelection() && GetSelection() != state->DoGetRoot() && !doExpand ) { - pg->ClearSelection(false); + pg->DoClearSelection(); } wxPGVIterator it; @@ -579,7 +586,7 @@ void wxPropertyGridInterface::Sort( int flags ) { wxPropertyGrid* pg = GetPropertyGrid(); - pg->ClearSelection(false); + pg->DoClearSelection(); unsigned int pageIndex = 0; @@ -857,7 +864,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const if ( includedStates & ExpandedState ) { wxArrayPGProperty ptrs; - wxPropertyGridConstIterator it = + wxPropertyGridConstIterator it = wxPropertyGridConstIterator( pageState, wxPG_ITERATE_ALL_PARENTS_RECURSIVELY|wxPG_ITERATE_HIDDEN, wxNullProperty ); @@ -961,7 +968,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res { if ( restoreStates & ExpandedState ) { - wxPropertyGridIterator it = + wxPropertyGridIterator it = wxPropertyGridIterator( pageState, wxPG_ITERATE_ALL, wxNullProperty ); @@ -1026,7 +1033,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res else { if ( values[0].length() ) - pageState->SetSelection(GetPropertyByName(value)); + pageState->DoSetSelection(GetPropertyByName(value)); else pageState->DoClearSelection(); } @@ -1091,9 +1098,9 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res if ( pgSelectionSet ) { if ( newSelection ) - pg->SelectProperty(newSelection); + pg->DoSelectProperty(newSelection); else - pg->ClearSelection(); + pg->DoClearSelection(); } if ( selectedPage != -1 )