From: Václav Slavík Date: Sun, 2 Mar 2008 10:50:16 +0000 (+0000) Subject: added Get(Class)DefaultAttributes implementation for all controls using DataBrowser... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4bff335abeed922f191fe4c6bf78e4bce63995b3?hp=3863c5ebd92650ba88f29db4f5f8d794ec11bf80 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 --- 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 // ----------------------------------------------------------------------------