]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/checkbox.cpp
a base for geometry operations
[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 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
19 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
20
21 #include <wx/mac/uma.h>
22
23 // Single check box item
24 bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
25 const wxPoint& pos,
26 const wxSize& size, long style,
27 const wxValidator& validator,
28 const wxString& name)
29 {
30 Rect bounds ;
31 Str255 title ;
32
33 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
34
35 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
36 kControlCheckBoxProc , (long) this ) ;
37
38 MacPostControlCreate() ;
39
40 return TRUE;
41 }
42
43 void wxCheckBox::SetValue(bool val)
44 {
45 ::SetControlValue( m_macControl , val ) ;
46 }
47
48 bool wxCheckBox::GetValue() const
49 {
50 return ::GetControlValue( m_macControl ) ;
51 }
52
53 void wxCheckBox::Command (wxCommandEvent & event)
54 {
55 SetValue ((event.GetInt() != 0));
56 ProcessCommand (event);
57 }
58
59 void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
60 {
61 SetValue( !GetValue() ) ;
62 }
63
64 // Bitmap checkbox
65 bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
66 const wxPoint& pos,
67 const wxSize& size, long style,
68 const wxValidator& validator,
69 const wxString& name)
70 {
71 SetName(name);
72 SetValidator(validator);
73 m_windowStyle = style;
74
75 if (parent) parent->AddChild(this);
76
77 if ( id == -1 )
78 m_windowId = NewControlId();
79 else
80 m_windowId = id;
81
82 // TODO: Create the bitmap checkbox
83
84 return FALSE;
85 }
86
87 void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
88 {
89 // TODO
90 }
91
92 void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
93 {
94 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
95 }
96
97 void wxBitmapCheckBox::SetValue(bool val)
98 {
99 // TODO
100 }
101
102 bool wxBitmapCheckBox::GetValue() const
103 {
104 // TODOD
105 return FALSE;
106 }
107
108