From: Vadim Zeitlin Date: Tue, 14 Nov 2006 14:20:11 +0000 (+0000) Subject: fix compilation when one of wxUSE_LISTCTRL and wxUSE_TREECTRL is defined but the... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/82c591d771cb651b7d54e1eada7c33da962e3831 fix compilation when one of wxUSE_LISTCTRL and wxUSE_TREECTRL is defined but the other is not (modified patch 1596323) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 3797cab625..05370f4505 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -169,11 +169,27 @@ bool wxControl::MSWCreateControl(const wxChar *classname, InheritAttributes(); if ( !m_hasFont ) { -#if wxUSE_LISTCTRL || wxUSE_TREECTRL + bool setFont = true; + + wxFont font = GetDefaultAttributes().font; + // if we set a font for {list,tree}ctrls and the font size is changed in // the display properties then the font size for these controls doesn't // automatically adjust when they receive WM_SETTINGCHANGE - if ( wxDynamicCastThis(wxListCtrl) || wxDynamicCastThis(wxTreeCtrl) ) + + // FIXME: replace the dynamic casts with virtual function calls!! +#if wxUSE_LISTCTRL || wxUSE_TREECTRL + bool testFont = false; +#if wxUSE_LISTCTRL + if ( wxDynamicCastThis(wxListCtrl) ) + testFont = true; +#endif // wxUSE_LISTCTRL +#if wxUSE_TREECTRL + if ( wxDynamicCastThis(wxTreeCtrl) ) + testFont = true; +#endif wxUSE_TREECTRL + + if ( testFont ) { // not sure if we need to explicitly set the font here for Win95/NT4 // but we definitely can't do it for any newer version @@ -182,14 +198,14 @@ bool wxControl::MSWCreateControl(const wxChar *classname, // TODO: test Win95/NT4 to see if this is needed or breaks the // font resizing as it does on newer versions - wxFont font = GetDefaultAttributes().font; - if ( font == wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) ) + if ( font != wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) ) { - SetFont(font); + setFont = false; } } - else #endif // wxUSE_LISTCTRL || wxUSE_TREECTRL + + if ( setFont ) { SetFont(GetDefaultAttributes().font); }