1/* 2 * Copyright 2010 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alex Wilson, yourpalal2@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/interface/TwoDimensionalLayout.h rev 38207 10 * src/kits/interface/TwoDimensionalLayout.cpp rev 38207 11 */ 12 13 14/*! 15 \file TwoDimensionalLayout.h 16 \ingroup interface 17 \ingroup layout 18 \ingroup libbe 19 \brief Defines the BTwoDimensionalLayout class. 20*/ 21 22 23/*! 24 \class BTwoDimensionalLayout 25 \ingroup interface 26 \ingroup layout 27 \ingroup libbe 28 \brief Abstract BLayout subclass arranging items within rows and columns. 29 30 This class manages all the tricky work of actually positioning/resizing 31 items, as well as calculating size constraints and providing extra features, 32 such as spacing/insets and alignment of multiple 33 BTwoDimensionalLayout's. Derived classes need only implement a few hook 34 methods to get a working layout. 35 36 \warning This class is not yet finalized, if you use it in your software 37 assume that it will break some time in the future. 38*/ 39 40 41/*! 42 \struct BTwoDimensionalLayout::ColumnRowConstraints 43 \brief Used by BTwoDimensionalLayout derived classes to communicate the 44 size constraints for a given column or row to the 45 BTwoDimensionalLayout class. 46*/ 47 48 49/*! 50 \struct BTwoDimensionalLayout::Dimensions 51 \brief Used by BTwoDimensionalLayout derived classes to communicate the 52 positioning and size of a BLayoutItem, in terms of columns and rows to 53 the BTwoDimensionalLayout class. 54*/ 55 56 57/*! 58 \fn void BTwoDimensionalLayout::AlignLayoutWith( 59 BTwoDimensionalLayout* other, orientation orientation) 60 \brief Align the BLayoutItem's in the specified \a orientation within 61 two or more BTwoDimensionalLayout's. 62 63 When two (or more) BTwoDimensionalLayout's are aligned within a 64 certain \a orientation, then the BLayoutItem's within those 65 BTwoDimensionalLayout's will have identical widths or heights 66 (depending on how the BTwoDimensionalLayout's are aligned.) 67 68 If you align two BGroupLayout's horizontally for example, then the 69 BLayoutItem at index 0 in both BGroupLayout's will be given the same 70 horizontal area. The same is true for the BLayoutItem at index 1, 71 2, etc. Not all BTwoDimensionalLayout's have to have an item at each 72 index for the alignment to proceed. 73 74 \param other The BTwoDimensionalLayout to be aligned with. 75 \param orientation The \a orientation on which to be aligned. 76*/ 77 78 79/*! 80 \fn void BTwoDimensionalLayout::SetInsets(float left, float top, 81 float right, float bottom) 82 \brief Set the insets for this BTwoDimensionalLayout (in pixels). 83 84 Set the spacing around the edges of this BTwoDimensionalLayout. If you 85 pass \c B_USE_DEFAULT_SPACING for a certain parameter, that parameter will 86 be replaced with the value returned by BControlLook::DefaultItemSpacing(). 87 88 \see BTwoDimensionalLayout::GetInsets(); 89*/ 90 91 92/*! 93 \fn void BTwoDimensionalLayout::GetInsets(float* left, float* top, 94 float* right, float* bottom) const 95 \brief Get the insets for the BTwoDimensionalLayout (in pixels). 96 97 Passing \c NULL for any parameter is not an error, those parameters will 98 be ignored. 99 100 \see BTwoDimensionalLayout::SetInsets(); 101*/ 102 103 104/*! 105 \name BTwoDimensionalLayout Hook methods 106 107 These methods are called automatically as needed during layout, and 108 provide the BTwoDimensionalLayout class with the necessary information 109 to properly layout the BLayoutItem in this BTwoDimensionalLayout. 110*/ 111 112 113//! @{ 114 115 116/*! 117 \fn void BTwoDimensionalLayout::PrepareItems(orientation orientation) 118 \brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass 119 for layout within a certain \a orientation. 120 121 This is a good place to update cache information that will be used in 122 other hook methods, for example. 123*/ 124 125 126/*! 127 \fn bool BTwoDimensionalLayout::HasMultiColumnItems() 128 \brief Tests whether or not this BTwoDimensionalLayout contains any 129 BLayoutItem's spanning more than one column. 130 131 The BTwoDimensionalLayout implementation returns false. 132*/ 133 134 135/*! 136 \fn bool BTwoDimensionalLayout::HasMultiRowItems() 137 \brief Tests whether or not this BTwoDimensionalLayout contains any 138 BLayoutItem's spanning more than one row. 139 140 The BTwoDimensionalLayout implementation returns false. 141*/ 142 143 144/*! 145 \fn int32 BTwoDimensionalLayout::InternalCountColumns() 146 \brief Get the number of columns in the BTwoDimensionalLayout. 147 148 \returns The number of columns in the BTwoDimensionalLayout. 149*/ 150 151 152/*! 153 \fn int32 BTwoDimensionalLayout::InternalCountRows() 154 \brief Get the number of rows in the BTwoDimensionalLayout. 155 156 \returns The number of rows in the BTwoDimensionalLayout. 157*/ 158 159 160/*! 161 \fn void BTwoDimensionalLayout::GetColumnRowConstraints( 162 orientation orientation, int32 index, ColumnRowConstraints* constraints) 163 \brief Fill in the ColumnRowConstraints for a certain column or row in 164 the BTwoDimensionalLayout. 165 166 This method is used to communicate the size constraints and weight for 167 a given row/column in the BTwoDimensionalLayout. 168*/ 169 170 171/*! 172 \fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item, 173 Dimensions* dimensions) 174 \brief Tell the base class what column and row a BLayoutItem is in as 175 well as how many columns and rows it covers. 176*/ 177 178 179//! @} 180