// 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
m_parent->DoAddChild( this );
PostCreation();
-
- SetFont( parent->GetFont() );
+ InheritAttributes();
wxSize best_size( DoGetBestSize() );
wxSize new_size( size );
SetSize( new_size );
- SetBackgroundColour( parent->GetBackgroundColour() );
- SetForegroundColour( parent->GetForegroundColour() );
-
Show( TRUE );
return TRUE;
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 )
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();
{
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;