]> git.saurik.com Git - wxWidgets.git/blame - src/mac/button.cpp
usleep() prototype added for solaris
[wxWidgets.git] / src / mac / button.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: button.cpp
3// Purpose: wxButton
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "button.h"
14#endif
15
16#include "wx/button.h"
17
18#if !USE_SHARED_LIBRARY
19IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
20#endif
21
519cb848 22#include <wx/mac/uma.h>
e9576ca5
SC
23// Button
24
519cb848 25
e9576ca5
SC
26bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
27 const wxPoint& pos,
28 const wxSize& size, long style,
29 const wxValidator& validator,
30 const wxString& name)
31{
519cb848
SC
32 Rect bounds ;
33 Str255 title ;
34 m_macHorizontalBorder = 2 ; // additional pixels around the real control
35 m_macVerticalBorder = 2 ;
36
37 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
38
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" ) ;
42
43 MacPostControlCreate() ;
44
45 return TRUE;
e9576ca5
SC
46}
47
48void wxButton::SetDefault()
49{
519cb848
SC
50 wxWindow *parent = (wxWindow *)GetParent();
51 if (parent)
52 parent->SetDefaultItem(this);
53
54 if ( m_macControl )
55 {
56 UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
57 }
e9576ca5
SC
58}
59
519cb848 60void wxButton::Command (wxCommandEvent & event)
e9576ca5 61{
519cb848 62 ProcessCommand (event);
e9576ca5
SC
63}
64
519cb848 65void wxButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
e9576ca5 66{
519cb848
SC
67 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
68 event.SetEventObject(this);
69 ProcessCommand(event);
e9576ca5
SC
70}
71