]> git.saurik.com Git - wxWidgets.git/blame - src/mac/checkbox.cpp
Changed order of #ifdefs to get native version on OS/2, even if
[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
e9576ca5
SC
18IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
19IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
e9576ca5 20
519cb848
SC
21#include <wx/mac/uma.h>
22
e9576ca5
SC
23// Single check box item
24bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
25 const wxPoint& pos,
26 const wxSize& size, long style,
27 const wxValidator& validator,
28 const wxString& name)
29{
519cb848
SC
30 Rect bounds ;
31 Str255 title ;
32
33 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 34
519cb848
SC
35 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
36 kControlCheckBoxProc , (long) this ) ;
37
38 MacPostControlCreate() ;
e9576ca5 39
519cb848 40 return TRUE;
e9576ca5
SC
41}
42
43void wxCheckBox::SetValue(bool val)
44{
519cb848 45 ::SetControlValue( m_macControl , val ) ;
e9576ca5
SC
46}
47
48bool wxCheckBox::GetValue() const
49{
519cb848 50 return ::GetControlValue( m_macControl ) ;
e9576ca5
SC
51}
52
53void wxCheckBox::Command (wxCommandEvent & event)
54{
55 SetValue ((event.GetInt() != 0));
56 ProcessCommand (event);
57}
58
519cb848
SC
59void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
60{
61 SetValue( !GetValue() ) ;
8208e181
SC
62 wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
63 event.SetInt(GetValue());
64 event.SetEventObject(this);
65 ProcessCommand(event);
519cb848
SC
66}
67
e9576ca5
SC
68// Bitmap checkbox
69bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
70 const wxPoint& pos,
71 const wxSize& size, long style,
72 const wxValidator& validator,
73 const wxString& name)
74{
75 SetName(name);
76 SetValidator(validator);
77 m_windowStyle = style;
78
79 if (parent) parent->AddChild(this);
80
81 if ( id == -1 )
82 m_windowId = NewControlId();
83 else
84 m_windowId = id;
85
86 // TODO: Create the bitmap checkbox
87
88 return FALSE;
89}
90
91void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
92{
93 // TODO
94}
95
96void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
97{
519cb848 98 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
e9576ca5
SC
99}
100
101void wxBitmapCheckBox::SetValue(bool val)
102{
103 // TODO
104}
105
106bool wxBitmapCheckBox::GetValue() const
107{
108 // TODOD
109 return FALSE;
110}
111
112