2011-08-10 01:46:13 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Documentation by:
|
|
|
|
* Alex Wilson <yourpalal2@gmail.com>
|
|
|
|
* Corresponds to:
|
|
|
|
* /trunk/headers/os/interface/TwoDimensionalLayout.h rev 38207
|
|
|
|
* /trunk/src/kits/interface/TwoDimensionalLayout.cpp rev 38207
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file TwoDimensionalLayout.h
|
|
|
|
\brief Defines the BTwoDimensionalLayout class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\class BTwoDimensionalLayout
|
|
|
|
\ingroup interface
|
|
|
|
\ingroup layout
|
|
|
|
\ingroup libbe
|
|
|
|
|
|
|
|
\brief Abstract BLayout subclass arranging items within rows and columns.
|
|
|
|
|
|
|
|
This class manages all the tricky work of actually positioning/resizing
|
|
|
|
items, as well as calculating size constraints and providing extra features,
|
2011-08-10 01:46:13 +04:00
|
|
|
such as spacing/insets and alignment of multiple
|
|
|
|
BTwoDimensionalLayout's. Derived classes need only implement a few hook
|
|
|
|
methods to get a working layout.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\warning This class is not yet finalized, if you use it in your software
|
|
|
|
assume that it will break some time in the future.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\struct BTwoDimensionalLayout::ColumnRowConstraints
|
|
|
|
\brief Used by BTwoDimensionalLayout derived classes to communicate the
|
|
|
|
size constraints for a given column or row to the
|
|
|
|
BTwoDimensionalLayout class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\struct BTwoDimensionalLayout::Dimensions
|
|
|
|
\brief Used by BTwoDimensionalLayout derived classes to communicate the
|
|
|
|
positioning and size of a BLayoutItem, in terms of columns and rows to
|
|
|
|
the BTwoDimensionalLayout class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BTwoDimensionalLayout::AlignLayoutWith(
|
2011-08-10 01:46:13 +04:00
|
|
|
BTwoDimensionalLayout* other, enum orientation orientation)
|
|
|
|
\brief Align the BLayoutItem's in the specified \a orientation within
|
|
|
|
two or more BTwoDimensionalLayout's.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
When two (or more) BTwoDimensionalLayout's are aligned within a
|
|
|
|
certain \a orientation, then the BLayoutItem's within those
|
|
|
|
BTwoDimensionalLayout's will have identical widths or heights
|
|
|
|
(depending on how the BTwoDimensionalLayout's are aligned.)
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
If you align two BGroupLayout's horizontally for example, then the
|
|
|
|
BLayoutItem at index 0 in both BGroupLayout's will be given the same
|
|
|
|
horizontal area. The same is true for the BLayoutItem at index 1,
|
|
|
|
2, etc. Not all BTwoDimensionalLayout's have to have an item at each
|
|
|
|
index for the alignment to proceed.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
\param other The BTwoDimensionalLayout to be aligned with.
|
2011-08-10 01:46:13 +04:00
|
|
|
\param orientation The \a orientation on which to be aligned.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BTwoDimensionalLayout::SetInsets(float left, float top,
|
|
|
|
float right, float bottom)
|
|
|
|
\brief Set the insets for this BTwoDimensionalLayout (in pixels).
|
|
|
|
|
|
|
|
Set the spacing around the edges of this BTwoDimensionalLayout. If you
|
2011-08-10 01:46:13 +04:00
|
|
|
pass \c B_USE_DEFAULT_SPACING for a certain parameter, that parameter will
|
2010-10-23 06:33:08 +04:00
|
|
|
be replaced with the value returned by BControlLook::DefaultItemSpacing().
|
|
|
|
|
|
|
|
\see BTwoDimensionalLayout::GetInsets();
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BTwoDimensionalLayout::GetInsets(float* left, float* top,
|
|
|
|
float* right, float* bottom) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Get the insets for the BTwoDimensionalLayout (in pixels).
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Passing \c NULL for any parameter is not an error, those parameters will
|
2010-10-23 06:33:08 +04:00
|
|
|
be ignored.
|
|
|
|
|
|
|
|
\see BTwoDimensionalLayout::SetInsets();
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name BTwoDimensionalLayout Hook methods
|
|
|
|
|
|
|
|
These methods are called automatically as needed during layout, and
|
|
|
|
provide the BTwoDimensionalLayout class with the necessary information
|
2011-08-10 01:46:13 +04:00
|
|
|
to properly layout the BLayoutItem in this BTwoDimensionalLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
2011-08-10 01:46:13 +04:00
|
|
|
\fn void BTwoDimensionalLayout::PrepareItems(enum orientation orientation)
|
|
|
|
\brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass
|
|
|
|
for layout within a certain \a orientation.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
This is a good place to update cache information that will be used in
|
|
|
|
other hook methods, for example.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BTwoDimensionalLayout::HasMultiColumnItems()
|
|
|
|
\brief Tests whether or not this BTwoDimensionalLayout contains any
|
2011-08-10 01:46:13 +04:00
|
|
|
BLayoutItem's spanning more than one column.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
The BTwoDimensionalLayout implementation returns false.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BTwoDimensionalLayout::HasMultiRowItems()
|
|
|
|
\brief Tests whether or not this BTwoDimensionalLayout contains any
|
2011-08-10 01:46:13 +04:00
|
|
|
BLayoutItem's spanning more than one row.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
The BTwoDimensionalLayout implementation returns false.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BTwoDimensionalLayout::InternalCountColumns()
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Get the number of columns in the BTwoDimensionalLayout.
|
|
|
|
|
|
|
|
\returns The number of columns in the BTwoDimensionalLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BTwoDimensionalLayout::InternalCountRows()
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Get the number of rows in the BTwoDimensionalLayout.
|
|
|
|
|
|
|
|
\returns The number of rows in the BTwoDimensionalLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2011-08-10 01:46:13 +04:00
|
|
|
\fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation
|
|
|
|
orientation, int32 index, ColumnRowConstraints* constraints)
|
2010-10-23 06:33:08 +04:00
|
|
|
\brief Fill in the ColumnRowConstraints for a certain column or row in
|
2011-08-10 01:46:13 +04:00
|
|
|
the BTwoDimensionalLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
This method is used to communicate the size constraints and weight for
|
2011-08-10 01:46:13 +04:00
|
|
|
a given row/column in the BTwoDimensionalLayout.
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item,
|
|
|
|
Dimensions* dimensions)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Tell the base class what column and row a BLayoutItem is in as
|
2010-10-23 06:33:08 +04:00
|
|
|
well as how many columns and rows it covers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
//! @}
|