1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/checkbox.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - native implementation
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
29 #include "wx/checkbox.h"
33 #include "wx/dcscreen.h"
34 #include "wx/settings.h"
39 // ============================================================================
41 // ============================================================================
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 bool wxCheckBox::Create(wxWindow
*parent
,
49 const wxString
& label
,
51 const wxSize
& size
, long style
,
52 const wxValidator
& validator
,
55 if(!wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
))
58 m_state
= wxCHK_UNCHECKED
;
59 return wxControl::PalmCreateControl(checkboxCtl
, label
, pos
, size
);
62 wxSize
wxCheckBox::DoGetBestSize() const
67 void wxCheckBox::SetValue(bool val
)
72 bool wxCheckBox::GetValue() const
74 return GetBoolValue();
77 bool wxCheckBox::SendClickEvent()
79 wxCommandEvent
event(wxEVT_COMMAND_CHECKBOX_CLICKED
, GetId());
80 event
.SetInt(GetValue());
81 event
.SetEventObject(this);
82 return ProcessCommand(event
);
85 void wxCheckBox::Command(wxCommandEvent
& event
)
87 int state
= event
.GetInt();
88 wxCHECK_RET( (state
== wxCHK_UNCHECKED
) || (state
== wxCHK_CHECKED
)
89 || (state
== wxCHK_UNDETERMINED
),
90 wxT("event.GetInt() returned an invalid checkbox state") );
92 Set3StateValue((wxCheckBoxState
) state
);
93 ProcessCommand(event
);
96 void wxCheckBox::DoSet3StateValue(wxCheckBoxState state
)
99 ControlType
*control
= (ControlType
*)GetObjectPtr();
100 if(NULL
== control
) {
105 case wxCHK_UNCHECKED
:
111 case wxCHK_UNDETERMINED
:
116 CtlSetValue (control
, newValue
);
119 wxCheckBoxState
wxCheckBox::DoGet3StateValue() const
124 #endif // wxUSE_CHECKBOX