]> git.saurik.com Git - wxWidgets.git/blame - src/mac/checkbox.cpp
Copied/merged from the 2.2 branch.
[wxWidgets.git] / src / mac / 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
16#include "wx/checkbox.h"
17
2f1ae414 18#if !USE_SHARED_LIBRARY
e9576ca5
SC
19IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
20IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
2f1ae414 21#endif
e9576ca5 22
519cb848
SC
23#include <wx/mac/uma.h>
24
e9576ca5
SC
25// Single check box item
26bool 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
45void wxCheckBox::SetValue(bool val)
46{
519cb848 47 ::SetControlValue( m_macControl , val ) ;
e9576ca5
SC
48}
49
50bool wxCheckBox::GetValue() const
51{
519cb848 52 return ::GetControlValue( m_macControl ) ;
e9576ca5
SC
53}
54
55void wxCheckBox::Command (wxCommandEvent & event)
56{
57 SetValue ((event.GetInt() != 0));
58 ProcessCommand (event);
59}
60
519cb848
SC
61void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
62{
63 SetValue( !GetValue() ) ;
8208e181
SC
64 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
65 event.SetInt(GetValue());
66 event.SetEventObject(this);
67 ProcessCommand(event);
519cb848
SC
68}
69
e9576ca5
SC
70// Bitmap checkbox
71bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
72 const wxPoint& pos,
73 const wxSize& size, long style,
74 const wxValidator& validator,
75 const wxString& name)
76{
77 SetName(name);
78 SetValidator(validator);
79 m_windowStyle = style;
80
81 if (parent) parent->AddChild(this);
82
83 if ( id == -1 )
84 m_windowId = NewControlId();
85 else
86 m_windowId = id;
87
88 // TODO: Create the bitmap checkbox
89
90 return FALSE;
91}
92
93void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
94{
95 // TODO
96}
97
98void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
99{
519cb848 100 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
e9576ca5
SC
101}
102
103void wxBitmapCheckBox::SetValue(bool val)
104{
105 // TODO
106}
107
108bool wxBitmapCheckBox::GetValue() const
109{
110 // TODOD
111 return FALSE;
112}
113
114