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