From 880715c9a941c58e5f702ff340aac7138b27f6ed Mon Sep 17 00:00:00 2001
From: Robin Dunn <robin@alldunn.com>
Date: Thu, 6 May 2004 17:35:43 +0000
Subject: [PATCH] Add GetClassDefaultAttribute.  Since it is static we need to
 put the definition in all window classes so the right one will be called on
 the C++ side of the fence.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 wxPython/src/_button.i    |  3 +++
 wxPython/src/_checkbox.i  |  2 ++
 wxPython/src/_choice.i    |  3 +++
 wxPython/src/_combobox.i  |  2 ++
 wxPython/src/_gauge.i     |  4 ++++
 wxPython/src/_notebook.i  |  6 ++++++
 wxPython/src/_panel.i     |  5 +++++
 wxPython/src/_radio.i     |  5 +++++
 wxPython/src/_scrolbar.i  |  3 +++
 wxPython/src/_slider.i    |  3 +++
 wxPython/src/_spin.i      |  6 ++++++
 wxPython/src/_splitter.i  |  3 +++
 wxPython/src/_statctrls.i | 11 +++++++++++
 wxPython/src/_statusbar.i |  3 +++
 wxPython/src/_textctrl.i  |  2 ++
 wxPython/src/_tglbtn.i    |  3 +++
 wxPython/src/_toolbar.i   |  3 +++
 wxPython/src/_toplvl.i    |  6 ++++++
 wxPython/src/_window.i    |  4 ++--
 wxPython/src/calendar.i   |  3 +++
 wxPython/src/grid.i       |  2 ++
 wxPython/src/html.i       |  3 +++
 22 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/wxPython/src/_button.i b/wxPython/src/_button.i
index be6ec069cc..40c92dd711 100644
--- a/wxPython/src/_button.i
+++ b/wxPython/src/_button.i
@@ -99,6 +99,9 @@ public:
     DocDeclStr(
         static wxSize , GetDefaultSize(),
         "Returns the default button size for this platform.");   
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/_checkbox.i b/wxPython/src/_checkbox.i
index ae785bad99..66fb9d2070 100644
--- a/wxPython/src/_checkbox.i
+++ b/wxPython/src/_checkbox.i
@@ -150,6 +150,8 @@ state to wx.CHK_UNDETERMINED.");
         "Returns whether or not the user can set the CheckBox to the third
 state.");
     
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_choice.i b/wxPython/src/_choice.i
index fa5deae4ca..de2bc68844 100644
--- a/wxPython/src/_choice.i
+++ b/wxPython/src/_choice.i
@@ -94,6 +94,9 @@ public:
     
 
     %pythoncode { Select = SetSelection }
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_combobox.i b/wxPython/src/_combobox.i
index ab262f9bf1..e07864bca5 100644
--- a/wxPython/src/_combobox.i
+++ b/wxPython/src/_combobox.i
@@ -166,6 +166,8 @@ public:
         virtual void , Remove(long from, long to),
         "Removes the text between the two positions in the combobox text field.");
     
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_gauge.i b/wxPython/src/_gauge.i
index 264683d27a..6197cde3d4 100644
--- a/wxPython/src/_gauge.i
+++ b/wxPython/src/_gauge.i
@@ -65,6 +65,10 @@ public:
     virtual int GetShadowWidth() const;
     virtual void SetBezelFace(int w);
     virtual int GetBezelFace() const;
+
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_notebook.i b/wxPython/src/_notebook.i
index c63e2eaa79..abb564f6b5 100644
--- a/wxPython/src/_notebook.i
+++ b/wxPython/src/_notebook.i
@@ -115,6 +115,9 @@ public:
 
     // cycle thru the pages
     void AdvanceSelection(bool forward = True);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
@@ -202,6 +205,9 @@ public:
     // Windows only: attempts to apply the UX theme page background to this page
   void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
 #endif
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/_panel.i b/wxPython/src/_panel.i
index b0bcc1ad56..a20389f1f6 100644
--- a/wxPython/src/_panel.i
+++ b/wxPython/src/_panel.i
@@ -45,6 +45,8 @@ public:
 
     void InitDialog();
 
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
@@ -156,6 +158,9 @@ public:
     void SetTargetRect(const wxRect& rect);
     wxRect GetTargetRect() const;
 #endif
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
     
diff --git a/wxPython/src/_radio.i b/wxPython/src/_radio.i
index 4e4dde6728..c70ce8c11c 100644
--- a/wxPython/src/_radio.i
+++ b/wxPython/src/_radio.i
@@ -86,6 +86,8 @@ public:
     }
 #endif
         
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
     
 
@@ -117,6 +119,9 @@ public:
 
     bool GetValue();
     void SetValue(bool value);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_scrolbar.i b/wxPython/src/_scrolbar.i
index 8155c4502e..2cdd183639 100644
--- a/wxPython/src/_scrolbar.i
+++ b/wxPython/src/_scrolbar.i
@@ -52,6 +52,9 @@ public:
     virtual void SetScrollbar(int position, int thumbSize,
                               int range, int pageSize,
                               bool refresh = True);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_slider.i b/wxPython/src/_slider.i
index 5d4e64329c..7ecf040a2e 100644
--- a/wxPython/src/_slider.i
+++ b/wxPython/src/_slider.i
@@ -83,6 +83,9 @@ public:
     virtual int GetSelStart() const;
     virtual void SetSelection(int min, int max);
 
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_spin.i b/wxPython/src/_spin.i
index 1b100a21e5..29b9ca22ab 100644
--- a/wxPython/src/_spin.i
+++ b/wxPython/src/_spin.i
@@ -68,6 +68,9 @@ public:
 
     // is this spin button vertically oriented?
     bool IsVertical() const;
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
@@ -110,6 +113,9 @@ public:
     virtual int GetMin() const;
     virtual int GetMax() const;
     void SetSelection(long from, long to);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/_splitter.i b/wxPython/src/_splitter.i
index b149bb8bd2..458abf420c 100644
--- a/wxPython/src/_splitter.i
+++ b/wxPython/src/_splitter.i
@@ -334,6 +334,9 @@ unsplit even if minimum size is non-zero.");
 
     void SetNeedUpdating(bool needUpdating);
     bool GetNeedUpdating() const;
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/_statctrls.i b/wxPython/src/_statctrls.i
index 6ada254ec4..c407a4d799 100644
--- a/wxPython/src/_statctrls.i
+++ b/wxPython/src/_statctrls.i
@@ -40,6 +40,9 @@ public:
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
                 const wxString& name = wxPyStaticBoxNameStr);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
@@ -71,6 +74,8 @@ public:
     // get the default size for the "lesser" dimension of the static line
     static int GetDefaultSize();
 
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
@@ -94,6 +99,9 @@ public:
                  const wxSize& size = wxDefaultSize,
                  long style = 0,
                  const wxString& name = wxPyStaticTextNameStr);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
@@ -122,6 +130,9 @@ public:
     wxBitmap GetBitmap();
     void SetBitmap(const wxBitmap& bitmap);
     void SetIcon(const wxIcon& icon);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_statusbar.i b/wxPython/src/_statusbar.i
index ba4a4b92c0..e3a0d66c3b 100644
--- a/wxPython/src/_statusbar.i
+++ b/wxPython/src/_statusbar.i
@@ -74,6 +74,9 @@ public:
     // get the dimensions of the horizontal and vertical borders
     virtual int GetBorderX() const;
     virtual int GetBorderY() const;
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/_textctrl.i b/wxPython/src/_textctrl.i
index 01cad4d056..be3b7727a8 100644
--- a/wxPython/src/_textctrl.i
+++ b/wxPython/src/_textctrl.i
@@ -309,6 +309,8 @@ public:
         }
     }
 
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_tglbtn.i b/wxPython/src/_tglbtn.i
index e2cf914b58..9fde315a8e 100644
--- a/wxPython/src/_tglbtn.i
+++ b/wxPython/src/_tglbtn.i
@@ -78,6 +78,9 @@ public:
     void SetValue(bool value);
     bool GetValue() const ;
     void SetLabel(const wxString& label);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_toolbar.i b/wxPython/src/_toolbar.i
index 4286bb886f..16db24619b 100644
--- a/wxPython/src/_toolbar.i
+++ b/wxPython/src/_toolbar.i
@@ -405,6 +405,9 @@ public:
               const wxString& name = wxPyToolBarNameStr);
 
     wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_toplvl.i b/wxPython/src/_toplvl.i
index 8da7a55a31..5dc4b30684 100644
--- a/wxPython/src/_toplvl.i
+++ b/wxPython/src/_toplvl.i
@@ -247,6 +247,9 @@ public:
     // send wxUpdateUIEvents for all menu items in the menubar,
     // or just for menu if non-NULL
     void DoMenuUpdates(wxMenu* menu = NULL);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
@@ -299,6 +302,9 @@ public:
 
     // may be called to terminate the dialog with the given return code
     virtual void EndModal(int retCode);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 //---------------------------------------------------------------------------
diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i
index 70e855e1d3..8802ae8895 100644
--- a/wxPython/src/_window.i
+++ b/wxPython/src/_window.i
@@ -31,7 +31,7 @@ struct wxVisualAttributes
 {
     %extend {
         wxVisualAttributes() { return new wxVisualAttributes; }
-        ~wxVisualAttributes() {}
+        ~wxVisualAttributes() { delete self; }
     }
     
     // the font used for control label/text inside it
@@ -1190,7 +1190,7 @@ exposed.");
 
 
     DocDeclStr(
-        wxVisualAttributes , GetDefaultAttributes() const,
+        virtual wxVisualAttributes , GetDefaultAttributes() const,
         "Get the default attributes for an instance of this class.  This
 is useful if you want to use the same font or colour in your own
 control as in a standard control -- which is a much better idea
diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i
index 262170001e..c046cd14f4 100644
--- a/wxPython/src/calendar.i
+++ b/wxPython/src/calendar.i
@@ -399,6 +399,9 @@ are:
     DocDeclStr(
         wxControl*, GetYearControl() const,
         "Get the currently shown control for year.");
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i
index e0e0ae42b1..51f571f8e4 100644
--- a/wxPython/src/grid.i
+++ b/wxPython/src/grid.i
@@ -1938,6 +1938,8 @@ public:
     wxWindow* GetGridCornerLabelWindow();
 
 
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
diff --git a/wxPython/src/html.i b/wxPython/src/html.i
index 164183844e..ea61500113 100644
--- a/wxPython/src/html.i
+++ b/wxPython/src/html.i
@@ -903,6 +903,9 @@ public:
     void base_OnCellClicked(wxHtmlCell *cell,
                             wxCoord x, wxCoord y,
                             const wxMouseEvent& event);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
-- 
2.47.2