Fixed bug: SetPropertyValueUnspecified(p) and p->SetValue(wxNullVariant) were out of sync

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-01-11 16:24:00 +00:00
parent 85fe9f6f89
commit daeb4e4d4c
7 changed files with 15 additions and 66 deletions

View 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,

View 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

View 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. */

View 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
//

View 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);
}
// -----------------------------------------------------------------------

View 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;

View 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
// -----------------------------------------------------------------------