By default, always refresh editor and redraw properties when property value is changed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-03-04 19:53:34 +00:00
parent aa960026e6
commit e777bd14b3
5 changed files with 35 additions and 34 deletions

View File

@@ -1897,12 +1897,15 @@ public:
SetValueInEvent() instead. SetValueInEvent() instead.
@param pList @param pList
Pointer to list variant that contains child values. Used to indicate Pointer to list variant that contains child values. Used to
which children should be marked as modified. indicate which children should be marked as modified.
@param flags @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 /** Set wxBitmap in front of the value. This bitmap may be ignored
by custom cell renderers. by custom cell renderers.

View File

@@ -1358,6 +1358,21 @@ public:
virtual void SetWindowStyleFlag( long style ); 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: protected:
/** /**
@@ -1760,21 +1775,6 @@ protected:
void DrawItems( wxDC& dc, unsigned int topitemy, unsigned int bottomitemy, void DrawItems( wxDC& dc, unsigned int topitemy, unsigned int bottomitemy,
const wxRect* clip_rect = (const wxRect*) NULL ); 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 // Translate wxKeyEvent to wxPG_ACTION_XXX
int KeyEventToActions(wxKeyEvent &event, int* pSecond) const; int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;

View File

@@ -1371,10 +1371,11 @@ public:
Pointer to list variant that contains child values. Used to indicate Pointer to list variant that contains child values. Used to indicate
which children should be marked as modified. Usually you just use @NULL. which children should be marked as modified. Usually you just use @NULL.
@param flags @param flags
Use wxPG_SETVAL_REFRESH_EDITOR to update editor control, if it wxPG_SETVAL_REFRESH_EDITOR is set by default, to refresh editor
was selected. 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 Set wxBitmap in front of the value. This bitmap may be ignored

View File

@@ -1327,7 +1327,12 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
// We need to check for these, otherwise GetGrid() may fail. // We need to check for these, otherwise GetGrid() may fail.
if ( flags & wxPG_SETVAL_REFRESH_EDITOR ) if ( flags & wxPG_SETVAL_REFRESH_EDITOR )
{
RefreshEditor(); RefreshEditor();
wxPropertyGrid* pg = GetGridIfDisplayed();
if ( pg )
pg->DrawItemAndValueRelated(this);
}
} }
@@ -1977,6 +1982,8 @@ bool wxPGProperty::IsVisible() const
wxPropertyGrid* wxPGProperty::GetGridIfDisplayed() const wxPropertyGrid* wxPGProperty::GetGridIfDisplayed() const
{ {
wxPropertyGridPageState* state = GetParentState(); wxPropertyGridPageState* state = GetParentState();
if ( !state )
return NULL;
wxPropertyGrid* propGrid = state->GetGrid(); wxPropertyGrid* propGrid = state->GetGrid();
if ( state == propGrid->GetState() ) if ( state == propGrid->GetState() )
return propGrid; return propGrid;

View File

@@ -543,13 +543,7 @@ void wxPropertyGridInterface::SetPropVal( wxPGPropArg id, wxVariant& value )
wxPG_PROP_ARG_CALL_PROLOG() wxPG_PROP_ARG_CALL_PROLOG()
if ( p ) if ( p )
{
p->SetValue(value); 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() wxPG_PROP_ARG_CALL_PROLOG()
if ( m_pState->DoSetPropertyValueString(p,value) ) if ( p )
{ m_pState->DoSetPropertyValueString(p, value);
wxPropertyGrid* propGrid = p->GetGridIfDisplayed();
if ( propGrid )
propGrid->DrawItemAndValueRelated( p );
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------