1/* 2 * Copyright 2011, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * Ingo Weinhold, bonefish@cs.tu-berlin.de 8 * 9 * Corresponds to: 10 * /trunk/headers/os/interface/GroupLayoutBuilder.h rev 42274 11 * /trunk/src/kits/interface/GroupLayoutBuilder.cpp rev 42274 12 */ 13 14 15/*! 16 \file GroupLayoutBuilder.h 17 \brief Provides the BLayoutBuilder::Group<> class. 18*/ 19 20 21/*! 22 \class BLayoutBuilder::Group<> 23 \ingroup interface 24 \ingroup layout 25 \brief BLayoutBuilder::Base subclass for building BGroupLayouts. 26*/ 27 28 29/*! 30 \typedef BLayoutBuilder::Group<ParentBuilder>::GroupBuilder 31 \brief Shorthand for builders returned by this builder's AddGroup() methods. 32*/ 33 34 35/*! 36 \typedef BLayoutBuilder::Group<ParentBuilder>::GridBuilder 37 \brief Shorthand for builders returned by this builder's AddGrid() methods. 38*/ 39 40 41/*! 42 \typedef BLayoutBuilder::Group<ParentBuilder>::SplitBuilder 43 \brief Shorthand for builders returned by this builder's AddSplit() methods. 44*/ 45 46 47/*! 48 \typedef BLayoutBuilder::Group<ParentBuilder>::ThisBuilder 49 \brief Shorthand representing the type of \c this. 50*/ 51 52 53/*! 54 \name Constructors 55*/ 56 57 58//! @{ 59 60 61/*! 62 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BWindow *window, 63 enum orientation orientation=B_HORIZONTAL, 64 float spacing=B_USE_DEFAULT_SPACING) 65 \brief Creates a new BGroupLayout, and attaches it to a BWindow. 66 67 \note The top BView* in \a window has its ViewColor set to 68 B_PANEL_BACKGROUND_COLOR. 69 \param window Thew BWindow* to attach the newly created BGroupLayout to. 70 \param orientation The orientation for the new BGroupLayout. 71 \param spacing The spacing for the new BGroupLayout. 72*/ 73 74 75/*! 76 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupLayout* layout) 77 \brief Creates a builder targeting a BGroupLayout. 78 79 Methods called on this builder will be directed to \a layout. 80 \param layout The BGroupLayout to target with this builder. 81*/ 82 83 84/*! 85 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupView* view) 86 \brief Creates a builder targeting a BGroupView. 87 88 Methods called on this builder will be directed to 89 \c view->GroupLayout(). 90 91 \param view The BGroupView this builder will target. 92*/ 93 94 95/*! 96 \fn BLayoutBuilder::Group<ParentBuilder>::Group( 97 enum orientation orientation=B_HORIZONTAL, 98 float spacing=B_USE_DEFAULT_SPACING) 99 \brief Creates a new BGroupView and targets it. 100 101 Methods called on this builder will be directed to the new BGroupView's 102 BGroupLayout. 103 104 \param orientation The orientation for the new BGroupView. 105 \param spacing The spacing for the new BGroupView. 106*/ 107 108 109//! @} 110 111 112/*! 113 \name Adding BViews and BLayoutItems 114*/ 115 116 117//! @{ 118 119/*! 120 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view) 121 \brief Add a BView to the BGroupLayout this builder represents. 122 123 \param view The BView to be added. 124 \see BGroupLayout::AddView(BView*) 125*/ 126 127 128/*! 129 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view, 130 float weight) 131 \brief Add BView to the BGroupLayout this builder represents. 132 133 \param view The BView to be added. 134 \param weight The weight to give \a view. 135 \see BGroupLayout::AddView(BView* view, float weight) 136*/ 137 138 139/*! 140 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add( 141 BLayoutItem* item) 142 \brief Add a BLayoutItem to the BGroupLayout this builder represents. 143 144 \param item The BLayoutItem to be added. 145 \see BGroupLayout::AddItem(BLayoutItem*) 146*/ 147 148 149/*! 150 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BLayoutItem* 151 item, float weight) 152 \brief Add a BLayoutItem the BGroupLayout this builder represents. 153 154 \param item The BLayoutItem to be added. 155 \param weight The weight to give \a item. 156 \see BGroupLayout::AddItem(BLayoutItem* item, float weight) 157*/ 158 159 160//! @} 161 162 163/*! 164 \name Adding BLayouts and their BView pairs 165 \brief A set of methods that add a BLayout or BView subclass and return a 166 BLayoutBuilder::Base subclass representing the newly added object. These 167 methods push a new builder on top of the stack, you will not be using 168 \c this builder again until you call End(). 169*/ 170 171 172//! @{ 173 174 175/*! 176 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 177 enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, 178 float weight=1.0f) 179 \brief Construct and add a viewless BGroupLayout, then return a GroupBuilder 180 representing the newly added layout. 181 182 \param orientation The orientation to use for the new BGroupLayout. 183 \param spacing The spacing to use for the new BGroupLayout. 184 \param weight The weight for the new BGroupLayout in the BGroupLayout this 185 builder represents. 186 187 \returns A GroupBuilder representing the newly created BGroupLayout. 188*/ 189 190 191/*! 192 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView* 193 groupView, float weight) 194 \brief Add BGroupView and return a builder representing the newly added 195 BGroupView. 196 197 \param groupView The BGroupView to be added. 198 \param weight The weight for \a groupView in the BGroupLayout this builder 199 represents. 200 \returns A GroupBuilder representing \a groupView. 201*/ 202 203 204/*! 205 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 206 BGroupLayout* groupLayout, float weight) 207 \brief Add a BGroupLayout and return a builder representing 208 the newly added BGroupLayout. 209 210 \param groupLayout The BGroupLayout to be added. 211 \param weight The weight for \a groupLayout in the BGroupLayout this builder 212 represents. 213 \returns A GroupBuilder representing \a groupLayout. 214*/ 215 216 217/*! 218 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 219 float horizontalSpacing = 0.0f, float verticalSpacing = 0.0f, 220 float weight = 1.0f) 221 \brief Create and add a viewless BGridLayout, then return a builder 222 representing the newly created BGridLayout. 223 224 \param horizontalSpacing The horizontal spacing for the new BGridLayout. 225 \param verticalSpacing The vertical spacing for the new BGridLayout. 226 \param weight The weight for the new BGroupLayout in the BGroupLayout this 227 builder represents. 228 \returns A GridBuilder representing the newly created BGridLayout. 229*/ 230 231 232/*! 233 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 234 BGridLayout* gridLayout, float weight = 1.0f) 235 \brief Add a BGridLayout, then return a builder the newly added 236 BGridLayout. 237 238 \param gridLayout The BGridLayout to be added and used to construct the 239 returned GridBuilder. 240 \param weight The weight for \a groupLayout in the BGroupLayout this builder 241 represents. 242 \returns a GridBuilder representing \a gridLayout. 243*/ 244 245 246/*! 247 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 248 BGridView* gridView, float weight = 1.0f) 249 \brief Add a BGridView, then return a builder the newly added 250 BGridView. 251 252 \param gridView The BGridView to be added and used to construct the 253 returned GridBuilder. 254 \param weight The weight for \a groupLayout in the BGroupLayout this builder 255 represents. 256 257 \returns a GridBuilder representing \a gridView. 258*/ 259 260 261/*! 262 \fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit( 263 enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, 264 float weight=1.0f) 265 266 \brief Create and add a new BSplitView with a weight of \c weight, then 267 return a SplitBuilder representing the new BSplitView. 268 269 \param orientation The orientation of the new BSplitView. 270 \param spacing The spacing of the new BSplitView. 271 \param weight The weight, in this BGroupLayout for the new BSplitView. 272 273 \returns a SplitBuilder representing the new BSplitView. 274*/ 275 276 277/*! 278 \fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit( 279 BSplitView* splitView, float weight = 1.0f) 280 \brief Add a BSplitView to the BGroupLayout this builder represents and 281 return a SplitBuilder representing the BSplitView. 282 283 \param splitView The BSplitView to be added. 284 \param weight The weight of the BSplitView in the BGroupLayout this builder 285 represents. 286*/ 287 288 289//! @} 290 291 292/*! 293 \name Adding BSpaceLayoutItems 294 Some convenience methods for adding special BSpaceLayoutItems. 295*/ 296 297 298//! @{ 299 300 301/*! 302 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::AddGlue( 303 float weight = 1.0f) 304 \brief Add a BSpaceLayoutItem created by BSpaceLayoutItem::CreateGlue() 305 to the BGroupLayout this builder represents. 306 307 \param weight The weight of the BSpaceLayoutItem in the BGroupLayout this 308 builder represents 309*/ 310 311 312/*! 313 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::AddStrut(float size) 314 \brief Add a BSpaceLayoutItem created by 315 BSpaceLayoutItem::CreateHorizontalStrut() or 316 BSpaceLayoutItem::CreateVerticalStrut() to the BGroupLayout this builder 317 represents. 318 319 \param size The width or height of the strut to be created (depending on 320 the orientation of the BGroupLayout this builder represents). 321*/ 322 323 324//!@} 325 326 327/*! 328 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::SetInsets(float left, 329 float top, float right, float bottom) 330 \brief Call the BTwoDimensionalLayout::SetInsets() method on the 331 BGroupLayout this builder represents. 332*/ 333 334 335/*! 336 \name Accessors 337*/ 338 339 340//! @{ 341 342 343/*! 344 \fn BGroupLayout* BLayoutBuilder::Group<ParentBuilder>::Layout() const 345 \brief Get the BGroupLayout this builder represents. 346*/ 347 348 349/*! 350 \fn BView* BLayoutBuilder::Group<ParentBuilder>::View() const 351 \brief Get the BView this builder's BGroupLayout is attached to. 352*/ 353 354 355/*! 356 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::GetLayout( 357 BGroupLayout** _layout) 358 \brief Get the BGroupLayout this builder represents. 359 \param[out] _layout The BGroupLayout this builder represents. 360*/ 361 362 363/*! 364 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::GetView( 365 BView** _view) 366 \brief Get the BView this builder's BGroupLayout is attached to. 367 \param[out] _view The BView this builder's BGroupLayout is attached to. 368*/ 369 370 371/*! 372 \fn BLayoutBuilder::Group<ParentBuilder>::operator BGroupLayout*() 373 \brief Cast this builder into the BGroupLayout it represents. 374*/ 375 376//!@} 377