// 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;
}
wxSize wxButton::DoGetBestSize() const
{
+ // the default button in wxGTK is bigger than the other ones because of an
+ // extra border around it, but we don't want to take it into account in
+ // our size calculations (otherwsie the result is visually ugly), so
+ // always return the size of non default button from here
+ const bool isDefault = GTK_WIDGET_HAS_DEFAULT(m_widget);
+ if ( isDefault )
+ {
+ // temporarily unset default flag
+ GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+ }
+
wxSize ret( wxControl::DoGetBestSize() );
+ if ( isDefault )
+ {
+ // set it back again
+ GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+ }
+
+#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;