]> git.saurik.com Git - wxWidgets.git/commitdiff
implemented Get(Class)DefaultAttributes()
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Apr 2004 00:14:42 +0000 (00:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Apr 2004 00:14:42 +0000 (00:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/listctrl.h
include/wx/msw/treectrl.h
src/msw/listctrl.cpp
src/msw/treectrl.cpp

index 35dcf0bec4adf1e31f7d9f13a724d8ce458dd1f6..47ddda9e99941d45e3c69dcc79cb14f585b9d562 100644 (file)
@@ -350,8 +350,18 @@ public:
     // Necessary for drawing hrules and vrules, if specified
     void OnPaint(wxPaintEvent& event);
 
+
     virtual bool ShouldInheritColours() const { return false; }
 
+    virtual wxVisualAttributes GetDefaultAttributes() const
+    {
+        return GetClassDefaultAttributes(GetWindowVariant());
+    }
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+
     // obsolete stuff, for compatibility only -- don't use
     wxDEPRECATED( int GetItemSpacing(bool isSmall) const);
 
index effeda59ff1200ccd4ba2caaacd6c147a8901dcb..f95ddf6f964ebde7129f878a34cff3fed87cf46b 100644 (file)
@@ -408,11 +408,21 @@ public:
                                             long& cookie) const );
 #endif // WXWIN_COMPATIBILITY_2_4
 
-    virtual bool ShouldInheritColours() const { return false; }
 
     // implementation
     // --------------
 
+    virtual bool ShouldInheritColours() const { return false; }
+
+    virtual wxVisualAttributes GetDefaultAttributes() const
+    {
+        return GetClassDefaultAttributes(GetWindowVariant());
+    }
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+
     virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
     virtual bool MSWCommand(WXUINT param, WXWORD id);
     virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
index 693df7dc4f98ae2466eda4781211d142babe35a2..44321084d75fc70f4801451e1c623dfe5cdcb927 100644 (file)
@@ -363,11 +363,6 @@ bool wxListCtrl::Create(wxWindow *parent,
                       0, LVS_EX_FULLROWSELECT);
     }
 
-    // inherit foreground colour but our background should be the same as for
-    // listboxes and other such "container" windows and not inherited
-    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
-    SetForegroundColour(GetParent()->GetForegroundColour());
-
     return TRUE;
 }
 
@@ -546,6 +541,17 @@ void wxListCtrl::SetWindowStyleFlag(long flag)
 // accessors
 // ----------------------------------------------------------------------------
 
+/* static */ wxVisualAttributes
+wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+{
+    wxVisualAttributes attrs = GetCompositeControlsDefaultAttributes(variant);
+
+    // common controls have their own default font
+    attrs.font = wxGetCCDefaultFont();
+
+    return attrs;
+}
+
 // Sets the foreground, i.e. text, colour
 bool wxListCtrl::SetForegroundColour(const wxColour& col)
 {
index cd18d9d3f370563c432e2365414da14953b268a9..dcbb70016a71cc106dfdbbcfedad4d08d1714a6e 100644 (file)
@@ -787,6 +787,18 @@ wxTreeCtrl::~wxTreeCtrl()
 // accessors
 // ----------------------------------------------------------------------------
 
+/* static */ wxVisualAttributes
+wxTreeCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+{
+    wxVisualAttributes attrs = GetCompositeControlsDefaultAttributes(variant);
+
+    // common controls have their own default font
+    attrs.font = wxGetCCDefaultFont();
+
+    return attrs;
+}
+
+
 // simple wrappers which add error checking in debug mode
 
 bool wxTreeCtrl::DoGetItem(wxTreeViewItem* tvItem) const