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 \since BeOS R3 29*/ 30 31 32/*! 33 \fn BListItem::BListItem(uint32 level, bool expanded) 34 \brief Create a new list item with the specified \a level. 35 36 The \a level and \a expanded arguments are only used if the item is added to 37 a BOutlineListView. 38 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. 41 42 \see BOutlineListView::AddItem() 43 44 \since BeOS R3 45*/ 46 47 48/*! 49 \fn BListItem::BListItem(BMessage* data) 50 \brief Create a new list item from archived message. 51 52 \param data The message to create the list item from. 53 54 \since BeOS R3 55*/ 56 57 58/*! 59 \fn BListItem::~BListItem() 60 \brief Destroy the list item freeing any memory used. 61 62 The default destructor is empty. 63 64 \since BeOS R3 65*/ 66 67 68/*! 69 \name Archiving 70*/ 71 72 73//! @{ 74 75 76/*! 77 \fn status_t BListItem::Archive(BMessage* archive, bool deep) const 78 \brief Archive the list item to a message. 79 80 \param archive The message to archive the list item to. 81 \param deep If \c true also archive child views. 82 83 \since BeOS R3 84*/ 85 86 87/*! 88 \fn void BListItem::DrawItem(BView* owner, BRect frame, bool complete) 89 \brief Hook method called when the item is drawn. 90 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 94 item's contents. 95 96 \since BeOS R3 97*/ 98 99 100//! @} 101 102 103/*! 104 \fn float BListItem::Height() const 105 \brief Return the height of the list item. 106 107 \return The height of the list item as a float. 108 109 \since BeOS R3 110*/ 111 112 113/*! 114 \fn float BListItem::Width() const 115 \brief Return the width of the list item. 116 117 \return The width of the list item as a float. 118 119 \since BeOS R3 120*/ 121 122 123/*! 124 \fn bool BListItem::IsSelected() const 125 \brief Return whether or not the list item is currently selected. 126 127 \return \c true if the list item is selected, \c false otherwise. 128 129 \since BeOS R3 130*/ 131 132 133/*! 134 \fn void BListItem::Select() 135 \brief Select the list item. 136 137 \since BeOS R3 138*/ 139 140 141/*! 142 \fn void BListItem::Deselect() 143 \brief Unselect the list item. 144 145 \since BeOS R3 146*/ 147 148 149/*! 150 \fn void BListItem::SetEnabled(bool on) 151 \brief Enable or disable the list item. 152 153 \param on Set \c true to enable, \c false to disable the list item. 154 155 \since BeOS R3 156*/ 157 158 159/*! 160 \fn bool BListItem::IsEnabled() const 161 \brief Returns whether or not the list item is currently enabled. 162 163 \return \c true if the list item is enabled, \c false if it is disabled. 164 165 \since BeOS R3 166*/ 167 168 169/*! 170 \fn void BListItem::SetHeight(float height) 171 \brief Set the height of the list item to \a height. 172 173 \param height The height to set the list item to. 174 175 \since BeOS R3 176*/ 177 178 179/*! 180 \fn void BListItem::SetWidth(float width) 181 \brief Set the width of the list item to \a width. 182 183 \param width The width to set the list item to. 184 185 \since BeOS R3 186*/ 187 188 189/*! 190 \fn void BListItem::Update(BView* owner, const BFont* font) 191 \brief Hook method that's called when the \a owner changes. 192 193 This method gets called when the list item is added to the list view. 194 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. 197 198 \param owner The list item's new \a owner. 199 \param font The font set to the list item's current \a owner. 200 201 \since BeOS R3 202*/ 203 204 205/*! 206 \fn status_t BListItem::Perform(perform_code d, void* arg) 207 \brief Performs an action give a perform_code and arg. (Internal Method) 208 209 \param d The perform code. 210 \param arg A pointer to some data to perform on. 211 212 \return A status code. 213 214 \since Haiku R1 215*/ 216 217 218/*! 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. 222 223 \param expanded \c true to expand the list item, \c false to un-expand the 224 list item. 225 226 \since BeOS R3 227*/ 228 229 230/*! 231 \fn bool BListItem::IsExpanded() const 232 \brief Returns whether or not the list item is currently expanded. 233 234 \return \c true if the list item is expanded, \c false if it is not expanded. 235 236 \since BeOS R3 237*/ 238 239 240/*! 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. 244 245 \return The current outline level of the list item. 246 247 \since BeOS R3 248*/ 249 250 251/*! 252 \fn void BListItem::SetOutlineLevel(uint32 level) 253 \brief Set the outline level of the list item. 254 255 \param level The outline level to set the list item to. 256 257 \since BeOS R3 258*/ 259