From 4bff335abeed922f191fe4c6bf78e4bce63995b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 2 Mar 2008 10:50:16 +0000 Subject: [PATCH] added Get(Class)DefaultAttributes implementation for all controls using DataBrowser native control; fixed wxListBox's to return correct font git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/dataview.h | 8 ++++++++ include/wx/mac/carbon/listctrl.h | 8 ++++++++ src/mac/carbon/dataview.cpp | 12 ++++++++++++ src/mac/carbon/listbox.cpp | 2 +- src/mac/carbon/listctrl_mac.cpp | 12 ++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/wx/mac/carbon/dataview.h b/include/wx/mac/carbon/dataview.h index 7a8fbeffaa..01bcffc4fe 100644 --- a/include/wx/mac/carbon/dataview.h +++ b/include/wx/mac/carbon/dataview.h @@ -577,6 +577,14 @@ public: this->m_Deleting = deleting; } + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + protected: // inherited methods from wxDataViewCtrlBase: virtual void DoSetExpanderColumn(void); diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index a3949e50d8..f9c3e4201a 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -361,6 +361,14 @@ class WXDLLEXPORT wxListCtrl: public wxControl void MacSetDrawingContext(void* context) { m_cgContext = context; } void* MacGetDrawingContext() { return m_cgContext; } + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + protected: // protected overrides needed for pimpl approach diff --git a/src/mac/carbon/dataview.cpp b/src/mac/carbon/dataview.cpp index 0d334b6d73..e8b8a9374a 100644 --- a/src/mac/carbon/dataview.cpp +++ b/src/mac/carbon/dataview.cpp @@ -997,6 +997,18 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, return true; } /* wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator) */ +/*static*/ +wxVisualAttributes wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +{ + wxVisualAttributes attr; + + attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); + attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); + attr.font.MacCreateFromThemeFont(kThemeViewsFont); + + return attr; +} + bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model) { if (!wxDataViewCtrlBase::AssociateModel(model)) diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index ee803cb958..7a21c3bc8f 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -269,7 +269,7 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); - attr.font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); + attr.font.MacCreateFromThemeFont(kThemeViewsFont); return attr; } diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index fc27f289ef..ed4e0dbc2a 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -772,6 +772,18 @@ wxListCtrl::~wxListCtrl() delete m_renameTimer; } +/*static*/ +wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +{ + wxVisualAttributes attr; + + attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); + attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); + attr.font.MacCreateFromThemeFont(kThemeViewsFont); + + return attr; +} + // ---------------------------------------------------------------------------- // set/get/change style // ---------------------------------------------------------------------------- -- 2.45.2