1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "checkbox.h"
18 #include "wx/checkbox.h"
20 #if !USE_SHARED_LIBRARY
21 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox
, wxControl
)
22 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox
, wxCheckBox
)
25 #include "wx/mac/uma.h"
27 // Single check box item
28 bool wxCheckBox::Create(wxWindow
*parent
, wxWindowID id
, const wxString
& label
,
30 const wxSize
& size
, long style
,
31 const wxValidator
& validator
,
37 MacPreControlCreate( parent
, id
, label
, pos
, size
,style
, validator
, name
, &bounds
, title
) ;
39 m_macControl
= ::NewControl( parent
->MacGetRootWindow() , &bounds
, title
, false , 0 , 0 , 1,
40 kControlCheckBoxProc
, (long) this ) ;
42 MacPostControlCreate() ;
47 void wxCheckBox::SetValue(bool val
)
49 ::SetControlValue( m_macControl
, val
) ;
53 bool wxCheckBox::GetValue() const
55 return ::GetControlValue( m_macControl
) ;
58 void wxCheckBox::Command (wxCommandEvent
& event
)
60 SetValue ((event
.GetInt() != 0));
61 ProcessCommand (event
);
64 void wxCheckBox::MacHandleControlClick( ControlHandle control
, SInt16 controlpart
)
66 SetValue( !GetValue() ) ;
67 wxCommandEvent
event(wxEVT_COMMAND_CHECKBOX_CLICKED
, m_windowId
);
68 event
.SetInt(GetValue());
69 event
.SetEventObject(this);
70 ProcessCommand(event
);
74 bool wxBitmapCheckBox::Create(wxWindow
*parent
, wxWindowID id
, const wxBitmap
*label
,
76 const wxSize
& size
, long style
,
77 const wxValidator
& validator
,
81 SetValidator(validator
);
82 m_windowStyle
= style
;
84 if (parent
) parent
->AddChild(this);
87 m_windowId
= NewControlId();
91 // TODO: Create the bitmap checkbox
96 void wxBitmapCheckBox::SetLabel(const wxBitmap
*bitmap
)
101 void wxBitmapCheckBox::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
103 wxControl::SetSize( x
, y
, width
, height
, sizeFlags
) ;
106 void wxBitmapCheckBox::SetValue(bool val
)
111 bool wxBitmapCheckBox::GetValue() const