]>
git.saurik.com Git - wxWidgets.git/blob - interface/checkbox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxCheckBox
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 The possible states of a 3-state wxCheckBox (Compatible with the 2-state
17 wxCHK_UNDETERMINED
///< 3-state checkbox only
24 A checkbox is a labelled box which by default is either on (checkmark is
25 visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style
26 flag is set) it can have a third state, called the mixed or undetermined
27 state. Often this is used as a "Does Not Apply" state.
31 Create a 2-state checkbox. This is the default.
33 Create a 3-state checkbox. Not implemented in wxMGL, wxOS2 and
34 wxGTK built against GTK+ 1.2.
35 @style{wxCHK_ALLOW_3RD_STATE_FOR_USER}
36 By default a user can't set a 3-state checkbox to the third state.
37 It can only be done from code. Using this flags allows the user to
38 set the checkbox to the third state by clicking.
40 Makes the text appear on the left of the checkbox.
43 @beginEventTable{wxCommandEvent}
44 @event{EVT_CHECKBOX(id, func)}
45 Process a wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
51 <!-- @appearance{checkbox.png} -->
53 @see wxRadioButton, wxCommandEvent
55 class wxCheckBox
: public wxControl
61 @see Create(), wxValidator
66 Constructor, creating and showing a checkbox.
69 Parent window. Must not be @NULL.
71 Checkbox identifier. The value wxID_ANY indicates a default value.
73 Text to be displayed next to the checkbox.
75 Checkbox position. If wxDefaultPosition is specified then a default
78 Checkbox size. If wxDefaultSize is specified then a default size is
81 Window style. See wxCheckBox.
87 @see Create(), wxValidator
89 wxCheckBox(wxWindow
* parent
, wxWindowID id
,
90 const wxString
& label
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
94 const wxValidator
& val
= wxDefaultValidator
,
95 const wxString
& name
= "checkBox");
98 Destructor, destroying the checkbox.
103 Creates the checkbox for two-step construction. See wxCheckBox()
106 bool Create(wxWindow
* parent
, wxWindowID id
,
107 const wxString
& label
,
108 const wxPoint
& pos
= wxDefaultPosition
,
109 const wxSize
& size
= wxDefaultSize
,
111 const wxValidator
& val
= wxDefaultValidator
,
112 const wxString
& name
= "checkBox");
115 Gets the state of a 2-state checkbox.
117 @return Returns @true if it is checked, @false otherwise.
119 bool GetValue() const;
122 Gets the state of a 3-state checkbox. Asserts when the function is used
123 with a 2-state checkbox.
125 wxCheckBoxState
Get3StateValue() const;
128 Returns whether or not the checkbox is a 3-state checkbox.
130 @return @true if this checkbox is a 3-state checkbox, @false if it's
133 bool Is3State() const;
136 Returns whether or not the user can set the checkbox to the third
139 @return @true if the user can set the third state of this checkbox,
140 @false if it can only be set programmatically or if it's a
143 bool Is3rdStateAllowedForUser() const;
146 This is just a maybe more readable synonym for GetValue(): just as the
147 latter, it returns @true if the checkbox is checked and @false
150 bool IsChecked() const;
153 Sets the checkbox to the given state. This does not cause a
154 wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
157 If @true, the check is on, otherwise it is off.
159 void SetValue(bool state
);
162 Sets the checkbox to the given state. This does not cause a
163 wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
165 Asserts when the checkbox is a 2-state checkbox and setting the state
166 to wxCHK_UNDETERMINED.
168 void Set3StateValue(const wxCheckBoxState state
);