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