1/* 2 * Copyright 2017 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Adrien Destugues, pulkomandy@pulkomandy.tk 7 * 8 * Corresponds to: 9 * headers/os/interface/LayoutBuilder.h rev 51359 10 */ 11 12 13/*! 14 \class BLayoutBuilder::Grid<> 15 \ingroup layout 16 \ingroup libbe 17 \brief BLayoutBuilder::Base subclass for building BGridLayouts. 18 19 \since Haiku R1 20 21 Each item is added to the grid layout at (column, row) and may span multiple 22 columns and rows. 23*/ 24 25/*! 26 \name Constructors 27*/ 28 29 30//! @{ 31 32 33/*! 34 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(BWindow *window, 35 float horizontal, float vertical) 36 \brief Creates a new BGroupLayout, and attaches it to a BWindow. 37 38 \note The top BView* in \a window has its ViewColor set to 39 \c B_PANEL_BACKGROUND_COLOR. 40 \param window Thew BWindow* to attach the newly created BGroupLayout to. 41 \param horizontal The horizontal spacing for the new BGridLayout. 42 \param vertical The vertical spacing for the new BGridLayout. 43 44 \since Haiku R1 45*/ 46 47 48/*! 49 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(BGridLayout* layout) 50 \brief Creates a builder targeting an existing BGridLayout. 51 52 Methods called on this builder will be directed to \a layout. 53 54 \param layout The BGridLayout to target with this builder. 55 56 \since Haiku R1 57*/ 58 59 60/*! 61 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(BGridView* view) 62 \brief Creates a builder targeting a BGridView. 63 64 Methods called on this builder will be directed to 65 \c view->GridLayout(). 66 67 \param view The BGridView this builder will target. 68 69 \since Haiku R1 70*/ 71 72 73/*! 74 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid( 75 float horizontal, float vertical) 76 \brief Creates a new BGridView and targets it. 77 78 Methods called on this builder will be directed to the new BGridView's 79 BGridLayout. 80 81 \param horizontal The horizontal spacing for the new BGridLayout. 82 \param vertical The vertical spacing for the new BGridLayout. 83 84 \since Haiku R1 85*/ 86//! @} 87 88 89/*! 90 \name Adding BViews and BLayoutItems 91*/ 92 93 94//! @{ 95 96 97/*! 98 \fn ThisBuilder& BLayoutBuilder::Grid<ParentBuilder>::Add(BView* view, 99 int32 column, int32 row, int32 columnCount, int32 rowCount) 100 \brief Add a BView to the BGridLayout this builder represents. 101 102 \param view The BView to be added. 103 \param column The column number (zero-index) to use. 104 \param row The row number (zero-index) to use. 105 \param columnCount The number of columns to span over. 106 \param rowCount The number of rows to span over. 107 108 \see BGridLayout::AddView(BView*) 109 110 \since Haiku R1 111*/ 112 113 114/*! 115 \fn ThisBuilder& BLayoutBuilder::Grid<ParentBuilder>::Add( 116 BLayoutItem* item, int32 column, int32 row, 117 int32 columnCount, int32 rowCount) 118 \brief Add a BLayoutItem to the BGridLayout this builder represents. 119 120 \param item The BLayoutItem to be added. 121 \param column The column number (zero-index) to use. 122 \param row The row number (zero-index) to use. 123 \param columnCount The number of columns to span over. 124 \param rowCount The number of rows to span over. 125 126 \see BGridLayout::AddItem(BLayoutItem*) 127 128 \since Haiku R1 129*/ 130 131 132/*! 133 \fn ThisBuilder& BLayoutBuilder::Grid<ParentBuilder>::AddMenuField( 134 BMenuField* item, int32 column, int32 row, alignment labelAlignment, 135 int32 labelColumnCount, int32 fieldColumnCount, int32 rowCount) 136 \brief Add a BMenuField to the layout. 137 138 \param item The BMenuField to be added. 139 \param column The column number (zero-index) to use. 140 \param row The row number (zero-index) to use. 141 \param labelAlignment The alignment of the label to use. Choices include: 142 - \c B_ALIGN_LEFT 143 - \c B_ALIGN_RIGHT 144 - \c B_ALIGN_CENTER 145 - \c B_ALIGN_HORIZONTAL_CENTER 146 - \c B_ALIGN_HORIZONTAL_UNSET 147 - \c B_ALIGN_USE_FULL_WIDTH 148 \param labelColumnCount The number of columns the label will span over. 149 \param fieldColumnCount The number of columns the menu field will span over. 150 \param rowCount The number of rows to span over. 151 152 A BMenuField is composed of a label and a menu. This method allows to 153 lay the sub-components in separate grid cells, allowing easy alignment 154 of the menu with other items in the layout. 155 156 \since Haiku R1 157*/ 158 159 160/*! 161 \fn ThisBuilder& BLayoutBuilder::Grid<ParentBuilder>::AddTextControl( 162 BTextControl* item, int32 column, int32 row, alignment labelAlignment, 163 int32 labelColumnCount, int32 textColumnCount, int32 rowCount) 164 \brief Add a BMenuField to the layout 165 166 \param item The BMenuField to be added. 167 \param column The column number (zero-index) to use. 168 \param row The row number (zero-index) to use. 169 \param labelAlignment The alignment of the label to use. Choices include: 170 - \c B_ALIGN_LEFT 171 - \c B_ALIGN_RIGHT 172 - \c B_ALIGN_CENTER 173 - \c B_ALIGN_HORIZONTAL_CENTER 174 - \c B_ALIGN_HORIZONTAL_UNSET 175 - \c B_ALIGN_USE_FULL_WIDTH 176 \param labelColumnCount The number of columns the label will span over. 177 \param textColumnCount The number of columns the text field will span over. 178 \param rowCount The number of rows to span over. 179 180 A BTextControl is composed of a label and a text area. This method allows to 181 lay the sub-components in separate grid cells, allowing easy alignment 182 of the text area with other items in the layout. 183 184 \since Haiku R1 185*/ 186 187 188//! @} 189