X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfe1eee3bb9ecde8c4490ea69c07b5030d69530c..b3402d0df8c9f763da1e32fc28c824014e5516c6:/src/motif/button.cpp diff --git a/src/motif/button.cpp b/src/motif/button.cpp index ac7c31cfec..95f4f5b009 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -17,16 +17,20 @@ #include "wx/utils.h" #include "wx/panel.h" +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #include "wx/motif/private.h" void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr); -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) -#endif // Button @@ -80,7 +84,17 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, (XtPointer) this); SetCanAddEventHandler(TRUE); - AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); + + int x = 0; int y = 0; + wxFont new_font( parent->GetFont() ); + GetTextExtent( label1, &x, &y, (int*)NULL, (int*)NULL, &new_font ); + + wxSize newSize = size; + if (newSize.x == -1) newSize.x = 30+x; + if (newSize.y == -1) newSize.y = 27+y; + SetSize( newSize.x, newSize.y ); + + AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, newSize.x, newSize.y); ChangeBackgroundColour(); @@ -90,7 +104,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, void wxButton::SetDefault() { wxWindow *parent = GetParent(); - wxPanel *panel = wxDynamicCast(panel, wxPanel); + wxPanel *panel = wxDynamicCast(parent, wxPanel); if ( panel ) panel->SetDefaultItem(this); @@ -122,6 +136,14 @@ void wxButton::SetDefault() XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL); } +/* static */ +wxSize wxButton::GetDefaultSize() +{ + // TODO: check font size as in wxMSW ? MB + // + return wxSize(80,26); +} + void wxButton::Command (wxCommandEvent & event) { ProcessCommand (event);