#pragma implementation "button.h"
#endif
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#endif
+
+#include "wx/defs.h"
+
#include "wx/button.h"
#include "wx/utils.h"
#include "wx/panel.h"
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/PushBG.h>
#include <Xm/PushB.h>
+#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
(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();
void wxButton::SetDefault()
{
wxWindow *parent = GetParent();
- wxPanel *panel = wxDynamicCast(panel, wxPanel);
- if ( panel )
- panel->SetDefaultItem(this);
+ if ( parent )
+ parent->SetDefaultItem(this);
// We initially do not set XmNdefaultShadowThickness, to have small buttons.
// Unfortunately, buttons are now mis-aligned. We try to correct this
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);