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
This commit is contained in:
parent
cc6dd35581
commit
e8e24dfa93
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -176,8 +176,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -142,8 +142,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -151,8 +151,7 @@ bool wxSpinButton::Create(wxWindow *parent,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -176,8 +176,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -142,8 +142,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -151,8 +151,7 @@ bool wxSpinButton::Create(wxWindow *parent,
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
InheritAttributes();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user