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