]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
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 | ||
519cb848 SC |
23 | #include <wx/mac/uma.h> |
24 | ||
e9576ca5 SC |
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 | { | |
519cb848 SC |
32 | Rect bounds ; |
33 | Str255 title ; | |
34 | ||
35 | MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; | |
e9576ca5 | 36 | |
519cb848 SC |
37 | m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, |
38 | kControlCheckBoxProc , (long) this ) ; | |
39 | ||
40 | MacPostControlCreate() ; | |
e9576ca5 | 41 | |
519cb848 | 42 | return TRUE; |
e9576ca5 SC |
43 | } |
44 | ||
45 | void wxCheckBox::SetValue(bool val) | |
46 | { | |
519cb848 | 47 | ::SetControlValue( m_macControl , val ) ; |
e9576ca5 SC |
48 | } |
49 | ||
50 | bool wxCheckBox::GetValue() const | |
51 | { | |
519cb848 | 52 | return ::GetControlValue( m_macControl ) ; |
e9576ca5 SC |
53 | } |
54 | ||
55 | void wxCheckBox::Command (wxCommandEvent & event) | |
56 | { | |
57 | SetValue ((event.GetInt() != 0)); | |
58 | ProcessCommand (event); | |
59 | } | |
60 | ||
519cb848 SC |
61 | void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) |
62 | { | |
63 | SetValue( !GetValue() ) ; | |
64 | } | |
65 | ||
e9576ca5 SC |
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 | { | |
519cb848 | 96 | wxControl::SetSize( x , y , width , height , sizeFlags ) ; |
e9576ca5 SC |
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 |