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