From e90c93b605adce5c186203879db1ea965faceb17 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Jun 2010 17:43:06 +0000 Subject: [PATCH] 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 --- src/generic/treectlg.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 70f6bfcd3c..c744c68ec1 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -977,13 +977,7 @@ void wxGenericTreeCtrl::Init() #else m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); #endif - m_boldFont = wxFont(m_normalFont.GetPointSize(), - m_normalFont.GetFamily(), - m_normalFont.GetStyle(), - wxBOLD, - m_normalFont.GetUnderlined(), - m_normalFont.GetFaceName(), - m_normalFont.GetEncoding()); + m_boldFont = m_normalFont.Bold(); } bool wxGenericTreeCtrl::Create(wxWindow *parent, @@ -1298,14 +1292,8 @@ bool wxGenericTreeCtrl::SetFont( const wxFont &font ) { wxTreeCtrlBase::SetFont(font); - m_normalFont = font ; - m_boldFont = wxFont(m_normalFont.GetPointSize(), - m_normalFont.GetFamily(), - m_normalFont.GetStyle(), - wxBOLD, - m_normalFont.GetUnderlined(), - m_normalFont.GetFaceName(), - m_normalFont.GetEncoding()); + m_normalFont = font; + m_boldFont = m_normalFont.Bold(); if (m_anchor) m_anchor->RecursiveResetTextSize(); -- 2.45.2