]> git.saurik.com Git - wxWidgets.git/commitdiff
By default, always refresh editor and redraw properties when property value is changed
authorJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 4 Mar 2009 19:53:34 +0000 (19:53 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 4 Mar 2009 19:53:34 +0000 (19:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
include/wx/propgrid/propgrid.h
interface/wx/propgrid/property.h
src/propgrid/property.cpp
src/propgrid/propgridiface.cpp

index 15e520ee61f3b8a779ee3703266ae7eb0c42184a..4f3a1b32bb88d86a2b4c1a2b9b44f05e0501b0b4 100644 (file)
@@ -1897,12 +1897,15 @@ public:
         SetValueInEvent() instead.
 
         @param pList
-        Pointer to list variant that contains child values. Used to indicate
-        which children should be marked as modified.
+            Pointer to list variant that contains child values. Used to
+            indicate which children should be marked as modified.
+
         @param flags
-        Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR).
+            Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR, which is
+            enabled by default).
     */
-    void SetValue( wxVariant value, wxVariant* pList = NULL, int flags = 0 );
+    void SetValue( wxVariant value, wxVariant* pList = NULL,
+                   int flags = wxPG_SETVAL_REFRESH_EDITOR );
 
     /** Set wxBitmap in front of the value. This bitmap may be ignored
         by custom cell renderers.
index a43fdd5648f77b109f75f4326b6749bbe1199f9a..9b0c23b21182e2fccf0bae2aed7555d4eec84f57 100644 (file)
@@ -1358,6 +1358,21 @@ public:
 
     virtual void SetWindowStyleFlag( long style );
 
+    void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 );
+
+    void DrawItem( wxPGProperty* p )
+    {
+        DrawItems(p,p);
+    }
+
+    virtual void DrawItemAndChildren( wxPGProperty* p );
+
+    /**
+        Draws item, children, and consequtive parents as long as category is
+        not met.
+     */
+    void DrawItemAndValueRelated( wxPGProperty* p );
+
 protected:
 
     /**
@@ -1760,21 +1775,6 @@ protected:
     void DrawItems( wxDC& dc, unsigned int topitemy, unsigned int bottomitemy,
                     const wxRect* clip_rect = (const wxRect*) NULL );
 
-    void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 );
-
-    void DrawItem( wxPGProperty* p )
-    {
-        DrawItems(p,p);
-    }
-
-    virtual void DrawItemAndChildren( wxPGProperty* p );
-
-    /**
-        Draws item, children, and consequtive parents as long as category is
-        not met.
-     */
-    void DrawItemAndValueRelated( wxPGProperty* p );
-
     // Translate wxKeyEvent to wxPG_ACTION_XXX
     int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
 
index 75efba3ce69d3a01c45f5ab19208c4aee5138c66..d8197e0abd141b00a60c469a5d2b09b43c337e14 100644 (file)
@@ -1371,10 +1371,11 @@ public:
             Pointer to list variant that contains child values. Used to indicate
             which children should be marked as modified. Usually you just use @NULL.
         @param flags
-            Use wxPG_SETVAL_REFRESH_EDITOR to update editor control, if it
-            was selected.
+            wxPG_SETVAL_REFRESH_EDITOR is set by default, to refresh editor
+            and redraw properties.
     */
-    void SetValue( wxVariant value, wxVariant* pList = NULL, int flags = 0 );
+    void SetValue( wxVariant value, wxVariant* pList = NULL,
+                   int flags = wxPG_SETVAL_REFRESH_EDITOR );
 
     /**
         Set wxBitmap in front of the value. This bitmap may be ignored
index bfb0e446e9d8104d360e79f1ed3f90984a17ada4..a3b35d4f27db9c5e86c460f04afe597b1c5fb04f 100644 (file)
@@ -1327,7 +1327,12 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
 
     // We need to check for these, otherwise GetGrid() may fail.
     if ( flags & wxPG_SETVAL_REFRESH_EDITOR )
+    {
         RefreshEditor();
+        wxPropertyGrid* pg = GetGridIfDisplayed();
+        if ( pg )
+            pg->DrawItemAndValueRelated(this);
+    }
 }
 
 
@@ -1977,6 +1982,8 @@ bool wxPGProperty::IsVisible() const
 wxPropertyGrid* wxPGProperty::GetGridIfDisplayed() const
 {
     wxPropertyGridPageState* state = GetParentState();
+    if ( !state )
+        return NULL;
     wxPropertyGrid* propGrid = state->GetGrid();
     if ( state == propGrid->GetState() )
         return propGrid;
index 8f0bab8b5a96c068287879a07d200a46f99faf05..ac348f9f1fbf3d5fd0122676cfd235ec4325a675 100644 (file)
@@ -543,13 +543,7 @@ void wxPropertyGridInterface::SetPropVal( wxPGPropArg id, wxVariant& value )
     wxPG_PROP_ARG_CALL_PROLOG()
 
     if ( p )
-    {
         p->SetValue(value);
-        wxPropertyGrid* propGrid = p->GetGridIfDisplayed();
-        if ( propGrid )
-            propGrid->DrawItemAndValueRelated( p );
-
-    }
 }
 
 // -----------------------------------------------------------------------
@@ -558,12 +552,8 @@ void wxPropertyGridInterface::SetPropertyValueString( wxPGPropArg id, const wxSt
 {
     wxPG_PROP_ARG_CALL_PROLOG()
 
-    if ( m_pState->DoSetPropertyValueString(p,value) )
-    {
-        wxPropertyGrid* propGrid = p->GetGridIfDisplayed();
-        if ( propGrid )
-            propGrid->DrawItemAndValueRelated( p );
-    }
+    if ( p )
+        m_pState->DoSetPropertyValueString(p, value);
 }
 
 // -----------------------------------------------------------------------