Use wxFont::Bold() in wxGenericTreeCtrl instead of wrongly duplicating it.
Creating a new wxFont from the components of the existing one doesn't always work because we may not have a valid value for the old font family so attempt to use it as a family of the new font results in an assert. Just use wxFont::Bold() instead to avoid the problem. It's much shorter and obviously correct and doesn't result in asserts. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -977,13 +977,7 @@ void wxGenericTreeCtrl::Init()
|
|||||||
#else
|
#else
|
||||||
m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
#endif
|
#endif
|
||||||
m_boldFont = wxFont(m_normalFont.GetPointSize(),
|
m_boldFont = m_normalFont.Bold();
|
||||||
m_normalFont.GetFamily(),
|
|
||||||
m_normalFont.GetStyle(),
|
|
||||||
wxBOLD,
|
|
||||||
m_normalFont.GetUnderlined(),
|
|
||||||
m_normalFont.GetFaceName(),
|
|
||||||
m_normalFont.GetEncoding());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericTreeCtrl::Create(wxWindow *parent,
|
bool wxGenericTreeCtrl::Create(wxWindow *parent,
|
||||||
@@ -1299,13 +1293,7 @@ bool wxGenericTreeCtrl::SetFont( const wxFont &font )
|
|||||||
wxTreeCtrlBase::SetFont(font);
|
wxTreeCtrlBase::SetFont(font);
|
||||||
|
|
||||||
m_normalFont = font;
|
m_normalFont = font;
|
||||||
m_boldFont = wxFont(m_normalFont.GetPointSize(),
|
m_boldFont = m_normalFont.Bold();
|
||||||
m_normalFont.GetFamily(),
|
|
||||||
m_normalFont.GetStyle(),
|
|
||||||
wxBOLD,
|
|
||||||
m_normalFont.GetUnderlined(),
|
|
||||||
m_normalFont.GetFaceName(),
|
|
||||||
m_normalFont.GetEncoding());
|
|
||||||
|
|
||||||
if (m_anchor)
|
if (m_anchor)
|
||||||
m_anchor->RecursiveResetTextSize();
|
m_anchor->RecursiveResetTextSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user