6758018a21
This is the final contribution to #15368 * Tried to share more documentation in the various BLayoutBuilder classes * Add missing GridView, GroupView, SpaceLayoutItem * Also added AbstractLayoutItem, but hide the actual documentation behind an `INTERNAL` conditional block. This block identifier can be used to document parts of the API, to then hide them during a regular Doxygen run. * Do some cleanup on other layout classes; add missing members, etc. * The actual generated BLayoutBuilder::* html is a mess. I should investigate this at a later time. Especially the copied members seem to mix type definitions with member documentation. It is odd. Not unlikely to be a Doxygen bug. * The general documentation for the layout system could use an overhaul as well, but this is for later. Change-Id: I6db9ef105b4ae6de0f1ebb917f86f8b1c0d4ea2e Reviewed-on: https://review.haiku-os.org/c/haiku/+/2491 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
429 lines
9.0 KiB
Plaintext
429 lines
9.0 KiB
Plaintext
/*
|
|
* 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
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::ThisBuilder
|
|
*/
|
|
|
|
|
|
/*!
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::GroupBuilder
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GroupBuilder
|
|
*/
|
|
|
|
|
|
/*!
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::GridBuilder
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GridBuilder
|
|
*/
|
|
|
|
|
|
/*!
|
|
\typedef BLayoutBuilder::Cards<ParentBuilder>::SplitBuilder
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SplitBuilder
|
|
*/
|
|
|
|
|
|
/*!
|
|
\typedef BLayoutBuilder::Cards<ThisBuilder>::CardBuilder
|
|
\copydoc BLayoutBuilder::Group<ThisBuilder>::CardBuilder
|
|
*/
|
|
|
|
|
|
/*!
|
|
\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
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::Cards(BCardView* view)
|
|
\brief Creates a builder targeting an existing BCardView.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\name Accessors
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn BCardLayout* BLayoutBuilder::Cards<ParentBuilder>::Layout() const
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::Layout()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BView* BLayoutBuilder::Cards<ParentBuilder>::View() const
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::View()
|
|
*/
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetLayout(
|
|
BCardLayout** _layout)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GetLayout()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::GetView(
|
|
BView** _view)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::GetView()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn BLayoutBuilder::Cards<ParentBuilder>::operator BCardLayout*()
|
|
\brief Cast this builder into the layout object it represents.
|
|
|
|
\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)
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
|
|
orientation orientation, float spacing, float weight)
|
|
|
|
\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)
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
|
|
BGroupLayout* groupLayout, float weight)
|
|
|
|
\param groupView The BGroupView to be added.
|
|
|
|
\returns A GroupBuilder representing the layout of the \a groupView.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn GroupBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGroup(
|
|
BGroupLayout* groupLayout)
|
|
\copybrief GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView*
|
|
groupView, float weight)
|
|
|
|
\param groupLayout The BGroupLayout to be added.
|
|
|
|
\returns A GroupBuilder representing the \a groupLayout.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn GridBuilder BLayoutBuilder::Cards<ParentBuilder>::AddGrid(
|
|
float horizontalSpacing, float verticalSpacing)
|
|
\copydoc GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
float horizontalSpacing, float verticalSpacing, float weight)
|
|
|
|
\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)
|
|
\copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
BGridLayout* gridLayout, float weight)
|
|
|
|
\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)
|
|
\copybrief GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
|
|
BGridView* gridView, float weight)
|
|
|
|
\param gridView The BGridView to be added and used to construct the
|
|
returned GridBuilder.
|
|
|
|
\returns A GridBuilder representing the layout of the \a gridView.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn SplitBuilder BLayoutBuilder::Cards<ParentBuilder>::AddSplit(
|
|
orientation orientation, float spacing)
|
|
\copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
|
|
orientation orientation, float spacing, float weight)
|
|
|
|
\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)
|
|
\copybrief SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
|
|
BSplitView* splitView, float weight)
|
|
|
|
\param splitView The BSplitView to be added.
|
|
|
|
\returns A SplitBuilder representing the \a splitView.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards()
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
float weight)
|
|
|
|
\returns A CardBuilder representing the new BCardLayout.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards(
|
|
BCardLayout* cardLayout)
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
BCardLayout* cardLayout, float weight)
|
|
|
|
\param cardLayout The existing layout that will be added to the underlying
|
|
BSplitView.
|
|
|
|
\returns A CardBuilder representing the \a cardLayout.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn CardBuilder BLayoutBuilder::Cards<ParentBuilder>::AddCards(
|
|
BCardView* cardView)
|
|
\copybrief CardBuilder BLayoutBuilder::Group<ParentBuilder>::AddCards(
|
|
BCardView* cardView, float weight)
|
|
|
|
\param cardView The existing view that will be added to the underlying
|
|
BSplitView.
|
|
|
|
\returns A CardBuilder representing the layout of t he \a cardView.
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\name Explicit Sizes and Alignment
|
|
*/
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMinSize(
|
|
BSize size)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMinSize()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitMaxSize(
|
|
BSize size)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitMaxSize()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitPreferredSize(
|
|
BSize size)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitPreferredSize()
|
|
*/
|
|
|
|
|
|
/*!
|
|
\fn ThisBuilder& BLayoutBuilder::Cards<ParentBuilder>::SetExplicitAlignment(
|
|
BAlignment alignment)
|
|
\copydoc BLayoutBuilder::Group<ParentBuilder>::SetExplicitAlignment()
|
|
*/
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
/*!
|
|
\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)
|
|
*/
|
|
|
|
|
|
//! @}
|