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( MAC_WXHWND(parent
->MacGetRootWindow()) , &bounds
, title
, false , 0 , 0 , 1,
40 kControlCheckBoxProc
, (long) this ) ;
42 MacPostControlCreate() ;
47 void wxCheckBox::SetValue(bool val
)
49 ::SetControlValue( (ControlHandle
) m_macControl
, val
) ;
53 bool wxCheckBox::GetValue() const
55 return ::GetControlValue( (ControlHandle
) m_macControl
) ;
58 void wxCheckBox::Command (wxCommandEvent
& event
)
60 SetValue ((event
.GetInt() != 0));
61 ProcessCommand (event
);
64 void wxCheckBox::MacHandleControlClick( WXWidget
WXUNUSED(control
), wxInt16
WXUNUSED(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
,
75 const wxBitmap
*label
,
77 const wxSize
& size
, long style
,
78 const wxValidator
& validator
,
82 SetValidator(validator
);
83 m_windowStyle
= style
;
85 if (parent
) parent
->AddChild(this);
88 m_windowId
= NewControlId();
92 // TODO: Create the bitmap checkbox
97 void wxBitmapCheckBox::SetLabel(const wxBitmap
*bitmap
)
102 void wxBitmapCheckBox::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
104 wxControl::SetSize( x
, y
, width
, height
, sizeFlags
) ;
107 void wxBitmapCheckBox::SetValue(bool val
)
112 bool wxBitmapCheckBox::GetValue() const