/////////////////////////////////////////////////////////////////////////////
-// Name: button.cpp
+// Name: src/motif/button.cpp
// Purpose: wxButton
// Author: Julian Smart
// Modified by:
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#ifdef __VMS
-#define XtDisplay XTDISPLAY
-#endif
-
-#include "wx/defs.h"
-
#include "wx/button.h"
#ifdef __VMS__
#pragma message enable nosimpint
#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/toplevel.h"
+#endif
+
#include "wx/stockitem.h"
#include "wx/motif/private.h"
#include "wx/sysopt.h"
void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr);
-IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
-
#define MIN_WIDTH 78
#define MIN_LARGE_HEIGHT 30
wxString label(lbl);
if (label.empty() && wxIsStockID(id))
label = wxGetStockLabel(id);
-
+
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
return false;
+ PreCreation();
- wxString label1(wxStripMenuCodes(label));
- wxXmString text( label1 );
+ wxXmString text( GetLabelText(label) );
Widget parentWidget = (Widget) parent->GetClientWidget();
XmNlabelString, text(),
XmNrecomputeSize, False,
// See comment for wxButton::SetDefault
- // XmNdefaultButtonShadowThickness, 1,
+ // XmNdefaultButtonShadowThickness, 1,
NULL);
XtAddCallback ((Widget) m_mainWidget,
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
+ PostCreation();
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, best.x, best.y);
- ChangeBackgroundColour();
-
return true;
}
}
-void wxButton::SetDefault()
+wxWindow *wxButton::SetDefault()
{
- wxWindow *parent = GetParent();
- if ( parent )
- parent->SetDefaultItem(this);
+ wxWindow *oldDefault = wxButtonBase::SetDefault();
// We initially do not set XmNdefaultShadowThickness, to have
// small buttons. Unfortunately, buttons are now mis-aligned. We
// wxButton in the same row, correction is straighforward: we set
// resource for all wxButton in this parent (but not sub panels)
+ wxWindow *parent = GetParent();
for (wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst ();
node; node = node->GetNext ())
{
XtVaSetValues ((Widget) parent->GetMainWidget(),
XmNdefaultButton, (Widget) GetMainWidget(),
NULL);
+
+ return oldDefault;
}
static inline bool wxMotifLargeButtons()
return;
wxButton *item = (wxButton *) clientData;
- wxCommandEvent event (wxEVT_COMMAND_BUTTON_CLICKED, item->GetId());
+ wxCommandEvent event (wxEVT_BUTTON, item->GetId());
event.SetEventObject(item);
item->ProcessCommand (event);
}