xref: /haiku/docs/user/interface/GridLayout.dox (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
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/GridLayout.h	rev 38207
10 *		src/kits/interface/GridLayout.cpp	rev 38207
11 */
12
13
14/*!
15	\file GridLayout.h
16	\ingroup layout
17	\ingroup libbe
18	\brief Provides the BGridLayout class.
19*/
20
21
22/*!
23	\class BGridLayout
24	\ingroup layout
25	\ingroup libbe
26	\brief The BGridLayout class a BLayout subclass that arranges the items it
27		holds in a grid.
28
29	Each item in a BGridLayout receives a rectangular area which can span more
30	than a single row or column. The indexing of columns and rows is zero based,
31	starting in the top-left.
32
33	\warning This class is not yet finalized, if you use it in your software
34	         assume that it will break some time in the future.
35
36	\since Haiku R1
37*/
38
39
40/*!
41	\fn BGridLayout::BGridLayout(float horizontal = 0.0f, float vertical = 0.0f)
42	\brief Create a BGridLayout with \a horizontal space between columns and
43	       \a vertical space between rows.
44
45	\since Haiku R1
46*/
47
48
49/*!
50	\fn BGridLayout::BGridLayout(BMessage* from)
51	\brief Archive constructor.
52
53	\param from The message to build the BGridLayout from.
54
55	\since Haiku R1
56*/
57
58
59/*!
60	\fn BGridLayout::~BGridLayout()
61	\brief Destructor method.
62
63	Standard Destructor.
64
65	\since Haiku R1
66*/
67
68
69/*!
70	\fn int32 BGridLayout::CountColumns() const
71	\brief Returns the number of active columns in this layout.
72
73	\returns The number of active columns in the layout.
74
75	\since Haiku R1
76*/
77
78
79/*!
80	\fn int32 BGridLayout::CountRows() const
81	\brief Returns the number of active rows in this layout.
82
83	\returns the number of active rows in the layout.
84
85	\since Haiku R1
86*/
87
88
89/*!
90	\fn float BGridLayout::HorizontalSpacing() const
91	\brief Returns the spacing between columns for this layout.
92
93	\returns The spacing between columns for the layout.
94
95	\since Haiku R1
96*/
97
98
99/*!
100	\fn float BGridLayout::VerticalSpacing() const
101	\brief Returns the spacing between rows for this layout.
102
103	\returns The spacing between rows for the layout.
104
105	\since Haiku R1
106*/
107
108
109/*!
110	\fn void BGridLayout::SetHorizontalSpacing(float spacing)
111	\brief Set the spacing between columns for this layout.
112
113	\param spacing The number of pixels of spacing to set.
114
115	\since Haiku R1
116*/
117
118
119/*!
120	\fn void BGridLayout::SetVerticalSpacing(float spacing)
121	\brief Set the spacing between rows for this layout.
122
123	\param spacing The number of pixels of spacing to set.
124
125	\since Haiku R1
126*/
127
128
129/*!
130	\fn	void BGridLayout::SetSpacing(float horizontal, float vertical)
131	\brief Set the spacing between columns and rows for this layout.
132
133	\param horizontal The number of \a horizontal pixels of spacing to set.
134	\param vertical The number of \a vertical pixels of spacing to set.
135
136	\since Haiku R1
137*/
138
139
140/*!
141	\fn float BGridLayout::ColumnWeight(int32 column) const
142	\brief Returns the weight for the specified \a column.
143
144	\returns The \a column weight as a float.
145
146	\since Haiku R1
147*/
148
149
150/*!
151	\fn void BGridLayout::SetColumnWeight(int32 column, float weight)
152	\brief Set the weight for \a column to \a weight.
153
154	\param column The column to set.
155	\param weight The weight to set.
156
157	\since Haiku R1
158*/
159
160
161/*!
162	\fn float BGridLayout::MinColumnWidth(int32 column) const
163	\brief Returns the minimum width for \a column.
164
165	\param column The column to get the minimum width of.
166
167	\returns The minimum width for \a column as a float.
168
169	\since Haiku R1
170*/
171
172
173/*!
174	\fn void BGridLayout::SetMinColumnWidth(int32 column, float width)
175	\brief Sets the minimum width for \a column to \a width.
176
177	\param column The \a column to set the minimum width of.
178	\param width The \a width to set.
179
180	\since Haiku R1
181*/
182
183
184/*!
185	\fn float BGridLayout::MaxColumnWidth(int32 column) const
186	\brief Returns the maximum width for \a column.
187
188	\param column The column to get the maximum width of.
189
190	\returns The maximum width for \a column as a float.
191
192	\since Haiku R1
193*/
194
195
196/*!
197	\fn void BGridLayout::SetMaxColumnWidth(int32 column, float width)
198	\brief Sets the maximum width for \a column to \a width.
199
200	\param column The column to set the maximum width of.
201	\param width The \a width to set.
202
203	\since Haiku R1
204*/
205
206
207/*!
208	\fn float BGridLayout::RowWeight(int32 row) const
209	\brief Returns the weight of the specified \a row.
210
211	\returns The weight of the \a row.
212
213	\since Haiku R1
214*/
215
216
217/*!
218	\fn void BGridLayout::SetRowWeight(int32 row, float weight)
219	\brief Set the weight of \a row to \a weight.
220
221	\param row The \a row number.
222	\param weight The \a weight to set.
223
224	\since Haiku R1
225*/
226
227
228/*!
229	\fn float BGridLayout::MinRowHeight(int row) const
230	\brief Returns the minimum height for \a row.
231
232	\since Haiku R1
233*/
234
235
236/*!
237	\fn void BGridLayout::SetMinRowHeight(int32 row, float height)
238	\brief Sets the minimum height for \a row to \a width.
239
240	\since Haiku R1
241*/
242
243
244/*!
245	\fn float BGridLayout::MaxRowHeight(int32 row) const
246	\brief Returns the maximum height for \a row.
247
248	\since Haiku R1
249*/
250
251
252/*!
253	\fn void BGridLayout::SetMaxRowHeight(int32 row, float height)
254	\brief Sets the maximum height for \a row to \a width.
255
256	\since Haiku R1
257*/
258
259
260/*!
261	\fn BLayoutItem* BGridLayout::ItemAt(int32 column, int32 row) const
262	\brief Get a pointer to the item at the requested cell in the grid.
263
264	\param column The column, starting with \c 0 for the leftmost column. Note
265		that the value should be 0 or higher.
266	\param row The row, starting with \c 0 for the topmost row. Note that the
267		value should be 0 or higher.
268
269	\return A pointer to the layout item at these coordinates, or \c NULL if
270		there is no item.
271*/
272
273
274/*!
275	\fn BLayoutItem* BGridLayout::AddView(BView* child)
276	\brief Adds \a child to this layout in the first empty cell available, or
277		in a new column in the first row if there are no emtpy cells.
278
279	\since Haiku R1
280*/
281
282
283/*!
284	\fn BLayoutItem* BGridLayout::AddView(int32 index, BView* child);
285	\brief BGridLayout::AddView(BView*)
286
287	\since Haiku R1
288*/
289
290
291/*!
292	\fn BLayoutItem* BGridLayout::AddView(BView* child, int32 column, int32 row,
293			int32 columnCount = 1, int32 rowCount = 1);
294	\brief Adds \a child to this layout at \a column and \a row. \a child may
295	       also occupy additional cells if \a columnCount or \a rowCount are
296	       greater than \c 1.
297
298	Fails and returns NULL if the requested area is occupied, or if internal
299	memory allocations fail.
300
301	\since Haiku R1
302*/
303
304
305/*!
306	\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item)
307	\brief Adds \a item to this layout in the first empty cell available, or
308	       in a new column in the first row if there are no emtpy cells.
309
310	\since Haiku R1
311*/
312
313
314/*!
315	\fn BLayoutItem* BGridLayout::AddItem(int32 index, BLayoutItem* item);
316	\brief BGridLayout::AddItem(BLayoutItem*)
317*/
318
319
320/*!
321	\fn BLayoutItem* BGridLayout::AddItem(BLayoutItem* item, int32 column,
322		int32 row, int32 columnCount = 1, int32 rowCount = 1);
323	\brief Adds \a item to this layout at \a column and \a row. \a item may
324	       also occupy additional cells if \a columnCount or \a rowCount are
325	       greater than 1.
326
327	Fails and returns \c NULL if the requested area is occupied, or if internal
328	memory allocations fail.
329
330	\since Haiku R1
331*/
332
333
334/*!
335	\fn static BArchivable* BGridLayout::Instantiate(BMessage *from)
336	\brief Instantiate the layout from the message \a from.
337
338	\since Haiku R1
339*/
340