]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/propgridiface.cpp
correct typo: s/wxUSE_MENU/&S/
[wxWidgets.git] / src / propgrid / propgridiface.cpp
index 3b4bfe078c1538282d4c3711431d55d07e2036fa..afa04000c819b13f9d99085d4024e2df9f2942d4 100644 (file)
@@ -317,13 +317,42 @@ void wxPropertyGridInterface::DeleteProperty( wxPGPropArg id )
     if ( grid->GetState() == state )
         grid->DoSelectProperty(NULL, wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
 
-    state->DoDelete( p );
+    state->DoDelete( p, true );
 
     RefreshGrid(state);
 }
 
 // -----------------------------------------------------------------------
 
+wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
+{
+    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
+
+    wxCHECK( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE),
+             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 );
+
+    // Mark the property as 'unattached'
+    p->m_parentState = NULL;
+    p->m_parent = NULL;
+
+    RefreshGrid(state);
+
+    return p;
+}
+
+// -----------------------------------------------------------------------
+
 wxPGProperty* wxPropertyGridInterface::ReplaceProperty( wxPGPropArg id, wxPGProperty* property )
 {
     wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
@@ -361,11 +390,16 @@ bool wxPropertyGridInterface::ClearSelection( bool validation )
         flags |= wxPG_SEL_NOVALIDATE;
 
     wxPropertyGridPageState* state = m_pState;
-    wxPropertyGrid* pg = state->GetGrid();
-    if ( pg->GetState() == state )
-        return pg->DoSelectProperty(NULL, flags);
-    else
-        state->SetSelection(NULL);
+
+    if ( state )
+    {
+        wxPropertyGrid* pg = state->GetGrid();
+        if ( pg->GetState() == state )
+            return pg->DoSelectProperty(NULL, flags);
+        else
+            state->SetSelection(NULL);
+    }
+
     return true;
 }
 
@@ -489,6 +523,9 @@ void wxPropertyGridInterface::ClearModifiedStatus()
 
         pageIndex++;
     }
+
+    // Update active editor control, if any
+    GetPropertyGrid()->RefreshEditor();
 }
 
 // -----------------------------------------------------------------------
@@ -725,6 +762,25 @@ bool wxPropertyGridInterface::Expand( wxPGPropArg id )
 
 // -----------------------------------------------------------------------
 
+void wxPropertyGridInterface::Sort( int flags )
+{
+    wxPropertyGrid* pg = GetPropertyGrid();
+
+    pg->ClearSelection(false);
+
+    unsigned int pageIndex = 0;
+
+    for (;;)
+    {
+        wxPropertyGridPageState* page = GetPageState(pageIndex);
+        if ( !page ) break;
+        page->DoSort(flags);
+        pageIndex++;
+    }
+}
+
+// -----------------------------------------------------------------------
+
 void wxPropertyGridInterface::SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel )
 {
     wxPG_PROP_ARG_CALL_PROLOG()
@@ -1003,7 +1059,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
 
                 if ( !p->HasFlag(wxPG_PROP_COLLAPSED) )
                     result += EscapeDelimiters(p->GetName());
-                    result += wxS(",");
+                result += wxS(",");
 
             }