]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed bug: SetPropertyValueUnspecified(p) and p->SetValue(wxNullVariant) were out...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 11 Jan 2009 16:24:00 +0000 (16:24 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 11 Jan 2009 16:24:00 +0000 (16:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 2146da9de111251ffe7ada4196139f0ca9778477..9341c69db7635050a804f717aa09b427cf8d0562 100644 (file)
@@ -1748,8 +1748,6 @@ protected:
                      const wxRect* clip_rect,
                      bool isBuffered ) const;
 
-    void DoSetPropertyValueUnspecified( wxPGProperty* p );
-
     /** Draws an expand/collapse (ie. +/-) button.
     */
     virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect,
index fb8158ed0dcf8e5ba1eabcf7ea8a515dc3aa20e2..dda25e1faf4754423ebf48dc7408e131bcd3ede9 100644 (file)
@@ -1030,7 +1030,12 @@ public:
         If it has children (it may be category), then the same thing is done to
         them.
     */
-    void SetPropertyValueUnspecified( wxPGPropArg id );
+    void SetPropertyValueUnspecified( wxPGPropArg id )
+    {
+        wxPG_PROP_ARG_CALL_PROLOG()
+        wxVariant nullVariant;
+        SetPropVal(p, nullVariant);
+    }
 
 #ifndef SWIG
     /** Sets various property values from a list of wxVariants. If property with
index 658147f150505d7e9e2566182d1ed7ae01d4f7c8..ec1c8064ef655d7c1f6a5e0a7b9093a9d4655521 100644 (file)
@@ -606,8 +606,6 @@ public:
     void DoSetPropertyValues( const wxVariantList& list,
                               wxPGProperty* default_category );
 
-    void DoSetPropertyValueUnspecified( wxPGProperty* p );
-
     void SetSplitterLeft( bool subProps = false );
 
     /** Set virtual width for this particular page. */
index 1663eda6f9c24106576342ab22874327c69bd8a8..aea73df3b9fabec5348735356f59428927c97d11 100644 (file)
@@ -1285,9 +1285,6 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
         {
             m_value = value;
             OnSetValue();
-
-            if ( !(flags & wxPG_SETVAL_FROM_PARENT) )
-                UpdateParentValues();
         }
 
         if ( flags & wxPG_SETVAL_BY_USER )
@@ -1317,6 +1314,9 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
         }
     }
 
+    if ( !(flags & wxPG_SETVAL_FROM_PARENT) )
+        UpdateParentValues();
+
     //
     // Update editor control
     //
index 2d91cae007923e43fa3d6773aed4ee60678356d4..b68131499e9381c9452d4df4bfc4185f9841877b 100644 (file)
@@ -1185,24 +1185,6 @@ void wxPropertyGrid::PrepareAfterItemsAdded()
     RecalculateVirtualSize();
 }
 
-// -----------------------------------------------------------------------
-// wxPropertyGrid property value setting and getting
-// -----------------------------------------------------------------------
-
-void wxPropertyGrid::DoSetPropertyValueUnspecified( wxPGProperty* p )
-{
-    m_pState->DoSetPropertyValueUnspecified(p);
-    DrawItemAndChildren(p);
-
-    wxPGProperty* parent = p->GetParent();
-    while ( parent &&
-            (parent->GetFlags() & wxPG_PROP_PARENTAL_FLAGS) == wxPG_PROP_MISC_PARENT )
-    {
-        DrawItem(parent);
-        parent = parent->GetParent();
-    }
-}
-
 // -----------------------------------------------------------------------
 // wxPropertyGrid property operations
 // -----------------------------------------------------------------------
@@ -3635,7 +3617,12 @@ void wxPropertyGrid::RefreshEditor()
             wnd->SetFont(GetFont());
     }
 
-    p->GetEditorClass()->UpdateControl(p, wnd);
+    const wxPGEditor* editorClass = p->GetEditorClass();
+
+    editorClass->UpdateControl(p, wnd);
+
+    if ( p->IsValueUnspecified() )
+        editorClass ->SetValueToUnspecified(p, wnd);
 }
 
 // -----------------------------------------------------------------------
index afa04000c819b13f9d99085d4024e2df9f2942d4..8f0bab8b5a96c068287879a07d200a46f99faf05 100644 (file)
@@ -498,18 +498,6 @@ bool wxPropertyGridInterface::ExpandAll( bool doExpand )
 
 // -----------------------------------------------------------------------
 
-void wxPropertyGridInterface::SetPropertyValueUnspecified( wxPGPropArg id )
-{
-    wxPG_PROP_ARG_CALL_PROLOG()
-    wxPropertyGrid* propGrid = p->GetGridIfDisplayed();
-    if ( propGrid )
-        propGrid->DoSetPropertyValueUnspecified(p);
-    else
-        p->GetParentState()->DoSetPropertyValueUnspecified(p);
-}
-
-// -----------------------------------------------------------------------
-
 void wxPropertyGridInterface::ClearModifiedStatus()
 {
     unsigned int pageIndex = 0;
index 0803b1203759d23e408ac5fda4de70d9a2ca2c95..9caa7f35cc9d5800bba1552b60c57c4f695467aa 100644 (file)
@@ -1208,33 +1208,6 @@ bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty* p, wx
     return false;
 }
 
-// -----------------------------------------------------------------------
-
-void wxPropertyGridPageState::DoSetPropertyValueUnspecified( wxPGProperty* p )
-{
-    wxCHECK_RET( p, wxT("invalid property id") );
-
-    if ( !p->IsValueUnspecified() )
-    {
-        // Value should be set first - editor class methods may need it
-        p->m_value.MakeNull();
-
-        wxASSERT( m_pPropGrid );
-
-        if ( m_pPropGrid->GetState() == this )
-        {
-            if ( m_pPropGrid->m_selected == p && m_pPropGrid->m_wndEditor )
-            {
-                p->GetEditorClass()->SetValueToUnspecified(p, m_pPropGrid->GetEditorControl());
-            }
-        }
-
-        unsigned int i;
-        for ( i = 0; i < p->GetChildCount(); i++ )
-            DoSetPropertyValueUnspecified( p->Item(i) );
-    }
-}
-
 // -----------------------------------------------------------------------
 // wxPropertyGridPageState property operations
 // -----------------------------------------------------------------------