]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/checkbox.cpp
commented section removed
[wxWidgets.git] / src / mac / carbon / checkbox.cpp
... / ...
CommitLineData
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
21IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
22IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
23#endif
24
25#include "wx/mac/uma.h"
26
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{
34 if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) )
35 return false;
36
37 Rect bounds ;
38 Str255 title ;
39
40 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
41
42 m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
43 kControlCheckBoxProc , (long) this ) ;
44
45 MacPostControlCreate() ;
46
47 return TRUE;
48}
49
50void wxCheckBox::SetValue(bool val)
51{
52 ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ;
53 MacRedrawControl() ;
54}
55
56bool wxCheckBox::GetValue() const
57{
58 return ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
59}
60
61void wxCheckBox::Command (wxCommandEvent & event)
62{
63 SetValue ((event.GetInt() != 0));
64 ProcessCommand (event);
65}
66
67void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) )
68{
69 SetValue( !GetValue() ) ;
70 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
71 event.SetInt(GetValue());
72 event.SetEventObject(this);
73 ProcessCommand(event);
74}
75
76// Bitmap checkbox
77bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id,
78 const wxBitmap *label,
79 const wxPoint& pos,
80 const wxSize& size, long style,
81 const wxValidator& validator,
82 const wxString& name)
83{
84 SetName(name);
85 SetValidator(validator);
86 m_windowStyle = style;
87
88 if (parent) parent->AddChild(this);
89
90 if ( id == -1 )
91 m_windowId = NewControlId();
92 else
93 m_windowId = id;
94
95 // TODO: Create the bitmap checkbox
96
97 return FALSE;
98}
99
100void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
101{
102 // TODO
103 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented"));
104}
105
106void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
107{
108 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
109}
110
111void wxBitmapCheckBox::SetValue(bool val)
112{
113 // TODO
114 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented"));
115}
116
117bool wxBitmapCheckBox::GetValue() const
118{
119 // TODO
120 wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented"));
121 return FALSE;
122}
123
124