From e8e24dfa9322702d56a125586a7d4a37f4a5dfd7 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 3 Dec 2003 03:24:47 +0000 Subject: [PATCH] Use InheritAttributes for wxGTK widgets so they will check ShouldInheritColours. Set wxButton to not inherit colours. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/button.h | 5 +++++ include/wx/gtk/button.h | 4 ++++ include/wx/gtk1/button.h | 4 ++++ src/gtk/bmpbuttn.cpp | 3 +-- src/gtk/button.cpp | 6 +----- src/gtk/checkbox.cpp | 6 +----- src/gtk/choice.cpp | 6 +----- src/gtk/combobox.cpp | 4 +--- src/gtk/listbox.cpp | 5 +---- src/gtk/radiobox.cpp | 4 +--- src/gtk/radiobut.cpp | 6 +----- src/gtk/scrolbar.cpp | 3 +-- src/gtk/slider.cpp | 3 +-- src/gtk/spinbutt.cpp | 3 +-- src/gtk/spinctrl.cpp | 5 +---- src/gtk/stattext.cpp | 10 +++++++--- src/gtk/textctrl.cpp | 3 +-- src/gtk/tglbtn.cpp | 6 +----- src/gtk1/bmpbuttn.cpp | 3 +-- src/gtk1/button.cpp | 6 +----- src/gtk1/checkbox.cpp | 6 +----- src/gtk1/choice.cpp | 6 +----- src/gtk1/combobox.cpp | 4 +--- src/gtk1/listbox.cpp | 5 +---- src/gtk1/radiobox.cpp | 4 +--- src/gtk1/radiobut.cpp | 6 +----- src/gtk1/scrolbar.cpp | 3 +-- src/gtk1/slider.cpp | 3 +-- src/gtk1/spinbutt.cpp | 3 +-- src/gtk1/spinctrl.cpp | 5 +---- src/gtk1/stattext.cpp | 10 +++++++--- src/gtk1/textctrl.cpp | 3 +-- src/gtk1/tglbtn.cpp | 6 +----- 33 files changed, 55 insertions(+), 104 deletions(-) diff --git a/include/wx/button.h b/include/wx/button.h index d4032a3b6c..1e7f14a0f7 100644 --- a/include/wx/button.h +++ b/include/wx/button.h @@ -60,6 +60,11 @@ public: // on its panel virtual void SetDefault() { } + // Buttons on MSW can look bad if they are not native colours, because + // then they become owner-drawn and not theme-drawn. Disable it here + // in wxButtonBase to make it consistent. + virtual bool ShouldInheritColours() const { return false; } + // returns the default button size for this platform static wxSize GetDefaultSize(); diff --git a/include/wx/gtk/button.h b/include/wx/gtk/button.h index 84b20b81a0..5c90c03e24 100644 --- a/include/wx/gtk/button.h +++ b/include/wx/gtk/button.h @@ -67,6 +67,10 @@ public: void ApplyWidgetStyle(); bool IsOwnGtkWindow( GdkWindow *window ); + // Since this wxButton doesn't derive from wxButtonBase (why?) we need + // to override this here too... + virtual bool ShouldInheritColours() const { return false; } + protected: virtual wxSize DoGetBestSize() const; diff --git a/include/wx/gtk1/button.h b/include/wx/gtk1/button.h index 84b20b81a0..5c90c03e24 100644 --- a/include/wx/gtk1/button.h +++ b/include/wx/gtk1/button.h @@ -67,6 +67,10 @@ public: void ApplyWidgetStyle(); bool IsOwnGtkWindow( GdkWindow *window ); + // Since this wxButton doesn't derive from wxButtonBase (why?) we need + // to override this here too... + virtual bool ShouldInheritColours() const { return false; } + protected: virtual wxSize DoGetBestSize() const; diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 8e548b420c..6d463b364b 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -176,8 +176,7 @@ bool wxBitmapButton::Create( wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 51caf3b9dc..68e6eb5346 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -136,8 +136,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize best_size( DoGetBestSize() ); wxSize new_size( size ); @@ -150,9 +149,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetSize( new_size ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index a5316a29f2..2a7d0437bf 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -121,8 +121,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -133,9 +132,6 @@ bool wxCheckBox::Create(wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index d4bcff0b9e..f437527d6c 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -111,14 +111,10 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); SetBestSize(size); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 0fb03dc36a..f295daac11 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -158,6 +158,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, m_focusWidget = combo->entry; PostCreation(); + InheritAttributes(); ConnectWidget( combo->button ); @@ -190,9 +191,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_set_usize( m_widget, new_size.x, new_size.y ); } - SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 56f3a23383..a8a680a940 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -399,10 +399,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) ); - SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 1dbff8ad50..1fd590f205 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -231,6 +231,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); ApplyWidgetStyle(); @@ -251,9 +252,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, if (newSize.y == -1) newSize.y = ls.y; SetSize( newSize.x, newSize.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index e79978e8b7..c8c6c53eca 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -129,8 +129,7 @@ bool wxRadioButton::Create( wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -141,9 +140,6 @@ bool wxRadioButton::Create( wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index 60750087df..edc4f34d71 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -180,11 +180,10 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); SetBestSize(size); - SetBackgroundColour( parent->GetBackgroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 27f9bdd393..f3ab24213f 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -142,8 +142,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 899c30c816..2d5eb9650c 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -151,8 +151,7 @@ bool wxSpinButton::Create(wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 989b574e37..e071efbce9 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -127,9 +127,8 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); - SetFont( parent->GetFont() ); - wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); if (new_size.x == -1) @@ -141,8 +140,6 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetValue( value ); Show( TRUE ); diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 90c9857ac0..228cac559f 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -111,7 +111,8 @@ bool wxStaticText::Create(wxWindow *parent, ApplyWidgetStyle(); - wxControl::SetFont( parent->GetFont() ); + InheritAttributes(); +// wxControl::SetFont( parent->GetFont() ); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -122,8 +123,11 @@ bool wxStaticText::Create(wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); +// if (ShouldInheritColours()) +// { +// SetBackgroundColour( parent->GetBackgroundColour() ); +// SetForegroundColour( parent->GetForegroundColour() ); +// } Show( TRUE ); return TRUE; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 36edaf5f50..3d03f75d3b 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -347,8 +347,7 @@ bool wxTextCtrl::Create( wxWindow *parent, m_focusWidget = m_text; PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index e5baaa3835..d6f4d5881f 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -75,8 +75,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild(this); PostCreation(); - - SetFont(parent->GetFont()); + InheritAttributes(); wxSize size_best(DoGetBestSize()); wxSize new_size(size); @@ -87,9 +86,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize(new_size.x, new_size.y); - SetBackgroundColour(parent->GetBackgroundColour()); - SetForegroundColour(parent->GetForegroundColour()); - Show(TRUE); return TRUE; diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 8e548b420c..6d463b364b 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -176,8 +176,7 @@ bool wxBitmapButton::Create( wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 51caf3b9dc..68e6eb5346 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -136,8 +136,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize best_size( DoGetBestSize() ); wxSize new_size( size ); @@ -150,9 +149,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetSize( new_size ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index a5316a29f2..2a7d0437bf 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -121,8 +121,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -133,9 +132,6 @@ bool wxCheckBox::Create(wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index d4bcff0b9e..f437527d6c 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -111,14 +111,10 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); SetBestSize(size); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 0fb03dc36a..f295daac11 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -158,6 +158,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, m_focusWidget = combo->entry; PostCreation(); + InheritAttributes(); ConnectWidget( combo->button ); @@ -190,9 +191,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_set_usize( m_widget, new_size.x, new_size.y ); } - SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 56f3a23383..a8a680a940 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -399,10 +399,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) ); - SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 1dbff8ad50..1fd590f205 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -231,6 +231,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); ApplyWidgetStyle(); @@ -251,9 +252,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, if (newSize.y == -1) newSize.y = ls.y; SetSize( newSize.x, newSize.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index e79978e8b7..c8c6c53eca 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -129,8 +129,7 @@ bool wxRadioButton::Create( wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -141,9 +140,6 @@ bool wxRadioButton::Create( wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index 60750087df..edc4f34d71 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -180,11 +180,10 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); SetBestSize(size); - SetBackgroundColour( parent->GetBackgroundColour() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 27f9bdd393..f3ab24213f 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -142,8 +142,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index 899c30c816..2d5eb9650c 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -151,8 +151,7 @@ bool wxSpinButton::Create(wxWindow *parent, m_parent->DoAddChild( this ); PostCreation(); - - SetBackgroundColour( parent->GetBackgroundColour() ); + InheritAttributes(); Show( TRUE ); diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index 989b574e37..e071efbce9 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -127,9 +127,8 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(); + InheritAttributes(); - SetFont( parent->GetFont() ); - wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); if (new_size.x == -1) @@ -141,8 +140,6 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetValue( value ); Show( TRUE ); diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index 90c9857ac0..228cac559f 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -111,7 +111,8 @@ bool wxStaticText::Create(wxWindow *parent, ApplyWidgetStyle(); - wxControl::SetFont( parent->GetFont() ); + InheritAttributes(); +// wxControl::SetFont( parent->GetFont() ); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -122,8 +123,11 @@ bool wxStaticText::Create(wxWindow *parent, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize( new_size.x, new_size.y ); - SetBackgroundColour( parent->GetBackgroundColour() ); - SetForegroundColour( parent->GetForegroundColour() ); +// if (ShouldInheritColours()) +// { +// SetBackgroundColour( parent->GetBackgroundColour() ); +// SetForegroundColour( parent->GetForegroundColour() ); +// } Show( TRUE ); return TRUE; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 36edaf5f50..3d03f75d3b 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -347,8 +347,7 @@ bool wxTextCtrl::Create( wxWindow *parent, m_focusWidget = m_text; PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index e5baaa3835..d6f4d5881f 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -75,8 +75,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, m_parent->DoAddChild(this); PostCreation(); - - SetFont(parent->GetFont()); + InheritAttributes(); wxSize size_best(DoGetBestSize()); wxSize new_size(size); @@ -87,9 +86,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, if ((new_size.x != size.x) || (new_size.y != size.y)) SetSize(new_size.x, new_size.y); - SetBackgroundColour(parent->GetBackgroundColour()); - SetForegroundColour(parent->GetForegroundColour()); - Show(TRUE); return TRUE; -- 2.45.2