xref: /haiku/docs/user/interface/CheckBox.dox (revision 204dee708a999d5a71d0cb9497650ee7cef85d0a)
1/*
2 * Copyright 2011 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan Aßmus, superstippi@gmx.de
7 *		Marc Flerackers, mflerackers@androme.be
8 *		John Scipione, jscipione@gmail.com
9 *
10 * Corresponds to:
11 *		headers/os/interface/CheckBox.h	 rev 42794
12 *		src/kits/interface/CheckBox.cpp	 rev 42794
13 */
14
15
16/*!
17	\file CheckBox.h
18	\ingroup interface
19	\ingroup libbe
20	\brief Defines the BCheckBox class
21*/
22
23
24/*!
25	\class BCheckBox
26	\ingroup interface
27	\ingroup libbe
28	\brief BCheckBox is a user interface element used to make a binary
29		decision.
30
31	A BCheckBox object is used to draw a checkbox element. This simple control
32	has 2 states, \c B_CONTROL_OFF when the checkbox is unchecked and
33	\c B_CONTROL_ON when the checkbox is checked. A checkbox can also have a
34	descriptive label drawn to the right of the checkbox.
35
36	When the checkbox is checked it has an X drawn inside of it. The checkbox
37	can be checked by a mouse click or by pushing \key{Space} on the
38	keyboard when the checkbox has focus. A checkbox object with focus
39	is surrounded by a blue border. A checkbox can also be set
40	programmatically by calling the SetValue() method.
41
42	A few checkbox examples can be seen below in unchecked state, checked
43	state, and another unchecked checkbox with focus on it.
44
45	\image html BCheckBox_example.png
46*/
47
48
49/*!
50	\fn BCheckBox::BCheckBox(BRect frame, const char *name, const char *label,
51							 BMessage *message, uint32 resizingMode,
52							 uint32 flags)
53	\brief Construct a checkbox in the \a frame with a \a name, \a label,
54		model \a message, \a resizingMode, and creation \a flags.
55
56	The initial value of the checkbox is set to 0 (\c B_CONTROL_OFF).
57	The \a label and the \a message parameters can be set to \c NULL.
58
59	\param frame The frame to draw the checkbox in.
60	\param name The name of the checkbox.
61	\param label The label displayed along with the checkbox.
62	\param message The message to send when the checkbox is activated.
63	\param resizingMode Defines the behavior of the checkbox as the parent
64		view resizes.
65	\param flags Behavior flags for the checkbox. See BView for details.
66*/
67
68
69/*!
70	\fn BCheckBox::BCheckBox(const char *name, const char *label,
71							 BMessage *message, uint32 flags)
72	\brief Construct a checkbox with a \a name, \a label, model \a message,
73		and creation \a flags suitable for use with the Layout API.
74
75	The initial value of the checkbox is set to 0 (\c B_CONTROL_OFF).
76	The \a label and the \a message parameters can be set to \c NULL.
77
78	\param name The name of the checkbox.
79	\param label The label displayed along with the checkbox.
80	\param message The message to send when the checkbox is activated.
81	\param flags Behavior flags for the checkbox. See BView for details.
82*/
83
84
85/*!
86	\fn BCheckBox::BCheckBox(const char *label, BMessage *message)
87	\brief Constructs a BCheckBox object with just a \a label and model
88		\a message.
89
90	The initial value of the checkbox is set to 0 (\c B_CONTROL_OFF).
91	The \a label and the \a message parameters can be set to \c NULL.
92
93	\param label The label displayed along with the checkbox.
94	\param message The message to send when the checkbox is activated.
95*/
96
97
98/*!
99	\fn BCheckBox::BCheckBox(BMessage *archive)
100	\brief Constructs a BCheckBox object from an \a archive message.
101
102	This method is usually not called directly. If you want to build a
103	checkbox from a message you should call Instantiate() which can
104	handle errors properly.
105
106	If the \a archive deep, the BCheckBox object will also unarchive each
107	of its child views recursively.
108
109	\param archive The \a archive message to restore from.
110*/
111
112
113/*!
114	\fn BCheckBox::~BCheckBox()
115	\brief Destructor Method.
116*/
117
118
119/*!
120	\fn void BCheckBox::Draw(BRect updateRect)
121	\brief Draws the area of the checkbox that intersects \a updateRect.
122
123	\note This is an hook method called by the Interface Kit, you don't
124	have to call it yourself. If you need to forcefully redraw the checkbox
125	consider calling Invalidate() instead.
126
127	\param updateRect The rectangular area to be drawn.
128
129	\sa BView::Draw()
130*/
131
132
133/*!
134	\fn void BCheckBox::GetPreferredSize(float* _width, float* _height)
135	\brief Fill out the preferred width and height of the checkbox
136		into the \a _width and \a _height parameters.
137
138	\param _width Pointer to a \c float to hold the width of the checkbox.
139	\param _height Pointer to a \c float to hold the height of the checkbox.
140
141	\sa BView::GetPreferredSize()
142*/
143
144
145/*!
146	\fn void BCheckBox::SetValue(int32 value)
147	\brief Turn the checkbox on or off.
148
149	\param value The value to set the checkbox to, should be
150		either \c B_CONTROL_ON or \c B_CONTROL_OFF.
151
152	\sa BControl::SetValue()
153*/
154