]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: checkbox.cpp | |
3 | // Purpose: wxCheckBox | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
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( MAC_WXHWND(parent->MacGetRootWindow()) , &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 | ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ; | |
50 | MacRedrawControl() ; | |
51 | } | |
52 | ||
53 | bool wxCheckBox::GetValue() const | |
54 | { | |
55 | return ::GetControl32BitValue( (ControlHandle) m_macControl ) ; | |
56 | } | |
57 | ||
58 | void wxCheckBox::Command (wxCommandEvent & event) | |
59 | { | |
60 | SetValue ((event.GetInt() != 0)); | |
61 | ProcessCommand (event); | |
62 | } | |
63 | ||
64 | void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) ) | |
65 | { | |
66 | SetValue( !GetValue() ) ; | |
67 | wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId ); | |
68 | event.SetInt(GetValue()); | |
69 | event.SetEventObject(this); | |
70 | ProcessCommand(event); | |
71 | } | |
72 | ||
73 | // Bitmap checkbox | |
74 | bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, | |
75 | const wxBitmap *label, | |
76 | const wxPoint& pos, | |
77 | const wxSize& size, long style, | |
78 | const wxValidator& validator, | |
79 | const wxString& name) | |
80 | { | |
81 | SetName(name); | |
82 | SetValidator(validator); | |
83 | m_windowStyle = style; | |
84 | ||
85 | if (parent) parent->AddChild(this); | |
86 | ||
87 | if ( id == -1 ) | |
88 | m_windowId = NewControlId(); | |
89 | else | |
90 | m_windowId = id; | |
91 | ||
92 | // TODO: Create the bitmap checkbox | |
93 | ||
94 | return FALSE; | |
95 | } | |
96 | ||
97 | void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap) | |
98 | { | |
99 | // TODO | |
100 | wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented")); | |
101 | } | |
102 | ||
103 | void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags) | |
104 | { | |
105 | wxControl::SetSize( x , y , width , height , sizeFlags ) ; | |
106 | } | |
107 | ||
108 | void wxBitmapCheckBox::SetValue(bool val) | |
109 | { | |
110 | // TODO | |
111 | wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented")); | |
112 | } | |
113 | ||
114 | bool wxBitmapCheckBox::GetValue() const | |
115 | { | |
116 | // TODO | |
117 | wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented")); | |
118 | return FALSE; | |
119 | } | |
120 | ||
121 |