X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..926ce9e3ac32e1a33cc43420f76876fac8868436:/src/motif/button.cpp diff --git a/src/motif/button.cpp b/src/motif/button.cpp index 76e5ab9276..b5ce08a960 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -6,13 +6,9 @@ // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "button.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -33,6 +29,7 @@ #pragma message enable nosimpint #endif +#include "wx/stockitem.h" #include "wx/motif/private.h" #include "wx/sysopt.h" @@ -45,12 +42,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) // Button -bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, +bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { + wxString label(lbl); + if (label.empty() && wxIsStockID(id)) + label = wxGetStockLabel(id); + if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; @@ -71,7 +72,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("button", xmPushButtonWidgetClass, parentWidget, - wxFont::GetFontTag(), m_font.GetFontType(XtDisplay(parentWidget)), + wxFont::GetFontTag(), m_font.GetFontTypeC(XtDisplay(parentWidget)), XmNlabelString, text(), XmNrecomputeSize, False, // See comment for wxButton::SetDefault @@ -118,6 +119,7 @@ void wxButton::SetDefaultShadowThicknessAndResize() if( best != actual ) SetSize( best ); #endif + InvalidateBestSize(); } @@ -177,6 +179,19 @@ wxSize wxButton::DoGetBestSize() const return best; } +wxSize wxButton::GetMinSize() const +{ + if( wxMotifLargeButtons() ) + return OldGetMinSize(); + + return DoGetBestSize(); +} + +wxSize wxButton::OldGetMinSize() const +{ + return OldGetBestSize(); +} + wxSize wxButton::OldGetBestSize() const { Dimension xmargin, ymargin, highlight, shadow, defThickness; @@ -194,6 +209,7 @@ wxSize wxButton::OldGetBestSize() const int margin = highlight * 2 + ( defThickness ? ( ( shadow + defThickness ) * 4 ) : ( shadow * 2 ) ); + wxSize best( x + xmargin * 2 + margin, y + ymargin * 2 + margin );