]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/checkbox.cpp
adapted to mac
[wxWidgets.git] / src / mac / carbon / checkbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: checkbox.cpp
3 // Purpose: wxCheckBox
4 // Author: AUTHOR
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "checkbox.h"
14 #endif
15
16 #include "wx/checkbox.h"
17
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
20 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
21 #endif
22
23 #include <wx/mac/uma.h>
24
25 // Single check box item
26 bool wxCheckBox::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 {
32 Rect bounds ;
33 Str255 title ;
34
35 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
36
37 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
38 kControlCheckBoxProc , (long) this ) ;
39
40 MacPostControlCreate() ;
41
42 return TRUE;
43 }
44
45 void wxCheckBox::SetValue(bool val)
46 {
47 ::SetControlValue( m_macControl , val ) ;
48 }
49
50 bool wxCheckBox::GetValue() const
51 {
52 return ::GetControlValue( m_macControl ) ;
53 }
54
55 void wxCheckBox::Command (wxCommandEvent & event)
56 {
57 SetValue ((event.GetInt() != 0));
58 ProcessCommand (event);
59 }
60
61 void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
62 {
63 SetValue( !GetValue() ) ;
64 }
65
66 // Bitmap checkbox
67 bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
68 const wxPoint& pos,
69 const wxSize& size, long style,
70 const wxValidator& validator,
71 const wxString& name)
72 {
73 SetName(name);
74 SetValidator(validator);
75 m_windowStyle = style;
76
77 if (parent) parent->AddChild(this);
78
79 if ( id == -1 )
80 m_windowId = NewControlId();
81 else
82 m_windowId = id;
83
84 // TODO: Create the bitmap checkbox
85
86 return FALSE;
87 }
88
89 void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
90 {
91 // TODO
92 }
93
94 void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
95 {
96 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
97 }
98
99 void wxBitmapCheckBox::SetValue(bool val)
100 {
101 // TODO
102 }
103
104 bool wxBitmapCheckBox::GetValue() const
105 {
106 // TODOD
107 return FALSE;
108 }
109
110