2 * Copyright 2013 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * John Scipione, jscipione@gmail.com
9 * headers/os/interface/ListItem.h hrev45555
10 * src/kits/interface/ListItem.cpp hrev45555
18 \brief ListItem class definition.
26 \brief A list item, a member of a BListView or BOutlineListView.
33 \fn BListItem::BListItem(uint32 level, bool expanded)
34 \brief Create a new list item with the specified \a level.
36 The \a level and \a expanded arguments are only used if the item is added to
39 \param level The level to create the list item on, default level is 0.
40 \param expanded Whether or not the item is expanded.
42 \see BOutlineListView::AddItem()
49 \fn BListItem::BListItem(BMessage* data)
50 \brief Create a new list item from archived message.
52 \param data The message to create the list item from.
59 \fn BListItem::~BListItem()
60 \brief Destroy the list item freeing any memory used.
62 The default destructor is empty.
77 \fn status_t BListItem::Archive(BMessage* archive, bool deep) const
78 \brief Archive the list item to a message.
80 \param archive The message to archive the list item to.
81 \param deep If \c true also archive child views.
88 \fn void BListItem::DrawItem(BView* owner, BRect frame, bool complete)
89 \brief Hook method called when the item is drawn.
91 \param owner The view that the list item is a child of.
92 \param frame The frame of the item.
93 \param complete Whether or not to draw the background in addition to the
104 \fn float BListItem::Height() const
105 \brief Return the height of the list item.
107 \return The height of the list item as a float.
114 \fn float BListItem::Width() const
115 \brief Return the width of the list item.
117 \return The width of the list item as a float.
124 \fn bool BListItem::IsSelected() const
125 \brief Return whether or not the list item is currently selected.
127 \return \c true if the list item is selected, \c false otherwise.
134 \fn void BListItem::Select()
135 \brief Select the list item.
142 \fn void BListItem::Deselect()
143 \brief Unselect the list item.
150 \fn void BListItem::SetEnabled(bool on)
151 \brief Enable or disable the list item.
153 \param on Set \c true to enable, \c false to disable the list item.
160 \fn bool BListItem::IsEnabled() const
161 \brief Returns whether or not the list item is currently enabled.
163 \return \c true if the list item is enabled, \c false if it is disabled.
170 \fn void BListItem::SetHeight(float height)
171 \brief Set the height of the list item to \a height.
173 \param height The height to set the list item to.
180 \fn void BListItem::SetWidth(float width)
181 \brief Set the width of the list item to \a width.
183 \param width The width to set the list item to.
190 \fn void BListItem::Update(BView* owner, const BFont* font)
191 \brief Hook method that's called when the \a owner changes.
193 This method gets called when the list item is added to the list view.
195 The default implementation sets the width of the list item to the width of
196 \a owner and sets the height to fit \a font.
198 \param owner The list item's new \a owner.
199 \param font The font set to the list item's current \a owner.
206 \fn status_t BListItem::Perform(perform_code d, void* arg)
207 \brief Performs an action give a perform_code and arg. (Internal Method)
209 \param d The perform code.
210 \param arg A pointer to some data to perform on.
212 \return A status code.
219 \fn void BListItem::SetExpanded(bool expanded)
220 \brief Set the expanded state of the list item. This only makes sense if the
221 list item is part of a BOutlineListView.
223 \param expanded \c true to expand the list item, \c false to un-expand the
231 \fn bool BListItem::IsExpanded() const
232 \brief Returns whether or not the list item is currently expanded.
234 \return \c true if the list item is expanded, \c false if it is not expanded.
241 \fn uint32 BListItem::OutlineLevel() const
242 \brief Returns the current outline level of the list item. This only makes
243 sense if the list item is part of a BOutlineListView.
245 \return The current outline level of the list item.
252 \fn void BListItem::SetOutlineLevel(uint32 level)
253 \brief Set the outline level of the list item.
255 \param level The outline level to set the list item to.