]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/propgridiface.cpp
Raise the scrollbars on reparenting (part of patch #9076)
[wxWidgets.git] / src / propgrid / propgridiface.cpp
index ea0b4ee072b72cbcbfcc57af5051e4fc5a9ecd10..1984ce6bb40d37243fbaa139a8e25ada3d080a20 100644 (file)
@@ -102,7 +102,7 @@ void wxPropertyGridInterface::RefreshGrid( wxPropertyGridPageState* state )
 wxPGProperty* wxPropertyGridInterface::Append( wxPGProperty* property )
 {
     wxPGProperty* retp = m_pState->DoAppend(property);
 wxPGProperty* wxPropertyGridInterface::Append( wxPGProperty* property )
 {
     wxPGProperty* retp = m_pState->DoAppend(property);
-    
+
     wxPropertyGrid* grid = m_pState->GetGrid();
     if ( grid )
         grid->RefreshGrid();
     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();
     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 );
 
 
     state->DoDelete( p, true );
 
@@ -167,13 +163,6 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
              wxNullProperty);
 
     wxPropertyGridPageState* state = p->GetParentState();
              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 );
 
 
     state->DoDelete( p, false );
 
@@ -218,11 +207,29 @@ wxPGProperty* wxPropertyGridInterface::ReplaceProperty( wxPGPropArg id, wxPGProp
 // wxPropertyGridInterface property operations
 // -----------------------------------------------------------------------
 
 // wxPropertyGridInterface property operations
 // -----------------------------------------------------------------------
 
+wxPGProperty* wxPropertyGridInterface::GetSelection() const
+{
+    return m_pState->GetSelection();
+}
+
+// -----------------------------------------------------------------------
+
 bool wxPropertyGridInterface::ClearSelection( bool validation )
 {
 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 )
     if ( !validation )
-        flags |= wxPG_SEL_NOVALIDATE;
+        selFlags |= wxPG_SEL_NOVALIDATE;
 
     wxPropertyGridPageState* state = m_pState;
 
 
     wxPropertyGridPageState* state = m_pState;
 
@@ -230,9 +237,9 @@ bool wxPropertyGridInterface::ClearSelection( bool validation )
     {
         wxPropertyGrid* pg = state->GetGrid();
         if ( pg->GetState() == state )
     {
         wxPropertyGrid* pg = state->GetGrid();
         if ( pg->GetState() == state )
-            return pg->DoSelectProperty(NULL, flags);
+            return pg->DoSelectProperty(NULL, selFlags);
         else
         else
-            state->SetSelection(NULL);
+            state->DoSetSelection(NULL);
     }
 
     return true;
     }
 
     return true;
@@ -297,7 +304,7 @@ bool wxPropertyGridInterface::ExpandAll( bool doExpand )
     if ( GetSelection() && GetSelection() != state->DoGetRoot() &&
          !doExpand )
     {
     if ( GetSelection() && GetSelection() != state->DoGetRoot() &&
          !doExpand )
     {
-        pg->ClearSelection(false);
+        pg->DoClearSelection();
     }
 
     wxPGVIterator it;
     }
 
     wxPGVIterator it;
@@ -579,7 +586,7 @@ void wxPropertyGridInterface::Sort( int flags )
 {
     wxPropertyGrid* pg = GetPropertyGrid();
 
 {
     wxPropertyGrid* pg = GetPropertyGrid();
 
-    pg->ClearSelection(false);
+    pg->DoClearSelection();
 
     unsigned int pageIndex = 0;
 
 
     unsigned int pageIndex = 0;
 
@@ -857,7 +864,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
         if ( includedStates & ExpandedState )
         {
             wxArrayPGProperty ptrs;
         if ( includedStates & ExpandedState )
         {
             wxArrayPGProperty ptrs;
-            wxPropertyGridConstIterator it = 
+            wxPropertyGridConstIterator it =
                 wxPropertyGridConstIterator( pageState,
                                              wxPG_ITERATE_ALL_PARENTS_RECURSIVELY|wxPG_ITERATE_HIDDEN,
                                              wxNullProperty );
                 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 )
                     {
                 {
                     if ( restoreStates & ExpandedState )
                     {
-                        wxPropertyGridIterator it = 
+                        wxPropertyGridIterator it =
                             wxPropertyGridIterator( pageState,
                                                     wxPG_ITERATE_ALL,
                                                     wxNullProperty );
                             wxPropertyGridIterator( pageState,
                                                     wxPG_ITERATE_ALL,
                                                     wxNullProperty );
@@ -1026,7 +1033,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
                             else
                             {
                                 if ( values[0].length() )
                             else
                             {
                                 if ( values[0].length() )
-                                    pageState->SetSelection(GetPropertyByName(value));
+                                    pageState->DoSetSelection(GetPropertyByName(value));
                                 else
                                     pageState->DoClearSelection();
                             }
                                 else
                                     pageState->DoClearSelection();
                             }
@@ -1091,9 +1098,9 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
     if ( pgSelectionSet )
     {
         if ( newSelection )
     if ( pgSelectionSet )
     {
         if ( newSelection )
-            pg->SelectProperty(newSelection);
+            pg->DoSelectProperty(newSelection);
         else
         else
-            pg->ClearSelection();
+            pg->DoClearSelection();
     }
 
     if ( selectedPage != -1 )
     }
 
     if ( selectedPage != -1 )