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 * Corresponds to: 9 * headers/os/interface/LayoutBuilder.h rev 49977 10 */ 11 12 13/*! 14 \class BLayoutBuilder::Split<> 15 \ingroup layout 16 \ingroup libbe 17 \brief BLayoutBuilder::Base subclass for building BSplitViews. 18 19 \since Haiku R1 20 21 A BSplitView consists of elements, for which in between there are dividers 22 that the user can manipulate to alter the division of space between each of 23 the element.s 24 25 For a detailed view on the properties, see the \link BSplitView class 26 description\endlink. 27*/ 28 29 30/*! 31 \typedef BLayoutBuilder::Split<ParentBuilder>::ThisBuilder 32 \brief Shorthand representing the type of \c this. 33 34 \since Haiku R1 35*/ 36 37 38/*! 39 \typedef BLayoutBuilder::Split<ThisBuilder>::GroupBuilder 40 \brief Shorthand for builders returned by this builder's AddGroup() methods. 41 42 \since Haiku R1 43*/ 44 45 46/*! 47 \typedef BLayoutBuilder::Split<ThisBuilder>::GridBuilder 48 \brief Shorthand for builders returned by this builder's AddGrid() methods. 49 50 \since Haiku R1 51*/ 52 53 54/*! 55 \typedef BLayoutBuilder::Split<ThisBuilder>::SplitBuilder 56 \brief Shorthand for builders returned by this builder's AddSplit() methods. 57 58 \since Haiku R1 59*/ 60 61 62/*! 63 \typedef BLayoutBuilder::Split<ThisBuilder>::CardBuilder 64 \brief Shorthand for builders returned by this builder's AddCards() 65 methods. 66 67 \since Haiku R1 68*/ 69 70 71/*! 72 \name Constructors 73*/ 74 75 76//! @{ 77 78 79/*! 80 \fn BLayoutBuilder::Split<ParentBuilder>::Split(orientation orientation, 81 float spacing) 82 \brief Creates a builder for a new BSplitView. 83 84 \param orientation The orientation for the new BSplitView. 85 \param spacing The spacing for the new BSplitView. 86 87 \since Haiku R1 88*/ 89 90 91/*! 92 \fn BLayoutBuilder::Split<ParentBuilder>::Split(orientation orientation, 93 float spacing) 94 \brief Creates a builder for a new BSplitView. 95 96 \param orientation The orientation for the new BSplitView. 97 \param spacing The spacing for the new BSplitView. 98 99 \since Haiku R1 100*/ 101 102 103/*! 104 \fn BLayoutBuilder::Split<ParentBuilder>::Split(BSplitView *view) 105 \brief Creates a builder for an existing BSplitView 106 107 \param view The existing view to operate on. 108 109 \since Haiku R1 110*/ 111 112 113//! @} 114 115 116/*! 117 \name Accessors 118*/ 119 120 121//! @{ 122 123 124/*! 125 \fn BSplitView* BLayoutBuilder::Split<ParentBuilder>::View() const 126 \brief Get a borrowed pointer to the underlying BSplitView 127 128 \returns A borrowed pointer to the underlying BSplitView 129*/ 130 131 132/*! 133 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::GetView( 134 BView** _view) 135 \brief Get a borrowed pointer to the underlying view. 136 137 \param[out] _view Location to store the underlying BSplitView as a BView 138 reference. 139 140 \return The method returns a self reference, so that calls to the builder 141 may be chained. 142*/ 143 144 145/*! 146 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::GetSplitView( 147 BSplitView** _view) 148 \brief Get a borrowed pointer to the underlying view. 149 150 \param[out] _view Location to store the underlying BSplitView reference. 151 152 \return The method returns a self reference, so that calls to the builder 153 may be chained. 154*/ 155 156 157/*! 158 \fn BLayoutBuilder::Split<ParentBuilder>::operator BSplitView*() 159 \brief Cast this builder into the BSplitView it represents. 160 161 \since Haiku R1 162*/ 163 164 165//! @} 166 167 168/*! 169 \name Adding BViews and BLayoutItems 170*/ 171 172 173//! @{ 174 175 176/*! 177 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::Add(BView* view) 178 \brief Add a \a view to the underlying BSplitView. 179 180 The \a view will be added to the right or the bottom of the existing 181 elements. 182 183 \param view The BView to be added. The underlying BSplitView will take 184 ownership of the object. 185 186 \see BSplitView::Add(BView*) 187 188 \since Haiku R1 189*/ 190 191 192/*! 193 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::Add(BView* view, 194 float weight) 195 \brief Add a \a view with a \a weight to the underlying BSplitView. 196 197 The \a view will be added to the right or the bottom of the existing 198 elements. 199 200 \param view The BView to be added. The underlying BSplitView will take 201 ownership of the object. 202 \param weight The weight of the view. 203 204 \see BSplitView::Add(BView*, float) 205 206 \since Haiku R1 207*/ 208 209 210/*! 211 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::Add( 212 BLayoutItem* item) 213 \brief Add a \a item to the underlying BSplitView. 214 215 The layout item will be added to the right or the bottom of the existing 216 elements. 217 218 \param item The BLayoutItem to be added. The underlying BSplitView will 219 take ownership of the object. 220 221 \see BSplitView::Add(BLayoutItem*) 222 223 \since Haiku R1 224*/ 225 226 227/*! 228 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::Add( 229 BLayoutItem* item, float weight) 230 \brief Add an \a item with a \a weight to the underlying BSplitView. 231 232 The layout item will be added to the right or the bottom of the existing 233 elements. 234 235 \param item The BLayoutItem to be added. The underlying BSplitView will 236 take ownership of the object. 237 \param weight The weight of the item. 238 239 \see BSplitView::Add(BLayoutItem*, float) 240 241 \since Haiku R1 242*/ 243 244 245//! @} 246 247 248/*! 249 \name Adding BLayouts and their BView Pairs 250 251 A set of methods that add a BLayout or BView subclass and return a 252 BLayoutBuilder::Base subclass representing the newly added object. These 253 methods push a new builder on top of the stack, you will not be using 254 \c this builder again until you call End(). 255*/ 256 257 258//! @{ 259 260 261/*! 262 \fn GroupBuilder BLayoutBuilder::Split<ParentBuilder>::AddGroup( 263 orientation orientation, float spacing, float weight) 264 \brief Construct and add a viewless BGroupLayout, then return a GroupBuilder 265 representing the newly added layout. 266 267 \param orientation The orientation to use for the new BGroupLayout. 268 \param spacing The spacing to use for the new BGroupLayout. 269 \param weight The weight for the new BGroupLayout in the BGroupLayout this 270 builder represents. 271 272 \returns A GroupBuilder representing the newly created BGroupLayout. 273 274 \since Haiku R1 275*/ 276 277 278/*! 279 \fn GroupBuilder BLayoutBuilder::Split<ParentBuilder>::AddGroup(BGroupView* 280 groupView, float weight) 281 \brief Add BGroupView and return a builder representing the newly added 282 BGroupView. 283 284 \param groupView The BGroupView to be added. 285 \param weight The weight for \a groupView in the BGroupLayout this builder 286 represents. 287 288 \returns A GroupBuilder representing \a groupView. 289 290 \since Haiku R1 291*/ 292 293 294/*! 295 \fn GroupBuilder BLayoutBuilder::Split<ParentBuilder>::AddGroup( 296 BGroupLayout* groupLayout, float weight) 297 \brief Add a BGroupLayout and return a builder representing the newly added 298 BGroupLayout. 299 300 \param groupLayout The BGroupLayout to be added. 301 \param weight The weight for \a groupLayout in the BGroupLayout this builder 302 represents. 303 304 \returns A GroupBuilder representing \a groupLayout. 305 306 \since Haiku R1 307*/ 308 309 310/*! 311 \fn GridBuilder BLayoutBuilder::Split<ParentBuilder>::AddGrid( 312 float horizontalSpacing = 0.0f, float verticalSpacing = 0.0f, 313 float weight = 1.0f) 314 \brief Create and add a viewless BGridLayout, then return a builder 315 representing the newly created BGridLayout. 316 317 \param horizontalSpacing The horizontal spacing for the new BGridLayout. 318 \param verticalSpacing The vertical spacing for the new BGridLayout. 319 \param weight The weight for the new BGridLayout in the BSplitView this 320 builder represents. 321 322 \returns A GridBuilder representing the newly created BGridLayout. 323 324 \since Haiku R1 325*/ 326 327 328/*! 329 \fn GridBuilder BLayoutBuilder::Split<ParentBuilder>::AddGrid( 330 BGridLayout* gridLayout, float weight = 1.0f) 331 \brief Add a BGridLayout, then return a builder the newly added BGridLayout. 332 333 \param gridLayout The BGridLayout to be added and used to construct the 334 returned GridBuilder. 335 \param weight The weight for \a gridLayout in the BSplitView this builder 336 represents. 337 338 \returns A GridBuilder representing \a gridLayout. 339 340 \since Haiku R1 341*/ 342 343 344/*! 345 \fn GridBuilder BLayoutBuilder::Split<ParentBuilder>::AddGrid( 346 BGridView* gridView, float weight = 1.0f) 347 \brief Add a BGridView, then return a builder the newly added BGridView. 348 349 \param gridView The BGridView to be added and used to construct the 350 returned GridBuilder. 351 \param weight The weight for \a gridView in the BSplitView this builder 352 represents. 353 354 \returns A GridBuilder representing \a gridView. 355 356 \since Haiku R1 357*/ 358 359 360/*! 361 \fn SplitBuilder BLayoutBuilder::Split<ParentBuilder>::AddSplit( 362 orientation orientation, float spacing, float weight) 363 \brief Create and add a new BSplitView with a weight of \c weight, then 364 return a SplitBuilder representing the new BSplitView. 365 366 \param orientation The orientation of the new BSplitView. 367 \param spacing The spacing of the new BSplitView. 368 \param weight The weight, in this BSplitView for the new BSplitView. 369 370 \returns A SplitBuilder representing the new BSplitView. 371 372 \since Haiku R1 373*/ 374 375 376/*! 377 \fn SplitBuilder BLayoutBuilder::Split<ParentBuilder>::AddSplit( 378 BSplitView* splitView, float weight = 1.0f) 379 \brief Add a BSplitView to the BSplitView this builder represents and 380 return a SplitBuilder representing the BSplitView. 381 382 \param splitView The BSplitView to be added. 383 \param weight The weight of the BSplitView in the BSplitView this builder 384 represents. 385 386 \returns A SplitBuilder representing the new BSplitView. 387 388 \since Haiku R1 389*/ 390 391 392/*! 393 \fn CardBuilder BLayoutBuilder::Split<ParentBuilder>::AddCards( 394 float weight) 395 \brief Add a new BCardLayout to the BSplitView this builder represents and 396 return a CardBuilder representing the new layout. 397 398 \param weight The weight of the BCardLayout in the BSplitView this builder 399 represents. 400 401 \returns A CardBuilder representing the new BCardLayout. 402 403 \since Haiku R1 404*/ 405 406 407/*! 408 \fn CardBuilder BLayoutBuilder::Split<ParentBuilder>::AddCards( 409 BCardLayout* cardLayout, float weight) 410 \brief Add an existing BCardLayout to the BSplitView this builder 411 represents and return a CardBuilder representing this layout. 412 413 \param cardLayout The existing layout that will be added to the underlying 414 BSplitView. 415 \param weight The weight of the BCardLayout in the BSplitView this builder 416 represents. 417 418 \returns A CardBuilder representing the new BCardLayout. 419 420 \since Haiku R1 421*/ 422 423 424/*! 425 \fn CardBuilder BLayoutBuilder::Split<ParentBuilder>::AddCards( 426 BCardView* cardView, float weight) 427 \brief Add an existing BCardView to the BSplitView this builder 428 represents and return a CardBuilder representing this layout. 429 430 \param cardView The existing view that will be added to the underlying 431 BSplitView. 432 \param weight The weight of the BCardLayout in the BSplitView this builder 433 represents. 434 435 \returns A CardBuilder representing the new BCardLayout. 436 437 \since Haiku R1 438*/ 439 440 441//! @} 442 443 444/*! 445 \name Collapsability of elements 446*/ 447 448 449//! @{ 450 451 452/*! 453 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetCollapsible( 454 bool collapsible) 455 \copydoc BSplitView::SetCollapsible(bool) 456 457 \see BSplitView::SetCollapsible(bool) 458*/ 459 460 461/*! 462 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetCollapsible( 463 int32 index, bool collapsible) 464 \copydoc BSplitView::SetCollapsible(int32, bool) 465 466 \see BSplitView::SetCollapsible(int32, bool) 467*/ 468 469 470/*! 471 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetCollapsible( 472 int32 first, int32 last, bool collapsible) 473 \copydoc BSplitView::SetCollapsible(int32, int32, bool) 474 475 \see BSplitView::SetCollapsible(int32, int32, bool) 476*/ 477 478 479//! @} 480 481 482/*! 483 \name Insets 484*/ 485 486 487//! @{ 488 489 490/*! 491 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetInsets( 492 float left, float top, float right, float bottom) 493 \copydoc BSplitView::SetInsets(float, float, float, float) 494 495 \see BSplitView::SetInsets(float, float, float, float) 496*/ 497 498 499/*! 500 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetInsets( 501 float horizontal, float vertical) 502 \copydoc BSplitView::SetInsets(float, float) 503 504 \see BSplitView::SetInsets(float, float) 505*/ 506 507 508/*! 509 \fn ThisBuilder& BLayoutBuilder::Split<ParentBuilder>::SetInsets( 510 float insets) 511 \copydoc BSplitView::SetInsets(float) 512 513 \see BSplitView::SetInsets(float) 514*/ 515 516 517//! @} 518