]> git.saurik.com Git - wxWidgets.git/blame - src/mac/checkbox.cpp
implemented IsModified() and DiscardEdits()
[wxWidgets.git] / src / mac / checkbox.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: checkbox.cpp
3// Purpose: wxCheckBox
a31a5f85 4// Author: Stefan Csomor
e9576ca5
SC
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
e40298d5 9// Licence: wxWindows licence
e9576ca5
SC
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{
b45ed7a2
VZ
34 if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) )
35 return false;
36
e40298d5
JS
37 Rect bounds ;
38 Str255 title ;
39
40 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 41
e40298d5
JS
42 m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
43 kControlCheckBoxProc , (long) this ) ;
44
45 MacPostControlCreate() ;
e9576ca5 46
519cb848 47 return TRUE;
e9576ca5
SC
48}
49
50void wxCheckBox::SetValue(bool val)
51{
467e3168 52 ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ;
73969f3f 53 MacRedrawControl() ;
e9576ca5
SC
54}
55
56bool wxCheckBox::GetValue() const
57{
467e3168 58 return ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
e9576ca5
SC
59}
60
61void wxCheckBox::Command (wxCommandEvent & event)
62{
63 SetValue ((event.GetInt() != 0));
64 ProcessCommand (event);
65}
66
4b26b60f 67void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) )
519cb848 68{
e40298d5 69 SetValue( !GetValue() ) ;
8208e181
SC
70 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
71 event.SetInt(GetValue());
72 event.SetEventObject(this);
73 ProcessCommand(event);
519cb848
SC
74}
75
e9576ca5 76// Bitmap checkbox
f2af4afb
GD
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)
e9576ca5
SC
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
0c32c930 103 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented"));
e9576ca5
SC
104}
105
106void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
107{
519cb848 108 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
e9576ca5
SC
109}
110
111void wxBitmapCheckBox::SetValue(bool val)
112{
113 // TODO
0c32c930 114 wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented"));
e9576ca5
SC
115}
116
117bool wxBitmapCheckBox::GetValue() const
118{
0c32c930
GD
119 // TODO
120 wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented"));
e9576ca5
SC
121 return FALSE;
122}
123
124