2 * Copyright 2017 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Adrien Destugues, pulkomandy@pulkomandy.tk
9 * headers/os/interface/LayoutBuilder.h rev 51359
10 * src/kits/interface/LayoutBuilder.cpp rev 51359
14 \class BLayoutBuilder::Grid<>
17 \brief BLayoutBuilder::Base subclass for building BGridLayouts.
21 Each item is added to the grid layout at (column, row) and may span multiple
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.
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.
49 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(BGridLayout* layout)
50 \brief Creates a builder targeting an existing BGridLayout.
52 Methods called on this builder will be directed to \a layout.
54 \param layout The BGridLayout to target with this builder.
61 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(BGridView* view)
62 \brief Creates a builder targeting a BGridView.
64 Methods called on this builder will be directed to
65 \c view->GridLayout().
67 \param view The BGridView this builder will target.
74 \fn BLayoutBuilder::Grid<ParentBuilder>::Grid(
75 float horizontal, float vertical)
76 \brief Creates a new BGridView and targets it.
78 Methods called on this builder will be directed to the new BGridView's
81 \param horizontal The horizontal spacing for the new BGridLayout.
82 \param vertical The vertical spacing for the new BGridLayout.
90 \name Adding BViews and BLayoutItems
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.
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.
108 \see BGridLayout::AddView(BView*)
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.
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.
126 \see BGridLayout::AddItem(BLayoutItem*)
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.
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:
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.
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.
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
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:
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.
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.