]> git.saurik.com Git - wxWidgets.git/blob - src/mac/checkbox.cpp
virtualized m_row/col height/widths arrays
[wxWidgets.git] / src / mac / 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 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
63 event.SetInt(GetValue());
64 event.SetEventObject(this);
65 ProcessCommand(event);
66 }
67
68 // Bitmap checkbox
69 bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
70 const wxPoint& pos,
71 const wxSize& size, long style,
72 const wxValidator& validator,
73 const wxString& name)
74 {
75 SetName(name);
76 SetValidator(validator);
77 m_windowStyle = style;
78
79 if (parent) parent->AddChild(this);
80
81 if ( id == -1 )
82 m_windowId = NewControlId();
83 else
84 m_windowId = id;
85
86 // TODO: Create the bitmap checkbox
87
88 return FALSE;
89 }
90
91 void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
92 {
93 // TODO
94 }
95
96 void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
97 {
98 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
99 }
100
101 void wxBitmapCheckBox::SetValue(bool val)
102 {
103 // TODO
104 }
105
106 bool wxBitmapCheckBox::GetValue() const
107 {
108 // TODOD
109 return FALSE;
110 }
111
112