1/* 2 * Copyright 2020 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Niels Sascha Reedijk, niels.reedijk@gmail.com 7 * 8 * Reviewers: 9 * Adrien Destugues, pulkomandy@pulkomandy.tk 10 * 11 * Corresponds to: 12 * headers/os/interface/LayoutBuilder.h rev 49977 13 */ 14 15 16/*! 17 \class BLayoutBuilder::Cards<> 18 \ingroup layout 19 \ingroup libbe 20 \brief BLayoutBuilder::Base subclass for building BCardLayouts. 21 22 \since Haiku R1 23 24 The BCardLayout class is a simple BLayout subclass that arranges the 25 items as a stack of cards with only one card being on top and visible to 26 the user. 27 28 For a detailed view on the properties, see the \link BCardLayout class 29 description\endlink. 30*/ 31 32 33/*! 34 \typedef BLayoutBuilder::Cards<ParentBuilder>::ThisBuilder 35 \copydoc BLayoutBuilder::Group<ParentBuilder>::ThisBuilder 36*/ 37 38 39/*! 40 \typedef BLayoutBuilder::Cards<ParentBuilder>::GroupBuilder 41 \copydoc BLayoutBuilder::Group<ParentBuilder>::GroupBuilder 42*/ 43 44 45/*! 46 \typedef BLayoutBuilder::Cards<ParentBuilder>::GridBuilder 47 \copydoc BLayoutBuilder::Group<ParentBuilder>::GridBuilder 48*/ 49 50 51/*! 52 \typedef BLayoutBuilder::Cards<ParentBuilder>::SplitBuilder 53 \copydoc BLayoutBuilder::Group<ParentBuilder>::SplitBuilder 54*/ 55 56 57/*! 58 \typedef BLayoutBuilder::Cards<ThisBuilder>::CardBuilder 59 \copydoc BLayoutBuilder::Group<ThisBuilder>::CardBuilder 60*/ 61 62 63/*! 64 \name Constructors 65*/ 66 67 68//! @{ 69 70 71/*! 72 \fn BLayoutBuilder::Cards<ParentBuilder>::Cards() 73 \brief Creates a builder for BCardLayout. 74 75 \since Haiku R1 76*/ 77 78 79/*! 80 \fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BWindow* window) 81 \brief Creates a new builder for BCardLayout, and attaches it to a 82 \a window. 83 84 \since Haiku R1 85*/ 86 87 88/*! 89 \fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BView* view) 90 \brief Creates a new builder for BCardLayout, and attaches it to a 91 \a view. 92 93 \since Haiku R1 94*/ 95 96 97/*! 98 \fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BCardLayout* layout) 99 \brief Creates a builder targeting an existing BCardLayout. 100 101 \since Haiku R1 102*/ 103 104 105/*! 106 \fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BCardView* view) 107 \brief Creates a builder targeting an existing BCardView. 108 109 \since Haiku R1 110*/ 111 112 113//! @} 114 115 116/*! 117 \name Accessors 118*/ 119 120 121//! @{ 122 123 124/*! 125 \fn BCardLayout* BLayoutBuilder::Cards<ParentBuilder>::Layout() const 126 \copydoc BLayoutBuilder::Group<ParentBuilder>::Layout() 127*/ 128 129 130/*! 131 \fn BView* BLayoutBuilder::Cards<ParentBuilder>::View() const 132 \copydoc BLayoutBuilder::Group<ParentBuilder>::View() 133*/ 134 135/*! 136 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetLayout( 137 BCardLayout** _layout) 138 \copydoc BLayoutBuilder::Group<ParentBuilder>::GetLayout() 139*/ 140 141 142/*! 143 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetView( 144 BView** _view) 145 \copydoc BLayoutBuilder::Group<ParentBuilder>::GetView() 146*/ 147 148 149/*! 150 \fn BLayoutBuilder::Cards<ParentBuilder>::operator BCardLayout*() 151 \brief Cast this builder into the layout object it represents. 152 153 \since Haiku R1 154*/ 155 156//! @} 157 158 159/*! 160 \name Adding BViews and BLayoutItems 161*/ 162 163 164//! @{ 165 166 167/*! 168 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::Add(BView* view) 169 \brief Add a \a view to the underlying BCardLayout. 170 171 The layout item will be added as a card at the end of the stack. 172 173 \param view The BView to be added. The underlying BCardLayout will take 174 ownership of the object. 175 176 \since Haiku R1 177*/ 178 179 180/*! 181 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::Add( 182 BLayoutItem* item) 183 \brief Add a \a item to the underlying BCardLayout. 184 185 The layout item will be added as a card at the end of the stack. 186 187 \param item The BLayoutItem to be added. The underlying BCardLayout will 188 take ownership of the object. 189 190 \since Haiku R1 191*/ 192 193 194//! @} 195 196 197/*! 198 \name Adding BLayouts and their BView Pairs 199 200 A set of methods that add a BLayout or BView subclass and return a 201 BLayoutBuilder::Base subclass representing the newly added object. These 202 methods push a new builder on top of the stack, you will not be using 203 \c this builder again until you call End(). 204*/ 205 206 207//! @{ 208 209 210/*! 211 \fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup( 212 orientation orientation, float spacing) 213 \copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 214 orientation orientation, float spacing, float weight) 215 216 \param orientation The orientation to use for the new BGroupLayout. 217 \param spacing The spacing to use for the new BGroupLayout. 218 219 \returns A GroupBuilder representing the newly created BGroupLayout. 220 221 \since Haiku R1 222*/ 223 224 225/*! 226 \fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup( 227 BGroupView* groupView) 228 \copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup( 229 BGroupLayout* groupLayout, float weight) 230 231 \param groupView The BGroupView to be added. 232 233 \returns A GroupBuilder representing the layout of the \a groupView. 234 235 \since Haiku R1 236*/ 237 238 239/*! 240 \fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup( 241 BGroupLayout* groupLayout) 242 \copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView* 243 groupView, float weight) 244 245 \param groupLayout The BGroupLayout to be added. 246 247 \returns A GroupBuilder representing the \a groupLayout. 248 249 \since Haiku R1 250*/ 251 252 253/*! 254 \fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid( 255 float horizontalSpacing, float verticalSpacing) 256 \copydoc GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 257 float horizontalSpacing, float verticalSpacing, float weight) 258 259 \param horizontalSpacing The horizontal spacing for the new BGridLayout. 260 \param verticalSpacing The vertical spacing for the new BGridLayout. 261 262 \returns A GridBuilder representing the newly created BGridLayout. 263 264 \since Haiku R1 265*/ 266 267 268/*! 269 \fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid( 270 BGridLayout* gridLayout) 271 \copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 272 BGridLayout* gridLayout, float weight) 273 274 \param gridLayout The BGridLayout to be added and used to construct the 275 returned GridBuilder. 276 277 \returns A GridBuilder representing \a gridLayout. 278 279 \since Haiku R1 280*/ 281 282 283/*! 284 \fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid( 285 BGridView* gridView) 286 \copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid( 287 BGridView* gridView, float weight) 288 289 \param gridView The BGridView to be added and used to construct the 290 returned GridBuilder. 291 292 \returns A GridBuilder representing the layout of the \a gridView. 293 294 \since Haiku R1 295*/ 296 297 298/*! 299 \fn SplitBuilder BLayoutBuilder::Cards<ParentBuilder>::AddSplit( 300 orientation orientation, float spacing) 301 \copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit( 302 orientation orientation, float spacing, float weight) 303 304 \param orientation The orientation of the new BSplitView. 305 \param spacing The spacing of the new BSplitView. 306 307 \returns A SplitBuilder representing the new BSplitView. 308 309 \since Haiku R1 310*/ 311 312 313/*! 314 \fn SplitBuilder BLayoutBuilder::Cards<ParentBuilder>::AddSplit( 315 BSplitView* splitView) 316 \copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit( 317 BSplitView* splitView, float weight) 318 319 \param splitView The BSplitView to be added. 320 321 \returns A SplitBuilder representing the \a splitView. 322 323 \since Haiku R1 324*/ 325 326 327/*! 328 \fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards() 329 \copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards( 330 float weight) 331 332 \returns A CardBuilder representing the new BCardLayout. 333 334 \since Haiku R1 335*/ 336 337 338/*! 339 \fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards( 340 BCardLayout* cardLayout) 341 \copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards( 342 BCardLayout* cardLayout, float weight) 343 344 \param cardLayout The existing layout that will be added to the underlying 345 BSplitView. 346 347 \returns A CardBuilder representing the \a cardLayout. 348 349 \since Haiku R1 350*/ 351 352 353/*! 354 \fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards( 355 BCardView* cardView) 356 \copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards( 357 BCardView* cardView, float weight) 358 359 \param cardView The existing view that will be added to the underlying 360 BSplitView. 361 362 \returns A CardBuilder representing the layout of t he \a cardView. 363 364 \since Haiku R1 365*/ 366 367 368 369//! @} 370 371 372/*! 373 \name Explicit Sizes and Alignment 374*/ 375 376 377//! @{ 378 379 380/*! 381 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMinSize( 382 BSize size) 383 \copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMinSize() 384*/ 385 386 387/*! 388 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMaxSize( 389 BSize size) 390 \copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMaxSize() 391*/ 392 393 394/*! 395 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitPreferredSize( 396 BSize size) 397 \copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitPreferredSize() 398*/ 399 400 401/*! 402 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitAlignment( 403 BAlignment alignment) 404 \copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitAlignment() 405*/ 406 407 408//! @} 409 410 411/*! 412 \name Visible Item 413*/ 414 415 416//! @{ 417 418 419/*! 420 \fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetVisibleItem( 421 int32 index) 422 \brief Set the current visible item to the item at \a index. 423 424 \see BCardLayout::SetVisibleItem(int32) 425*/ 426 427 428//! @} 429