2020-04-06 23:05:24 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Niels Sascha Reedijk, niels.reedijk@gmail.com
|
|
|
|
*
|
|
|
|
* Reviewers:
|
|
|
|
* Adrien Destugues, pulkomandy@pulkomandy.tk
|
|
|
|
*
|
|
|
|
* Corresponds to:
|
|
|
|
* headers/os/interface/LayoutBuilder.h rev 49977
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BLayoutBuilder::Cards<>
|
|
|
|
\ingroup layout
|
|
|
|
\ingroup libbe
|
|
|
|
\brief BLayoutBuilder::Base subclass for building BCardLayouts.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
|
|
|
|
The BCardLayout class is a simple BLayout subclass that arranges the
|
|
|
|
items as a stack of cards with only one card being on top and visible to
|
|
|
|
the user.
|
|
|
|
|
|
|
|
For a detailed view on the properties, see the \link BCardLayout class
|
|
|
|
description\endlink.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::ThisBuilder
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::ThisBuilder
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-04-18 09:27:42 +03:00
|
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::GroupBuilder
|
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GroupBuilder
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-04-18 09:27:42 +03:00
|
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::GridBuilder
|
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GridBuilder
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-04-18 09:27:42 +03:00
|
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::SplitBuilder
|
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SplitBuilder
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\typedef BLayoutBuilder::Cards<ThisBuilder>::CardBuilder
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ThisBuilder>::CardBuilder
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards()
|
|
|
|
\brief Creates a builder for BCardLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BWindow* window)
|
|
|
|
\brief Creates a new builder for BCardLayout, and attaches it to a
|
|
|
|
\a window.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BView* view)
|
|
|
|
\brief Creates a new builder for BCardLayout, and attaches it to a
|
|
|
|
\a view.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BCardLayout* layout)
|
|
|
|
\brief Creates a builder targeting an existing BCardLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-04-18 09:27:42 +03:00
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BCardView* view)
|
2020-04-06 23:05:24 +03:00
|
|
|
\brief Creates a builder targeting an existing BCardView.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Accessors
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BCardLayout* BLayoutBuilder::Cards<ParentBuilder>::Layout() const
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::Layout()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BView* BLayoutBuilder::Cards<ParentBuilder>::View() const
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::View()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetLayout(
|
|
|
|
BCardLayout** _layout)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GetLayout()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetView(
|
|
|
|
BView** _view)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GetView()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::operator BCardLayout*()
|
2020-04-18 09:27:42 +03:00
|
|
|
\brief Cast this builder into the layout object it represents.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Adding BViews and BLayoutItems
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::Add(BView* view)
|
|
|
|
\brief Add a \a view to the underlying BCardLayout.
|
|
|
|
|
|
|
|
The layout item will be added as a card at the end of the stack.
|
|
|
|
|
|
|
|
\param view The BView to be added. The underlying BCardLayout will take
|
|
|
|
ownership of the object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::Add(
|
|
|
|
BLayoutItem* item)
|
|
|
|
\brief Add a \a item to the underlying BCardLayout.
|
|
|
|
|
|
|
|
The layout item will be added as a card at the end of the stack.
|
|
|
|
|
|
|
|
\param item The BLayoutItem to be added. The underlying BCardLayout will
|
|
|
|
take ownership of the object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Adding BLayouts and their BView Pairs
|
|
|
|
|
|
|
|
A set of methods that add a BLayout or BView subclass and return a
|
|
|
|
BLayoutBuilder::Base subclass representing the newly added object. These
|
|
|
|
methods push a new builder on top of the stack, you will not be using
|
|
|
|
\c this builder again until you call End().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup(
|
|
|
|
orientation orientation, float spacing)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
|
|
|
|
orientation orientation, float spacing, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param orientation The orientation to use for the new BGroupLayout.
|
|
|
|
\param spacing The spacing to use for the new BGroupLayout.
|
|
|
|
|
|
|
|
\returns A GroupBuilder representing the newly created BGroupLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup(
|
|
|
|
BGroupView* groupView)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
|
|
|
|
BGroupLayout* groupLayout, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param groupView The BGroupView to be added.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A GroupBuilder representing the layout of the \a groupView.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup(
|
|
|
|
BGroupLayout* groupLayout)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView*
|
|
|
|
groupView, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param groupLayout The BGroupLayout to be added.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A GroupBuilder representing the \a groupLayout.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid(
|
|
|
|
float horizontalSpacing, float verticalSpacing)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
|
|
float horizontalSpacing, float verticalSpacing, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param horizontalSpacing The horizontal spacing for the new BGridLayout.
|
|
|
|
\param verticalSpacing The vertical spacing for the new BGridLayout.
|
|
|
|
|
|
|
|
\returns A GridBuilder representing the newly created BGridLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid(
|
|
|
|
BGridLayout* gridLayout)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
|
|
BGridLayout* gridLayout, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param gridLayout The BGridLayout to be added and used to construct the
|
|
|
|
returned GridBuilder.
|
|
|
|
|
|
|
|
\returns A GridBuilder representing \a gridLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid(
|
|
|
|
BGridView* gridView)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
|
|
BGridView* gridView, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param gridView The BGridView to be added and used to construct the
|
|
|
|
returned GridBuilder.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A GridBuilder representing the layout of the \a gridView.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn SplitBuilder BLayoutBuilder::Cards<ParentBuilder>::AddSplit(
|
|
|
|
orientation orientation, float spacing)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
|
|
|
|
orientation orientation, float spacing, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param orientation The orientation of the new BSplitView.
|
|
|
|
\param spacing The spacing of the new BSplitView.
|
|
|
|
|
|
|
|
\returns A SplitBuilder representing the new BSplitView.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn SplitBuilder BLayoutBuilder::Cards<ParentBuilder>::AddSplit(
|
|
|
|
BSplitView* splitView)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
|
|
|
|
BSplitView* splitView, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param splitView The BSplitView to be added.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A SplitBuilder representing the \a splitView.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards()
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
|
|
float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\returns A CardBuilder representing the new BCardLayout.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards(
|
|
|
|
BCardLayout* cardLayout)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
|
|
BCardLayout* cardLayout, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param cardLayout The existing layout that will be added to the underlying
|
|
|
|
BSplitView.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A CardBuilder representing the \a cardLayout.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards(
|
|
|
|
BCardView* cardView)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
|
|
BCardView* cardView, float weight)
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\param cardView The existing view that will be added to the underlying
|
|
|
|
BSplitView.
|
|
|
|
|
2020-04-18 09:27:42 +03:00
|
|
|
\returns A CardBuilder representing the layout of t he \a cardView.
|
2020-04-06 23:05:24 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-04-18 09:27:42 +03:00
|
|
|
\name Explicit Sizes and Alignment
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMinSize(
|
|
|
|
BSize size)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMinSize()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMaxSize(
|
|
|
|
BSize size)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMaxSize()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitPreferredSize(
|
|
|
|
BSize size)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitPreferredSize()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitAlignment(
|
|
|
|
BAlignment alignment)
|
2020-04-18 09:27:42 +03:00
|
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitAlignment()
|
2020-04-06 23:05:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Visible Item
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetVisibleItem(
|
|
|
|
int32 index)
|
|
|
|
\brief Set the current visible item to the item at \a index.
|
|
|
|
|
|
|
|
\see BCardLayout::SetVisibleItem(int32)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|