xref: /haiku/docs/user/interface/ListItem.dox (revision f73f5d4c42a01ece688cbb57b5d332cc0f68b2c6)
1/*
2 * Copyright 2013 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		John Scipione, jscipione@gmail.com
7 *
8 * Corresponds to:
9 *		headers/os/interface/ListItem.h	 hrev45555
10 *		src/kits/interface/ListItem.cpp	 hrev45555
11 */
12
13
14/*!
15	\file ListItem.h
16	\ingroup interface
17	\ingroup libbe
18	\brief ListItem class definition.
19*/
20
21
22/*!
23	\class BListItem
24	\ingroup interface
25	\ingroup libbe
26	\brief A list item, a member of a BListView or BOutlineListView.
27*/
28
29
30/*!
31	\fn BListItem::BListItem(uint32 level, bool expanded)
32	\brief Create a new list item with the specified \a level.
33
34	The \a level and \a expanded arguments are only used if the item is added to
35	a BOutlineListView.
36
37	\param level The level to create the list item on, default level is 0.
38	\param expanded Whether or not the item is expanded.
39
40	\see BOutlineListView::AddItem()
41*/
42
43
44/*!
45	\fn BListItem::BListItem(BMessage* data)
46	\brief Create a new list item from archived message.
47
48	\param data The message to create the list item from.
49*/
50
51
52/*!
53	\fn BListItem::~BListItem()
54	\brief Destroy the list item freeing any memory used.
55
56	The default destructor is empty.
57*/
58
59
60/*!
61	\fn status_t BListItem::Archive(BMessage* archive, bool deep) const
62	\brief Archive the list item to a message.
63
64	\param archive The message to archive the list item to.
65	\param deep If \c true also archive child views.
66*/
67
68
69/*!
70	\fn void BListItem::DrawItem(BView* owner, BRect frame, bool complete)
71	\brief Hook method called when the item is drawn.
72
73	\param owner The view that the list item is a child of.
74	\param frame The frame of the item.
75	\param complete Whether or not to draw the background in addition to the
76	       item's contents.
77*/
78
79
80/*!
81	\fn float BListItem::Height() const
82	\brief Return the height of the list item.
83
84	\return The height of the list item as a float.
85*/
86
87
88/*!
89	\fn float BListItem::Width() const
90	\brief Return the width of the list item.
91
92	\return The width of the list item as a float.
93*/
94
95
96/*!
97	\fn bool BListItem::IsSelected() const
98	\brief Return whether or not the list item is currently selected.
99
100	\return \c true if the list item is selected, \c false otherwise.
101*/
102
103
104/*!
105	\fn void BListItem::Select()
106	\brief Select the list item.
107*/
108
109
110/*!
111	\fn void BListItem::Deselect()
112	\brief Unselect the list item.
113*/
114
115
116/*!
117	\fn void BListItem::SetEnabled(bool on)
118	\brief Enable or disable the list item.
119
120	\param on Set \c true to enable, \c false to disable the list item.
121*/
122
123
124/*!
125	\fn bool BListItem::IsEnabled() const
126	\brief Returns whether or not the list item is currently enabled.
127
128	\return \c true if the list item is enabled, \c false if it is disabled.
129*/
130
131
132/*!
133	\fn void BListItem::SetHeight(float height)
134	\brief Set the height of the list item to \a height.
135
136	\param height The height to set the list item to.
137*/
138
139
140/*!
141	\fn void BListItem::SetWidth(float width)
142	\brief Set the width of the list item to \a width.
143
144	\param width The width to set the list item to.
145*/
146
147
148/*!
149	\fn void BListItem::Update(BView* owner, const BFont* font)
150	\brief Hook method that's called with the list item's \a owner changes.
151
152	This method gets called when the list item is added to the list view.
153
154	The default implementation sets the width of the list item to the width of
155	\a owner and sets the height to fit \a font.
156
157	\param owner The list item's new \a owner.
158	\param font The font set to the list item's current \a owner.
159*/
160
161
162/*!
163	\fn status_t BListItem::Perform(perform_code d, void* arg)
164	\brief Performs an action give a perform_code and arg. (Internal Method)
165
166	\param d The perform code.
167	\param arg A pointer to some data to perform on.
168
169	\return A status code.
170*/
171
172
173/*!
174	\fn void BListItem::SetExpanded(bool expanded)
175	\brief Set the expanded state of the list item. This only makes sense if the
176	       list item is part of a BOutlineListView.
177
178	\param expanded \c true to expand the list item, \c false to un-expand the
179	       list item.
180*/
181
182
183/*!
184	\fn bool BListItem::IsExpanded() const
185	\brief Returns whether or not the list item is currently expanded.
186
187	\return \c true if the list item is expanded, \c false if it is not expanded.
188*/
189
190
191/*!
192	\fn uint32 BListItem::OutlineLevel() const
193	\brief Returns the current outline level of the list item. This only makes
194	       sense if the list item is part of a BOutlineListView.
195
196	\return The current outline level of the list item.
197*/
198
199
200/*!
201	\fn void BListItem::SetOutlineLevel(uint32 level)
202	\brief Set the outline level of the list item.
203
204	\param level The outline level to set the list item to.
205*/
206