haiku/docs/user/interface/GroupLayout.dox
Niels Sascha Reedijk 6758018a21 HaikuBook: add remaining layout class documentation
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>
2020-04-18 18:24:51 +00:00

224 lines
5.1 KiB
Plaintext

/*
* Copyright 2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alex Wilson, yourpalal2@gmail.com
*
* Corresponds to:
* headers/os/interface/GroupLayout.h rev 38207
* src/kits/interface/GroupLayout.cpp rev 38207
*/
/*!
\file GroupLayout.h
\ingroup layout
\ingroup libbe
\brief Describes the BGroupLayout class.
*/
/*!
\class BGroupLayout
\ingroup layout
\ingroup libbe
\brief The BGroupLayout class is a simple BLayout subclass that
arranges the items it holds within a vertical or horizontal box.
In a horizontal BGroupLayout, each BLayoutItem is given the same vertical
area, but different horizontal areas. In a vertical BGroupLayout, each
BLayoutItem is given the same horizontal area, but different vertical areas.
Despite this, because of alignment and size constraints, the items in a
BGroupLayout may not all use the same vertical or horizontal area on screen.
Some BLayoutItems may have alignments that cause them to sit at the bottom
of the area they are given, for example. This is not a flaw or bug, but
something that you may come across when using this class.
In a BGroupLayout, each BLayoutItem or BView has a weight, the default
weight is \c 1.0f. When a BGroupLayout is not given enough space to satisfy
the minimum sizes of all items, then space is distributed according to
weight, while still attempting to satisfy minimum size constraints.
Weighting is scaled over the sum weight of all the items in this layout.
If a particular item has half of the sum weight of all items, it
will get half of the total space, unless this exceeds that item's maximum
size. If the space for an item exceeds the items maximum size, the excess
will be distributed to other items.
\warning This class is not yet finalized, if you use it in your software
assume that it will break some time in the future.
\since Haiku R1
*/
/*!
\fn BGroupLayout::BGroupLayout(orientation orientation, float spacing)
\brief Creates a new BGroupLayout.
\param orientation The orientation of this BGroupLayout.
\param spacing The spacing between BLayoutItems in this BGroupLayout.
\since Haiku R1
*/
/*!
\fn BGroupLayout::~BGroupLayout()
\brief Destructor method.
Standard Destructor.
\since Haiku R1
*/
/*!
\fn BGroupLayout::BGroupLayout(BMessage* from)
\brief Archive constructor.
\param from The message to construct the BGroupLayout from.
\since Haiku R1
*/
/*!
\fn float BGroupLayout::Spacing() const
\brief Get the amount of spacing (in pixels) between each item.
\since Haiku R1
*/
/*!
\fn void BGroupLayout::SetSpacing(float spacing)
\brief Set the amount of spacing (in pixels) between each item.
\since Haiku R1
*/
/*!
\fn orientation BGroupLayout::Orientation() const
\brief Get the #orientation of this BGroupLayout.
\since Haiku R1
*/
/*!
\fn void BGroupLayout::SetOrientation(orientation orientation)
\brief Set the #orientation of this BGroupLayout.
\param orientation The new #orientation of this BGroupLayout.
\since Haiku R1
*/
/*!
\fn float BGroupLayout::ItemWeight(int32 index) const
\brief Get the weight of the item at \a index.
\since Haiku R1
*/
/*!
\fn void BGroupLayout::SetItemWeight(int32 index, float weight)
\brief Set the weight of the item at \a index.
\since Haiku R1
*/
/*!
\fn BLayoutItem* BGroupLayout::AddView(BView* child)
\brief Adds \a child to this layout as the last item. In a vertical
BGroupLayout, \a child will be on the right, in a horizontal
BGroupLayout, \a child will be at the bottom.
\a child will have a weight of \c 1.0f.
\since Haiku R1
*/
/*!
\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child)
\brief Adds \a child to this layout at \a index.
\a child will have a weight of \c 1.0f.
\since Haiku R1
*/
/*!
\fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight)
\brief Adds \a child to the end of this layout with a weight of
\a weight.
\since Haiku R1
*/
/*!
\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child,
float weight)
\brief Adds \a child this layout at \a index with a weight of
\a weight.
\since Haiku R1
*/
/*!
\fn bool BGroupLayout::AddItem(BLayoutItem* item)
\brief Adds \a item to this layout as the last item. In a vertical
BGroupLayout, \a item will be on the right, in a horizontal
BGroupLayout, \a item will be at the bottom.
\a item will have a weight of \c 1.0f.
\since Haiku R1
*/
/*!
\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item)
\brief Adds \a item to this layout at \a index.
\a item will have a weight of \c 1.0f.
\since Haiku R1
*/
/*!
\fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight)
\brief Adds \a item to the end of this layout with a weight of
\a weight.
\since Haiku R1
*/
/*!
\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item,
float weight)
\brief Adds \a item this layout at \a index with a weight of
\a weight.
\since Haiku R1
*/
/*!
\fn static BArchivable* BGroupLayout::Instantiate(BMessage *from)
\brief Instantiate the layout from the message \a from.
\since Haiku R1
*/