]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/propgrid.cpp
no changes, just clarified meaning of various conversion functions in a comment
[wxWidgets.git] / src / propgrid / propgrid.cpp
index 5418444430608b22e996e9da27d7587f0cb22285..41b0144131f7bf945920d2491817e7ceb7a254ef 100644 (file)
@@ -16,6 +16,8 @@
     #pragma hdrstop
 #endif
 
+#if wxUSE_PROPGRID
+
 #ifndef WX_PRECOMP
     #include "wx/defs.h"
     #include "wx/object.h"
@@ -38,7 +40,6 @@
     #include "wx/stattext.h"
     #include "wx/scrolwin.h"
     #include "wx/dirdlg.h"
-    #include "wx/layout.h"
     #include "wx/sizer.h"
     #include "wx/textdlg.h"
     #include "wx/filedlg.h"
@@ -69,8 +70,6 @@
     #include <wx/msw/private.h>
 #endif
 
-#include <typeinfo>
-
 // Two pics for the expand / collapse buttons.
 // Files are not supplied with this project (since it is
 // recommended to use either custom or native rendering).
@@ -3395,7 +3394,7 @@ wxSize wxPropertyGrid::GetImageSize( wxPGProperty* p, int item ) const
 
     wxSize cis = p->OnMeasureImage(item);
 
-    int choiceCount = p->GetChoiceCount();
+    int choiceCount = p->m_choices.GetCount();
     int comVals = p->GetDisplayedCommonValueCount();
     if ( item >= choiceCount && comVals > 0 )
     {
@@ -3522,6 +3521,8 @@ void wxPropertyGrid::FreeEditors()
 // Call with NULL to de-select property
 bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 {
+    wxPanel* canvas = GetPanel();
+
     /*
     if (p)
         wxLogDebug(wxT("SelectProperty( %s (%s[%i]) )"),p->m_label.c_str(),
@@ -3590,8 +3591,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
                 }
                 else
                 {
-                    wxScrolledWindow::SetFocus();
-                    m_editorFocused = 0;
+                    SetFocusOnCanvas();
                 }
             }
 
@@ -3696,7 +3696,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 
                 if ( m_wndEditor )
                 {
-                    wxASSERT_MSG( m_wndEditor->GetParent() == m_canvas,
+                    wxASSERT_MSG( m_wndEditor->GetParent() == canvas,
                                   wxT("CreateControls must use result of wxPropertyGrid::GetPanel() as parent of controls.") );
 
                     // Set validator, if any
@@ -3764,7 +3764,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 
                 if ( m_wndEditor2 )
                 {
-                    wxASSERT_MSG( m_wndEditor2->GetParent() == m_canvas,
+                    wxASSERT_MSG( m_wndEditor2->GetParent() == canvas,
                                   wxT("CreateControls must use result of wxPropertyGrid::GetPanel() as parent of controls.") );
 
                     // Get proper id for wndSecondary
@@ -3809,8 +3809,8 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
             }
             else
             {
-                // wxGTK atleast seems to need this (wxMSW not)
-                SetFocus();
+                // Make sure focus is in grid canvas (important for wxGTK, at least)
+                SetFocusOnCanvas();
             }
 
             EditorsValueWasNotModified();
@@ -3830,6 +3830,11 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 
             DrawItems(p, p);
         }
+        else
+        {
+            // Make sure focus is in grid canvas
+            SetFocusOnCanvas();
+        }
 
         ClearInternalFlag(wxPG_FL_IN_SELECT_PROPERTY);
     }
@@ -3897,7 +3902,7 @@ bool wxPropertyGrid::UnfocusEditor()
     if ( !CommitChangesFromEditor(0) )
         return false;
 
-    m_canvas->SetFocusIgnoringChildren();
+    SetFocusOnCanvas();
     DrawItem(m_selected);
 
     return true;
@@ -4218,7 +4223,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
     // Need to set focus?
     if ( !(m_iFlags & wxPG_FL_FOCUSED) )
     {
-        m_canvas->SetFocus();
+        SetFocusOnCanvas();
     }
 
     wxPropertyGridPageState* state = m_pState;
@@ -6008,11 +6013,6 @@ wxEvent* wxPropertyGridEvent::Clone() const
     return new wxPropertyGridEvent( *this );
 }
 
-void wxPropertyGrid::SetPropertyAttributeAll( const wxString& attrName, wxVariant value )
-{
-    DoSetPropertyAttribute(GetRoot(), attrName, value, wxPG_RECURSE);
-}
-
 // -----------------------------------------------------------------------
 // wxPropertyGridPopulator
 // -----------------------------------------------------------------------
@@ -6300,3 +6300,5 @@ void wxPropertyGridPopulator::ProcessError( const wxString& msg )
 }
 
 // -----------------------------------------------------------------------
+
+#endif  // wxUSE_PROPGRID