]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/propgridiface.cpp
Fix horizontal mouse wheel scrolling in wxGTK.
[wxWidgets.git] / src / propgrid / propgridiface.cpp
index 93e44177390513b52cc62be6f9d65c9a8dbf5f85..4608fb9c61e5e7bb6e1a79da61fade118f99a3b4 100644 (file)
@@ -4,9 +4,8 @@
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2008-08-24
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2008-08-24
-// RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
@@ -73,10 +72,8 @@ wxPGProperty* wxPGPropArgCls::GetPtr( wxPropertyGridInterface* iface ) const
         return iface->GetPropertyByNameA(*m_ptr.stringName);
     else if ( m_flags & IsCharPtr )
         return iface->GetPropertyByNameA(m_ptr.charName);
         return iface->GetPropertyByNameA(*m_ptr.stringName);
     else if ( m_flags & IsCharPtr )
         return iface->GetPropertyByNameA(m_ptr.charName);
-#if wxUSE_WCHAR_T
     else if ( m_flags & IsWCharPtr )
         return iface->GetPropertyByNameA(m_ptr.wcharName);
     else if ( m_flags & IsWCharPtr )
         return iface->GetPropertyByNameA(m_ptr.wcharName);
-#endif
 
     return NULL;
 }
 
     return NULL;
 }
@@ -166,10 +163,6 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
 
     state->DoDelete( p, false );
 
 
     state->DoDelete( p, false );
 
-    // Mark the property as 'unattached'
-    p->m_parentState = NULL;
-    p->m_parent = NULL;
-
     RefreshGrid(state);
 
     return p;
     RefreshGrid(state);
 
     return p;
@@ -270,7 +263,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
             return false;
 
         // If active, Set active Editor.
             return false;
 
         // If active, Set active Editor.
-        if ( grid->GetState() == state && p == grid->GetSelection() )
+        if ( grid && grid->GetState() == state && p == grid->GetSelection() )
             grid->DoSelectProperty( p, wxPG_SEL_FORCE );
     }
     else
             grid->DoSelectProperty( p, wxPG_SEL_FORCE );
     }
     else
@@ -279,11 +272,11 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
             return false;
 
         // If active, Disable as active Editor.
             return false;
 
         // If active, Disable as active Editor.
-        if ( grid->GetState() == state && p == grid->GetSelection() )
+        if ( grid && grid->GetState() == state && p == grid->GetSelection() )
             grid->DoSelectProperty( p, wxPG_SEL_FORCE );
     }
 
             grid->DoSelectProperty( p, wxPG_SEL_FORCE );
     }
 
-    state->DoEnableProperty(p, enable);
+    p->DoEnable(enable);
 
     RefreshProperty( p );
 
 
     RefreshProperty( p );
 
@@ -359,6 +352,17 @@ void wxPropertyGridInterface::ClearModifiedStatus()
     GetPropertyGrid()->RefreshEditor();
 }
 
     GetPropertyGrid()->RefreshEditor();
 }
 
+bool wxPropertyGridInterface::SetColumnProportion( unsigned int column,
+                                                   int proportion )
+{
+    wxCHECK(m_pState, false);
+    wxPropertyGrid* pg = m_pState->GetGrid();
+    wxCHECK(pg, false);
+    wxCHECK(pg->HasFlag(wxPG_SPLITTER_AUTO_CENTER), false);
+    m_pState->DoSetColumnProportion(column, proportion);
+    return true;
+}
+
 // -----------------------------------------------------------------------
 // wxPropertyGridInterface property value setting and getting
 // -----------------------------------------------------------------------
 // -----------------------------------------------------------------------
 // wxPropertyGridInterface property value setting and getting
 // -----------------------------------------------------------------------
@@ -587,8 +591,6 @@ void wxPropertyGridInterface::Sort( int flags )
 {
     wxPropertyGrid* pg = GetPropertyGrid();
 
 {
     wxPropertyGrid* pg = GetPropertyGrid();
 
-    pg->DoClearSelection();
-
     unsigned int pageIndex = 0;
 
     for (;;)
     unsigned int pageIndex = 0;
 
     for (;;)
@@ -598,6 +600,10 @@ void wxPropertyGridInterface::Sort( int flags )
         page->DoSort(flags);
         pageIndex++;
     }
         page->DoSort(flags);
         pageIndex++;
     }
+
+    // Fix positions of any open editor controls
+    if ( pg )
+        pg->CorrectEditorWidgetPosY();
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
@@ -692,7 +698,7 @@ void wxPropertyGridInterface::SetPropertyCell( wxPGPropArg id,
     wxPG_PROP_ARG_CALL_PROLOG()
 
     wxPGCell& cell = p->GetCell(column);
     wxPG_PROP_ARG_CALL_PROLOG()
 
     wxPGCell& cell = p->GetCell(column);
-    if ( text.length() && text != wxPG_LABEL )
+    if ( !text.empty() && text != wxPG_LABEL )
         cell.SetText(text);
     if ( bitmap.IsOk() )
         cell.SetBitmap(bitmap);
         cell.SetText(text);
     if ( bitmap.IsOk() )
         cell.SetBitmap(bitmap);
@@ -925,7 +931,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
     }
 
     // Remove last '|'
     }
 
     // Remove last '|'
-    if ( result.length() )
+    if ( !result.empty() )
         result.RemoveLast();
 
     return result;
         result.RemoveLast();
 
     return result;
@@ -1027,13 +1033,13 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
                         {
                             if ( pageState->IsDisplayed() )
                             {
                         {
                             if ( pageState->IsDisplayed() )
                             {
-                                if ( values[0].length() )
+                                if ( !values[0].empty() )
                                     newSelection = GetPropertyByName(value);
                                 pgSelectionSet = true;
                             }
                             else
                             {
                                     newSelection = GetPropertyByName(value);
                                 pgSelectionSet = true;
                             }
                             else
                             {
-                                if ( values[0].length() )
+                                if ( !values[0].empty() )
                                     pageState->DoSetSelection(GetPropertyByName(value));
                                 else
                                     pageState->DoClearSelection();
                                     pageState->DoSetSelection(GetPropertyByName(value));
                                 else
                                     pageState->DoClearSelection();