2011-08-10 01:46:13 +04:00
|
|
|
/*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Copyright 2010 Haiku, Inc. All rights reserved.
|
2011-08-10 01:46:13 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Authors:
|
|
|
|
* Alex Wilson, yourpalal2@gmail.com
|
|
|
|
*
|
2011-08-10 01:46:13 +04:00
|
|
|
* Corresponds to:
|
2013-02-07 06:05:00 +04:00
|
|
|
* headers/os/interface/GridLayout.h rev 38207
|
|
|
|
* src/kits/interface/GridLayout.cpp rev 38207
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file GridLayout.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
|
|
|
\ingroup layout
|
|
|
|
\ingroup libbe
|
2013-01-15 06:11:15 +04:00
|
|
|
\brief Provides the BGridLayout class.
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-10-23 06:33:08 +04:00
|
|
|
/*!
|
|
|
|
\class BGridLayout
|
|
|
|
\ingroup interface
|
|
|
|
\ingroup layout
|
|
|
|
\ingroup libbe
|
|
|
|
\brief The BGridLayout class a BLayout subclass that arranges the items it
|
2013-02-07 06:05:00 +04:00
|
|
|
holds in a grid.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
Each item in a BGridLayout receives a rectangular area which can span more
|
|
|
|
than a single row or column. The indexing of columns and rows is zero based,
|
|
|
|
starting in the top-left.
|
|
|
|
|
|
|
|
\warning This class is not yet finalized, if you use it in your software
|
2014-06-14 01:25:02 +04:00
|
|
|
assume that it will break some time in the future.
|
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGridLayout::BGridLayout(float horizontal = 0.0f, float vertical = 0.0f)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Create a BGridLayout with \a horizontal space between columns and
|
2014-06-14 01:25:02 +04:00
|
|
|
\a vertical space between rows.
|
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGridLayout::BGridLayout(BMessage* from)
|
|
|
|
\brief Archive constructor.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param from The message to build the BGridLayout from.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BGridLayout::~BGridLayout()
|
|
|
|
\brief Destructor method.
|
|
|
|
|
|
|
|
Standard Destructor.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BGridLayout::CountColumns() const
|
|
|
|
\brief Returns the number of active columns in this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\returns The number of active columns in the layout.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BGridLayout::CountRows() const
|
|
|
|
\brief Returns the number of active rows in this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\returns the number of active rows in the layout.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::HorizontalSpacing() const
|
|
|
|
\brief Returns the spacing between columns for this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\returns The spacing between columns for the layout.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::VerticalSpacing() const
|
|
|
|
\brief Returns the spacing between rows for this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\returns The spacing between rows for the layout.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetHorizontalSpacing(float spacing);
|
|
|
|
\brief Set the spacing between columns for this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param spacing The number of pixels of spacing to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetVerticalSpacing(float spacing)
|
|
|
|
\brief Set the spacing between rows for this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param spacing The number of pixels of spacing to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetSpacing(float horizontal, float vertical)
|
|
|
|
\brief Set the spacing between columns and rows for this layout.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param horizontal The number of \a horizontal pixels of spacing to set.
|
|
|
|
\param vertical The number of \a vertical pixels of spacing to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::ColumnWeight(int32 column) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the weight for the specified \a column.
|
|
|
|
|
|
|
|
\returns The \a column weight as a float.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetColumnWeight(int32 column, float weight)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Set the weight for \a column to \a weight.
|
|
|
|
|
|
|
|
\param column The column to set.
|
|
|
|
\param weight The weight to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::MinColumnWidth(int32 column) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the minimum width for \a column.
|
|
|
|
|
|
|
|
\param column The column to get the minimum width of.
|
|
|
|
|
|
|
|
\returns The minimum width for \a column as a float.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetMinColumnWidth(int32 column, float width)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Sets the minimum width for \a column to \a width.
|
|
|
|
|
|
|
|
\param column The \a column to set the minimum width of.
|
|
|
|
\param width The \a width to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::MaxColumnWidth(int32 column) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the maximum width for \a column.
|
|
|
|
|
|
|
|
\param column The column to get the maximum width of.
|
|
|
|
|
|
|
|
\returns The maximum width for \a column as a float.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetMaxColumnWidth(int32 column, float width)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Sets the maximum width for \a column to \a width.
|
|
|
|
|
|
|
|
\param column The column to set the maximum width of.
|
|
|
|
\param width The \a width to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::RowWeight(int32 row) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the weight of the specified \a row.
|
|
|
|
|
|
|
|
\returns The weight of the \a row.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetRowWeight(int32 row, float weight)
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Set the weight of \a row to \a weight.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param row The \a row number.
|
2014-06-14 01:25:02 +04:00
|
|
|
\param weight The \a weight to set.
|
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-10-04 18:52:49 +04:00
|
|
|
\fn float BGridLayout::MinRowHeight(int row) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the minimum height for \a row.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetMinRowHeight(int32 row, float height)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Sets the minimum height for \a row to \a width.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn float BGridLayout::MaxRowHeight(int32 row) const
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Returns the maximum height for \a row.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BGridLayout::SetMaxRowHeight(int32 row, float height)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Sets the maximum height for \a row to \a width.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddView(BView* child)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Adds \a child to this layout in the first empty cell available, or
|
2010-10-23 06:33:08 +04:00
|
|
|
in a new column in the first row if there are no emtpy cells.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddView(int32 index, BView* child);
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief BGridLayout::AddView(BView*)
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddView(BView* child, int32 column, int32 row,
|
|
|
|
int32 columnCount = 1, int32 rowCount = 1);
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Adds \a child to this layout at \a column and \a row. \a child may
|
2014-06-14 01:25:02 +04:00
|
|
|
also occupy additional cells if \a columnCount or \a rowCount are
|
|
|
|
greater than \c 1.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
|
|
|
Fails and returns NULL if the requested area is occupied, or if internal
|
|
|
|
memory allocations fail.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Adds \a item to this layout in the first empty cell available, or
|
2014-06-14 01:25:02 +04:00
|
|
|
in a new column in the first row if there are no emtpy cells.
|
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddItem(int32 index, BLayoutItem* item);
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief BGridLayout::AddItem(BLayoutItem*)
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item, int32 column,
|
|
|
|
int32 row, int32 columnCount = 1, int32 rowCount = 1);
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Adds \a item to this layout at \a column and \a row. \a item may
|
2014-06-14 01:25:02 +04:00
|
|
|
also occupy additional cells if \a columnCount or \a rowCount are
|
|
|
|
greater than 1.
|
2010-10-23 06:33:08 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Fails and returns \c NULL if the requested area is occupied, or if internal
|
2010-10-23 06:33:08 +04:00
|
|
|
memory allocations fail.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2010-10-23 06:33:08 +04:00
|
|
|
*/
|