/* * 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/TwoDimensionalLayout.h rev 38207 * src/kits/interface/TwoDimensionalLayout.cpp rev 38207 */ /*! \file TwoDimensionalLayout.h \ingroup interface \ingroup layout \ingroup libbe \brief Defines the BTwoDimensionalLayout class. */ /*! \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, such as spacing/insets and alignment of multiple BTwoDimensionalLayout's. Derived classes need only implement a few hook methods to get a working layout. \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 */ /*! \struct BTwoDimensionalLayout::ColumnRowConstraints \brief Used by BTwoDimensionalLayout derived classes to communicate the size constraints for a given column or row to the BTwoDimensionalLayout class. \since Haiku R1 */ /*! \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. \since Haiku R1 */ /*! \fn void BTwoDimensionalLayout::AlignLayoutWith( BTwoDimensionalLayout* other, orientation orientation) \brief Align the BLayoutItem's in the specified \a orientation within two or more BTwoDimensionalLayout's. 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.) 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. \param other The BTwoDimensionalLayout to be aligned with. \param orientation The \a orientation on which to be aligned. \since Haiku R1 */ /*! \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 pass \c B_USE_DEFAULT_SPACING for a certain parameter, that parameter will be replaced with the value returned by BControlLook::DefaultItemSpacing(). \see BTwoDimensionalLayout::GetInsets(); \since Haiku R1 */ /*! \fn void BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right, float* bottom) const \brief Get the insets for the BTwoDimensionalLayout (in pixels). Passing \c NULL for any parameter is not an error, those parameters will be ignored. \see BTwoDimensionalLayout::SetInsets(); \since Haiku R1 */ /*! \name Hook Methods These methods are called automatically as needed during layout, and provide the BTwoDimensionalLayout class with the necessary information to properly layout the BLayoutItem in this BTwoDimensionalLayout. */ //! @{ /*! \fn void BTwoDimensionalLayout::PrepareItems(orientation orientation) \brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass for layout within a certain \a orientation. This is a good place to update cache information that will be used in other hook methods, for example. \since Haiku R1 */ /*! \fn bool BTwoDimensionalLayout::HasMultiColumnItems() \brief Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one column. The BTwoDimensionalLayout implementation returns false. \since Haiku R1 */ /*! \fn bool BTwoDimensionalLayout::HasMultiRowItems() \brief Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one row. The BTwoDimensionalLayout implementation returns false. \since Haiku R1 */ /*! \fn int32 BTwoDimensionalLayout::InternalCountColumns() \brief Get the number of columns in the BTwoDimensionalLayout. \returns The number of columns in the BTwoDimensionalLayout. \since Haiku R1 */ /*! \fn int32 BTwoDimensionalLayout::InternalCountRows() \brief Get the number of rows in the BTwoDimensionalLayout. \returns The number of rows in the BTwoDimensionalLayout. \since Haiku R1 */ /*! \fn void BTwoDimensionalLayout::GetColumnRowConstraints( orientation orientation, int32 index, ColumnRowConstraints* constraints) \brief Fill in the ColumnRowConstraints for a certain column or row in the BTwoDimensionalLayout. This method is used to communicate the size constraints and weight for a given row/column in the BTwoDimensionalLayout. \since Haiku R1 */ /*! \fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item, Dimensions* dimensions) \brief Tell the base class what column and row a BLayoutItem is in as well as how many columns and rows it covers. \since Haiku R1 */ //! @}