Update editor control font centrally, in wxPropertyGrid::RefreshEditor()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2222,8 +2222,6 @@ protected:
|
|||||||
// moved to it.
|
// moved to it.
|
||||||
void SubPropsChanged( int oldSelInd = -1 );
|
void SubPropsChanged( int oldSelInd = -1 );
|
||||||
|
|
||||||
void UpdateControl( wxWindow* editorWnd );
|
|
||||||
|
|
||||||
int GetY2( int lh ) const;
|
int GetY2( int lh ) const;
|
||||||
|
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
|
@@ -285,19 +285,15 @@ void wxPGTextCtrlEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
|
|||||||
|
|
||||||
tc->SetValue(s);
|
tc->SetValue(s);
|
||||||
|
|
||||||
// Update font boldness
|
//
|
||||||
wxPropertyGrid* pg = property->GetGrid();
|
// Fix indentation, just in case (change in font boldness is one good
|
||||||
if ( pg->HasFlag(wxPG_BOLD_MODIFIED) )
|
// reason).
|
||||||
{
|
|
||||||
if ( property->HasFlag(wxPG_PROP_MODIFIED) )
|
|
||||||
tc->SetFont(pg->GetCaptionFont());
|
|
||||||
else
|
|
||||||
tc->SetFont(pg->GetFont());
|
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(__WXWINCE__)
|
#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
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provided so that, for example, ComboBox editor can use the same code
|
// Provided so that, for example, ComboBox editor can use the same code
|
||||||
|
@@ -639,12 +639,6 @@ int wxPGProperty::Index( const wxPGProperty* p ) const
|
|||||||
return wxNOT_FOUND;
|
return wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPGProperty::UpdateControl( wxWindow* editorWnd )
|
|
||||||
{
|
|
||||||
if ( editorWnd )
|
|
||||||
GetEditorClass()->UpdateControl(this, editorWnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
|
bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -1341,7 +1335,7 @@ void wxPGProperty::RefreshEditor()
|
|||||||
|
|
||||||
wxPropertyGrid* pg = GetGrid();
|
wxPropertyGrid* pg = GetGrid();
|
||||||
if ( pg && pg->GetSelectedProperty() == this )
|
if ( pg && pg->GetSelectedProperty() == this )
|
||||||
UpdateControl(pg->GetEditorControl());
|
pg->RefreshEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariant wxPGProperty::GetDefaultValue() const
|
wxVariant wxPGProperty::GetDefaultValue() const
|
||||||
|
@@ -2130,11 +2130,9 @@ void wxPropertyGrid::DrawItemAndChildren( wxPGProperty* p )
|
|||||||
if ( m_pState->m_itemsAdded || m_frozen )
|
if ( m_pState->m_itemsAdded || m_frozen )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxWindow* wndPrimary = GetEditorControl();
|
|
||||||
|
|
||||||
// Update child control.
|
// Update child control.
|
||||||
if ( m_selected && m_selected->GetParent() == p )
|
if ( m_selected && m_selected->GetParent() == p )
|
||||||
m_selected->UpdateControl(wndPrimary);
|
RefreshEditor();
|
||||||
|
|
||||||
const wxPGProperty* lastDrawn = p->GetLastVisibleSubItem();
|
const wxPGProperty* lastDrawn = p->GetLastVisibleSubItem();
|
||||||
|
|
||||||
@@ -2790,8 +2788,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
|
|||||||
// control.
|
// control.
|
||||||
if ( selFlags & wxPG_SEL_DIALOGVAL )
|
if ( selFlags & wxPG_SEL_DIALOGVAL )
|
||||||
{
|
{
|
||||||
if ( editor )
|
RefreshEditor();
|
||||||
p->GetEditorClass()->UpdateControl(p, editor);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3638,9 +3635,25 @@ bool wxPropertyGrid::UnfocusEditor()
|
|||||||
|
|
||||||
void wxPropertyGrid::RefreshEditor()
|
void wxPropertyGrid::RefreshEditor()
|
||||||
{
|
{
|
||||||
if ( !m_selected || !m_wndEditor || m_frozen )
|
wxPGProperty* p = m_selected;
|
||||||
|
if ( !p )
|
||||||
return;
|
return;
|
||||||
m_selected->UpdateControl(m_wndEditor);
|
|
||||||
|
wxWindow* wnd = GetEditorControl();
|
||||||
|
if ( !wnd )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
@@ -1121,7 +1121,7 @@ bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty* p, const w
|
|||||||
{
|
{
|
||||||
p->SetValue(variant);
|
p->SetValue(variant);
|
||||||
if ( m_selected==p && this==m_pPropGrid->GetState() )
|
if ( m_selected==p && this==m_pPropGrid->GetState() )
|
||||||
p->UpdateControl(m_pPropGrid->GetEditorControl());
|
m_pPropGrid->RefreshEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1137,7 +1137,7 @@ bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty* p, wxVariant& va
|
|||||||
{
|
{
|
||||||
p->SetValue(value);
|
p->SetValue(value);
|
||||||
if ( m_selected==p && this==m_pPropGrid->GetState() )
|
if ( m_selected==p && this==m_pPropGrid->GetState() )
|
||||||
p->UpdateControl(m_pPropGrid->GetEditorControl());
|
m_pPropGrid->RefreshEditor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1504,9 +1504,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
|
|||||||
m_pPropGrid->Thaw();
|
m_pPropGrid->Thaw();
|
||||||
|
|
||||||
if ( this == m_pPropGrid->GetState() )
|
if ( this == m_pPropGrid->GetState() )
|
||||||
{
|
m_pPropGrid->RefreshEditor();
|
||||||
m_selected->UpdateControl(m_pPropGrid->GetEditorControl());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user