2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: checkbox.h
|
|
|
|
// Purpose: documentation for wxCheckBox class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCheckBox
|
|
|
|
@wxheader{checkbox.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A checkbox is a labelled box which by default is either on (checkmark is
|
|
|
|
visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style flag
|
|
|
|
is set) it can have a third state, called the mixed or undetermined state.
|
|
|
|
Often this is used as a "Does Not Apply" state.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxCHK_2STATE}:
|
|
|
|
Create a 2-state checkbox. This is the default.
|
|
|
|
@style{wxCHK_3STATE}:
|
|
|
|
Create a 3-state checkbox. Not implemented in wxMGL, wxOS2 and
|
|
|
|
wxGTK built against GTK+ 1.2.
|
|
|
|
@style{wxCHK_ALLOW_3RD_STATE_FOR_USER}:
|
|
|
|
By default a user can't set a 3-state checkbox to the third state.
|
|
|
|
It can only be done from code. Using this flags allows the user to
|
|
|
|
set the checkbox to the third state by clicking.
|
|
|
|
@style{wxALIGN_RIGHT}:
|
|
|
|
Makes the text appear on the left of the checkbox.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginEventTable
|
2008-03-09 08:33:59 -04:00
|
|
|
@event{EVT_CHECKBOX(id, func)}:
|
2008-03-08 08:52:38 -05:00
|
|
|
Process a wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
|
|
|
|
is clicked.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
|
|
|
@appearance{checkbox.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@seealso
|
|
|
|
wxRadioButton, wxCommandEvent
|
|
|
|
*/
|
|
|
|
class wxCheckBox : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a checkbox.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Checkbox identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
Text to be displayed next to the checkbox.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Checkbox position. If wxDefaultPosition is specified then a default
|
2008-03-08 08:52:38 -05:00
|
|
|
position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Checkbox size. If wxDefaultSize is specified then a default
|
|
|
|
size is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxCheckBox.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Window validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxCheckBox();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxCheckBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& val,
|
|
|
|
const wxString& name = "checkBox");
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the checkbox.
|
|
|
|
*/
|
|
|
|
~wxCheckBox();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the checkbox for two-step construction. See wxCheckBox()
|
|
|
|
for details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& val,
|
|
|
|
const wxString& name = "checkBox");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the state of a 3-state checkbox.
|
|
|
|
|
|
|
|
@returns Returns wxCHK_UNCHECKED when the checkbox is unchecked,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxCHK_CHECKED when it is checked and
|
|
|
|
wxCHK_UNDETERMINED when it's in the undetermined state.
|
|
|
|
Asserts when the function is used with a 2-state
|
|
|
|
checkbox.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxCheckBoxState Get3StateValue();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the state of a 2-state checkbox.
|
|
|
|
|
|
|
|
@returns Returns @true if it is checked, @false otherwise.
|
|
|
|
*/
|
|
|
|
bool GetValue();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns whether or not the checkbox is a 3-state checkbox.
|
|
|
|
|
|
|
|
@returns Returns @true if this checkbox is a 3-state checkbox, @false if
|
2008-03-09 08:33:59 -04:00
|
|
|
it's a 2-state checkbox.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Is3State();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns whether or not the user can set the checkbox to the third state.
|
|
|
|
|
|
|
|
@returns Returns @true if the user can set the third state of this
|
2008-03-09 08:33:59 -04:00
|
|
|
checkbox, @false if it can only be set programmatically
|
|
|
|
or if it's a 2-state checkbox.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Is3rdStateAllowedForUser();
|
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
This is just a maybe more readable synonym for
|
|
|
|
GetValue(): just as the latter, it returns
|
2008-03-08 08:52:38 -05:00
|
|
|
@true if the checkbox is checked and @false otherwise.
|
|
|
|
*/
|
|
|
|
bool IsChecked();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the checkbox to the given state. This does not cause a
|
|
|
|
wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param state
|
2008-03-09 08:33:59 -04:00
|
|
|
If @true, the check is on, otherwise it is off.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetValue(bool state);
|
|
|
|
};
|