1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "button.h"
16 #include "wx/button.h"
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxButton
, wxControl
)
22 #include <wx/mac/uma.h>
26 bool wxButton::Create(wxWindow
*parent
, wxWindowID id
, const wxString
& label
,
28 const wxSize
& size
, long style
,
29 const wxValidator
& validator
,
34 m_macHorizontalBorder
= 2 ; // additional pixels around the real control
35 m_macVerticalBorder
= 2 ;
37 MacPreControlCreate( parent
, id
, label
, pos
, size
,style
, validator
, name
, &bounds
, title
) ;
39 m_macControl
= UMANewControl( parent
->GetMacRootWindow() , &bounds
, title
, true , 0 , 0 , 1,
40 kControlPushButtonProc
, (long) this ) ;
41 wxASSERT_MSG( m_macControl
!= NULL
, "No valid mac control" ) ;
43 MacPostControlCreate() ;
48 void wxButton::SetDefault()
50 wxWindow
*parent
= (wxWindow
*)GetParent();
52 parent
->SetDefaultItem(this);
56 UMASetControlData( m_macControl
, kControlButtonPart
, kControlPushButtonDefaultTag
, sizeof( Boolean
) , (char*)((Boolean
)1) ) ;
60 void wxButton::Command (wxCommandEvent
& event
)
62 ProcessCommand (event
);
65 void wxButton::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
67 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, m_windowId
);
68 event
.SetEventObject(this);
69 ProcessCommand(event
);