// moved to it.
void SubPropsChanged( int oldSelInd = -1 );
- void UpdateControl( wxWindow* editorWnd );
-
int GetY2( int lh ) const;
wxString m_label;
tc->SetValue(s);
- // Update font boldness
- wxPropertyGrid* pg = property->GetGrid();
- if ( pg->HasFlag(wxPG_BOLD_MODIFIED) )
- {
- if ( property->HasFlag(wxPG_PROP_MODIFIED) )
- tc->SetFont(pg->GetCaptionFont());
- else
- tc->SetFont(pg->GetFont());
-
+ //
+ // Fix indentation, just in case (change in font boldness is one good
+ // reason).
#if defined(__WXMSW__) && !defined(__WXWINCE__)
- ::SendMessage(GetHwndOf(tc), EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
+ ::SendMessage(GetHwndOf(tc),
+ EM_SETMARGINS,
+ EC_LEFTMARGIN | EC_RIGHTMARGIN,
+ MAKELONG(0, 0));
#endif
- }
}
// Provided so that, for example, ComboBox editor can use the same code
return wxNOT_FOUND;
}
-void wxPGProperty::UpdateControl( wxWindow* editorWnd )
-{
- if ( editorWnd )
- GetEditorClass()->UpdateControl(this, editorWnd);
-}
-
bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
{
return true;
wxPropertyGrid* pg = GetGrid();
if ( pg && pg->GetSelectedProperty() == this )
- UpdateControl(pg->GetEditorControl());
+ pg->RefreshEditor();
}
wxVariant wxPGProperty::GetDefaultValue() const
if ( m_pState->m_itemsAdded || m_frozen )
return;
- wxWindow* wndPrimary = GetEditorControl();
-
// Update child control.
if ( m_selected && m_selected->GetParent() == p )
- m_selected->UpdateControl(wndPrimary);
+ RefreshEditor();
const wxPGProperty* lastDrawn = p->GetLastVisibleSubItem();
// control.
if ( selFlags & wxPG_SEL_DIALOGVAL )
{
- if ( editor )
- p->GetEditorClass()->UpdateControl(p, editor);
+ RefreshEditor();
}
else
{
void wxPropertyGrid::RefreshEditor()
{
- if ( !m_selected || !m_wndEditor || m_frozen )
+ wxPGProperty* p = m_selected;
+ if ( !p )
+ return;
+
+ wxWindow* wnd = GetEditorControl();
+ if ( !wnd )
return;
- m_selected->UpdateControl(m_wndEditor);
+
+ // Set editor font boldness - must do this before
+ // calling UpdateControl().
+ if ( HasFlag(wxPG_BOLD_MODIFIED) )
+ {
+ if ( p->HasFlag(wxPG_PROP_MODIFIED) )
+ wnd->SetFont(GetCaptionFont());
+ else
+ wnd->SetFont(GetFont());
+ }
+
+ p->GetEditorClass()->UpdateControl(p, wnd);
}
// -----------------------------------------------------------------------
{
p->SetValue(variant);
if ( m_selected==p && this==m_pPropGrid->GetState() )
- p->UpdateControl(m_pPropGrid->GetEditorControl());
+ m_pPropGrid->RefreshEditor();
}
return true;
{
p->SetValue(value);
if ( m_selected==p && this==m_pPropGrid->GetState() )
- p->UpdateControl(m_pPropGrid->GetEditorControl());
+ m_pPropGrid->RefreshEditor();
return true;
}
m_pPropGrid->Thaw();
if ( this == m_pPropGrid->GetState() )
- {
- m_selected->UpdateControl(m_pPropGrid->GetEditorControl());
- }
+ m_pPropGrid->RefreshEditor();
}
}