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