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 * headers/os/interface/GroupLayoutBuilder.h rev 42274 11 * src/kits/interface/GroupLayoutBuilder.cpp rev 42274 12 */ 13 14 15/*! 16 \file GroupLayoutBuilder.h 17 \ingroup interface 18 \ingroup layout 19 \ingroup libbe 20 \brief Provides the BLayoutBuilder::Group<> class. 21*/ 22 23 24/*! 25 \class BLayoutBuilder::Group<> 26 \ingroup interface 27 \ingroup layout 28 \ingroup libbe 29 \brief BLayoutBuilder::Base subclass for building BGroupLayouts. 30*/ 31 32 33/*! 34 \typedef BLayoutBuilder::Group<ParentBuilder>::GroupBuilder 35 \brief Shorthand for builders returned by this builder's AddGroup() methods. 36*/ 37 38 39/*! 40 \typedef BLayoutBuilder::Group<ParentBuilder>::GridBuilder 41 \brief Shorthand for builders returned by this builder's AddGrid() methods. 42*/ 43 44 45/*! 46 \typedef BLayoutBuilder::Group<ParentBuilder>::SplitBuilder 47 \brief Shorthand for builders returned by this builder's AddSplit() methods. 48*/ 49 50 51/*! 52 \typedef BLayoutBuilder::Group<ParentBuilder>::ThisBuilder 53 \brief Shorthand representing the type of \c this. 54*/ 55 56 57/*! 58 \name Constructors 59*/ 60 61 62//! @{ 63 64 65/*! 66 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BWindow *window, 67 orientation orientation, float spacing) 68 \brief Creates a new BGroupLayout, and attaches it to a BWindow. 69 70 \note The top BView* in \a window has its ViewColor set to 71 B_PANEL_BACKGROUND_COLOR. 72 \param window Thew BWindow* to attach the newly created BGroupLayout to. 73 \param orientation The orientation for the new BGroupLayout. 74 \param spacing The spacing for the new BGroupLayout. 75*/ 76 77 78/*! 79 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupLayout* layout) 80 \brief Creates a builder targeting a BGroupLayout. 81 82 Methods called on this builder will be directed to \a layout. 83 \param layout The BGroupLayout to target with this builder. 84*/ 85 86 87/*! 88 \fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupView* view) 89 \brief Creates a builder targeting a BGroupView. 90 91 Methods called on this builder will be directed to 92 \c view->GroupLayout(). 93 94 \param view The BGroupView this builder will target. 95*/ 96 97 98/*! 99 \fn BLayoutBuilder::Group<ParentBuilder>::Group( 100 orientation orientation, float spacing) 101 \brief Creates a new BGroupView and targets it. 102 103 Methods called on this builder will be directed to the new BGroupView's 104 BGroupLayout. 105 106 \param orientation The orientation for the new BGroupView. 107 \param spacing The spacing for the new BGroupView. 108*/ 109 110 111//! @} 112 113 114/*! 115 \name Adding BViews and BLayoutItems 116*/ 117 118 119//! @{ 120 121/*! 122 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view) 123 \brief Add a BView to the BGroupLayout this builder represents. 124 125 \param view The BView to be added. 126 \see BGroupLayout::AddView(BView*) 127*/ 128 129 130/*! 131 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view, 132 float weight) 133 \brief Add BView to the BGroupLayout this builder represents. 134 135 \param view The BView to be added. 136 \param weight The weight to give \a view. 137 \see BGroupLayout::AddView(BView* view, float weight) 138*/ 139 140 141/*! 142 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add( 143 BLayoutItem* item) 144 \brief Add a BLayoutItem to the BGroupLayout this builder represents. 145 146 \param item The BLayoutItem to be added. 147 \see BGroupLayout::AddItem(BLayoutItem*) 148*/ 149 150 151/*! 152 \fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BLayoutItem* 153 item, float weight) 154 \brief Add a BLayoutItem the BGroupLayout this builder represents. 155 156 \param item The BLayoutItem to be added. 157 \param weight The weight to give \a item. 158 \see BGroupLayout::AddItem(BLayoutItem* item, float weight) 159*/ 160 161 162//! @} 163 164 165/*! 166 \name Adding BLayouts and their BView pairs 167 \brief A set of methods that add a BLayout or BView subclass and return a 168 BLayoutBuilder::Base subclass representing the newly added object. These 169 methods push a new builder on top of the stack, you will not be using 170 \c this builder again until you call End(). 171*/ 172 173 174//! @{ 175 176 177/*! 178 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 179 orientation orientation, float spacing, float weight) 180 \brief Construct and add a viewless BGroupLayout, then return a GroupBuilder 181 representing the newly added layout. 182 183 \param orientation The orientation to use for the new BGroupLayout. 184 \param spacing The spacing to use for the new BGroupLayout. 185 \param weight The weight for the new BGroupLayout in the BGroupLayout this 186 builder represents. 187 188 \returns A GroupBuilder representing the newly created BGroupLayout. 189*/ 190 191 192/*! 193 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView* 194 groupView, float weight) 195 \brief Add BGroupView and return a builder representing the newly added 196 BGroupView. 197 198 \param groupView The BGroupView to be added. 199 \param weight The weight for \a groupView in the BGroupLayout this builder 200 represents. 201 \returns A GroupBuilder representing \a groupView. 202*/ 203 204 205/*! 206 \fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 207 BGroupLayout* groupLayout, float weight) 208 \brief Add a BGroupLayout and return a builder representing 209 the newly added BGroupLayout. 210 211 \param groupLayout The BGroupLayout to be added. 212 \param weight The weight for \a groupLayout in the BGroupLayout this builder 213 represents. 214 \returns A GroupBuilder representing \a groupLayout. 215*/ 216 217 218/*! 219 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 220 float horizontalSpacing = 0.0f, float verticalSpacing = 0.0f, 221 float weight = 1.0f) 222 \brief Create and add a viewless BGridLayout, then return a builder 223 representing the newly created BGridLayout. 224 225 \param horizontalSpacing The horizontal spacing for the new BGridLayout. 226 \param verticalSpacing The vertical spacing for the new BGridLayout. 227 \param weight The weight for the new BGroupLayout in the BGroupLayout this 228 builder represents. 229 \returns A GridBuilder representing the newly created BGridLayout. 230*/ 231 232 233/*! 234 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 235 BGridLayout* gridLayout, float weight = 1.0f) 236 \brief Add a BGridLayout, then return a builder the newly added 237 BGridLayout. 238 239 \param gridLayout The BGridLayout to be added and used to construct the 240 returned GridBuilder. 241 \param weight The weight for \a groupLayout in the BGroupLayout this builder 242 represents. 243 \returns a GridBuilder representing \a gridLayout. 244*/ 245 246 247/*! 248 \fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 249 BGridView* gridView, float weight = 1.0f) 250 \brief Add a BGridView, then return a builder the newly added 251 BGridView. 252 253 \param gridView The BGridView to be added and used to construct the 254 returned GridBuilder. 255 \param weight The weight for \a groupLayout in the BGroupLayout this builder 256 represents. 257 258 \returns a GridBuilder representing \a gridView. 259*/ 260 261 262/*! 263 \fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit( 264 orientation orientation, float spacing, float weight) 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