]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/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
23 A checkbox is a labelled box which by default is either on (checkmark is
24 visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style
25 flag is set) it can have a third state, called the mixed or undetermined
26 state. Often this is used as a "Does Not Apply" state.
30 Create a 2-state checkbox. This is the default.
32 Create a 3-state checkbox. Not implemented in wxMGL, wxOS2 and
33 wxGTK built against GTK+ 1.2.
34 @style{wxCHK_ALLOW_3RD_STATE_FOR_USER}
35 By default a user can't set a 3-state checkbox to the third state.
36 It can only be done from code. Using this flags allows the user to
37 set the checkbox to the third state by clicking.
39 Makes the text appear on the left of the checkbox.
42 @beginEventTable{wxCommandEvent}
43 @event{EVT_CHECKBOX(id, func)}
44 Process a wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
50 <!-- @appearance{checkbox.png} -->
52 @see wxRadioButton, wxCommandEvent
54 class wxCheckBox
: public wxControl
60 @see Create(), wxValidator
65 Constructor, creating and showing a checkbox.
68 Parent window. Must not be @NULL.
70 Checkbox identifier. The value wxID_ANY indicates a default value.
72 Text to be displayed next to the checkbox.
74 Checkbox position. If wxDefaultPosition is specified then a default
77 Checkbox size. If wxDefaultSize is specified then a default size is
80 Window style. See wxCheckBox.
86 @see Create(), wxValidator
88 wxCheckBox(wxWindow
* parent
, wxWindowID id
,
89 const wxString
& label
,
90 const wxPoint
& pos
= wxDefaultPosition
,
91 const wxSize
& size
= wxDefaultSize
,
93 const wxValidator
& val
= wxDefaultValidator
,
94 const wxString
& name
= "checkBox");
97 Destructor, destroying the checkbox.
102 Creates the checkbox for two-step construction. See wxCheckBox()
105 bool Create(wxWindow
* parent
, wxWindowID id
,
106 const wxString
& label
,
107 const wxPoint
& pos
= wxDefaultPosition
,
108 const wxSize
& size
= wxDefaultSize
,
110 const wxValidator
& val
= wxDefaultValidator
,
111 const wxString
& name
= "checkBox");
114 Gets the state of a 2-state checkbox.
116 @return Returns @true if it is checked, @false otherwise.
118 bool GetValue() const;
121 Gets the state of a 3-state checkbox. Asserts when the function is used
122 with a 2-state checkbox.
124 wxCheckBoxState
Get3StateValue() const;
127 Returns whether or not the checkbox is a 3-state checkbox.
129 @return @true if this checkbox is a 3-state checkbox, @false if it's
132 bool Is3State() const;
135 Returns whether or not the user can set the checkbox to the third
138 @return @true if the user can set the third state of this checkbox,
139 @false if it can only be set programmatically or if it's a
142 bool Is3rdStateAllowedForUser() const;
145 This is just a maybe more readable synonym for GetValue(): just as the
146 latter, it returns @true if the checkbox is checked and @false
149 bool IsChecked() const;
152 Sets the checkbox to the given state. This does not cause a
153 wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
156 If @true, the check is on, otherwise it is off.
158 void SetValue(bool state
);
161 Sets the checkbox to the given state. This does not cause a
162 wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
164 Asserts when the checkbox is a 2-state checkbox and setting the state
165 to wxCHK_UNDETERMINED.
167 void Set3StateValue(const wxCheckBoxState state
);