From 0534259ab803b0edd8692e966947b202cd9e10c0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Sep 2009 16:43:06 +0000 Subject: [PATCH] Move wxControl::GetCompositeControlsDefaultAttributes() from MSW to common. This function is not MSW-specific and should be used in generic implementation of controls such as wxListCtrl, wxTreeCtrl and wxDataViewCtrl. Even if it is needed by MSW only now, move it to the common code to avoid #ifdefs in these controls code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/control.h | 7 +++++++ include/wx/msw/control.h | 7 ------- src/common/ctrlcmn.cpp | 12 ++++++++++++ src/msw/control.cpp | 12 ------------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/wx/control.h b/include/wx/control.h index 5427a2d4aa..9fa7a65c21 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -131,6 +131,13 @@ public: static int FindAccelIndex(const wxString& label, wxString *labelOnly = NULL); + // this is a helper for the derived class GetClassDefaultAttributes() + // implementation: it returns the right colours for the classes which + // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of + // being simple controls (such as wxButton, wxCheckBox, ...) + static wxVisualAttributes + GetCompositeControlsDefaultAttributes(wxWindowVariant variant); + protected: // choose the default border for this window virtual wxBorder GetDefaultBorder() const; diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index 3288843c97..01d09f4832 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -122,13 +122,6 @@ protected: // one virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); - // this is a helper for the derived class GetClassDefaultAttributes() - // implementation: it returns the right colours for the classes which - // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of - // being simple controls (such as wxButton, wxCheckBox, ...) - static wxVisualAttributes - GetCompositeControlsDefaultAttributes(wxWindowVariant variant); - // for controls like radiobuttons which are really composite this array // holds the ids (not HWNDs!) of the sub controls wxArrayLong m_subControls; diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 374d2d49a3..f6dbd6eb2d 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -35,6 +35,7 @@ #include "wx/statbmp.h" #include "wx/bitmap.h" #include "wx/utils.h" // for wxStripMenuCodes() + #include "wx/settings.h" #endif const char wxControlNameStr[] = "control"; @@ -217,6 +218,17 @@ wxBorder wxControlBase::GetDefaultBorder() const return wxBORDER_THEME; } +/* static */ wxVisualAttributes +wxControlBase::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + wxVisualAttributes attrs; + attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + + return attrs; +} + // ---------------------------------------------------------------------------- // wxControlBase - ellipsization code // ---------------------------------------------------------------------------- diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 46854f5c23..c573e4a29a 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -303,18 +303,6 @@ wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return attrs; } -// another version for the "composite", i.e. non simple controls -/* static */ wxVisualAttributes -wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - wxVisualAttributes attrs; - attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - - return attrs; -} - // ---------------------------------------------------------------------------- // message handling // ---------------------------------------------------------------------------- -- 2.45.2