X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a696db453c79ff58509195244bcf260dfdf13c81..d284c07534af75014345a80363a7036897b5e388:/src/gtk1/button.cpp diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 711b64f16c..a3f1123908 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -7,10 +7,13 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "button.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/defs.h" #if wxUSE_BUTTON @@ -133,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 ); @@ -147,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; @@ -175,7 +174,12 @@ void wxButton::SetLabel( const wxString &label ) wxControl::SetLabel( label ); +#ifdef __WXGTK20__ + wxString label2 = PrepareLabelMnemonics( label ); + gtk_label_set_text_with_mnemonic( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( label2 ) ); +#else gtk_label_set( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( GetLabel() ) ); +#endif } bool wxButton::Enable( bool enable ) @@ -188,6 +192,15 @@ bool wxButton::Enable( bool enable ) return TRUE; } +bool wxButton::IsOwnGtkWindow( GdkWindow *window ) +{ +#ifdef __WXGTK20__ + return GTK_BUTTON(m_widget)->event_window; +#else + return (window == m_widget->window); +#endif +} + void wxButton::ApplyWidgetStyle() { SetWidgetStyle(); @@ -199,6 +212,10 @@ wxSize wxButton::DoGetBestSize() const { wxSize ret( wxControl::DoGetBestSize() ); +#ifndef __WXGTK20__ + ret.x += 10; // add a few pixels for sloppy (but common) themes +#endif + if (!HasFlag(wxBU_EXACTFIT)) { if (ret.x < 80) ret.x = 80;