]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/checkbox.cpp
added Mark Newsam's patch
[wxWidgets.git] / src / mac / carbon / checkbox.cpp
CommitLineData
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
d8c736e5
GD
16#include "wx/defs.h"
17
e9576ca5
SC
18#include "wx/checkbox.h"
19
2f1ae414 20#if !USE_SHARED_LIBRARY
e9576ca5
SC
21IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
22IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
2f1ae414 23#endif
e9576ca5 24
d497dca4 25#include "wx/mac/uma.h"
519cb848 26
e9576ca5
SC
27// Single check box item
28bool 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{
519cb848
SC
34 Rect bounds ;
35 Str255 title ;
36
37 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 38
76a5e5d2 39 m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
519cb848
SC
40 kControlCheckBoxProc , (long) this ) ;
41
42 MacPostControlCreate() ;
e9576ca5 43
519cb848 44 return TRUE;
e9576ca5
SC
45}
46
47void wxCheckBox::SetValue(bool val)
48{
76a5e5d2 49 ::SetControlValue( (ControlHandle) m_macControl , val ) ;
73969f3f 50 MacRedrawControl() ;
e9576ca5
SC
51}
52
53bool wxCheckBox::GetValue() const
54{
76a5e5d2 55 return ::GetControlValue( (ControlHandle) m_macControl ) ;
e9576ca5
SC
56}
57
58void wxCheckBox::Command (wxCommandEvent & event)
59{
60 SetValue ((event.GetInt() != 0));
61 ProcessCommand (event);
62}
63
f2af4afb 64void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) )
519cb848
SC
65{
66 SetValue( !GetValue() ) ;
8208e181
SC
67 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
68 event.SetInt(GetValue());
69 event.SetEventObject(this);
70 ProcessCommand(event);
519cb848
SC
71}
72
e9576ca5 73// Bitmap checkbox
f2af4afb
GD
74bool 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)
e9576ca5
SC
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
97void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
98{
99 // TODO
0c32c930 100 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented"));
e9576ca5
SC
101}
102
103void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
104{
519cb848 105 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
e9576ca5
SC
106}
107
108void wxBitmapCheckBox::SetValue(bool val)
109{
110 // TODO
0c32c930 111 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented"));
e9576ca5
SC
112}
113
114bool wxBitmapCheckBox::GetValue() const
115{
0c32c930
GD
116 // TODO
117 wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented"));
e9576ca5
SC
118 return FALSE;
119}
120
121