xref: /haiku/docs/user/interface/LayoutBuilder.Group.dox (revision 850f2d1e58cc443f77353c7fc0ce0c158c1fd328)
1/*
2 * Copyright 2011 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		John Scipione, jscipione@gmail.com
7 *		Ingo Weinhold, bonefish@cs.tu-berlin.de
8 *
9 * Corresponds to:
10 *		headers/os/interface/GroupLayoutBuilder.h	 rev 42274
11 *		src/kits/interface/GroupLayoutBuilder.cpp	 rev 42274
12 */
13
14
15/*!
16	\file GroupLayoutBuilder.h
17	\ingroup interface
18	\ingroup layout
19	\ingroup libbe
20	\brief Provides the BLayoutBuilder::Group<> class.
21
22	\since Haiku R1
23*/
24
25
26/*!
27	\class BLayoutBuilder::Group<>
28	\ingroup interface
29	\ingroup layout
30	\ingroup libbe
31	\brief BLayoutBuilder::Base subclass for building BGroupLayouts.
32
33	\since Haiku R1
34*/
35
36
37/*!
38	\typedef BLayoutBuilder::Group<ParentBuilder>::GroupBuilder
39	\brief Shorthand for builders returned by this builder's AddGroup() methods.
40
41	\since Haiku R1
42*/
43
44
45/*!
46	\typedef BLayoutBuilder::Group<ParentBuilder>::GridBuilder
47	\brief Shorthand for builders returned by this builder's AddGrid() methods.
48
49	\since Haiku R1
50*/
51
52
53/*!
54	\typedef BLayoutBuilder::Group<ParentBuilder>::SplitBuilder
55	\brief Shorthand for builders returned by this builder's AddSplit() methods.
56
57	\since Haiku R1
58*/
59
60
61/*!
62	\typedef BLayoutBuilder::Group<ParentBuilder>::ThisBuilder
63	\brief Shorthand representing the type of \c this.
64
65	\since Haiku R1
66*/
67
68
69/*!
70	\name Constructors
71*/
72
73
74//! @{
75
76
77/*!
78	\fn BLayoutBuilder::Group<ParentBuilder>::Group(BWindow *window,
79		orientation orientation, float spacing)
80	\brief Creates a new BGroupLayout, and attaches it to a BWindow.
81
82	\note The top BView* in \a window has its ViewColor set to
83	      \c B_PANEL_BACKGROUND_COLOR.
84	\param window Thew BWindow* to attach the newly created BGroupLayout to.
85	\param orientation The orientation for the new BGroupLayout.
86	\param spacing The spacing for the new BGroupLayout.
87
88	\since Haiku R1
89*/
90
91
92/*!
93	\fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupLayout* layout)
94	\brief Creates a builder targeting a BGroupLayout.
95
96	Methods called on this builder will be directed to \a layout.
97
98	\param layout The BGroupLayout to target with this builder.
99
100	\since Haiku R1
101*/
102
103
104/*!
105	\fn BLayoutBuilder::Group<ParentBuilder>::Group(BGroupView* view)
106	\brief Creates a builder targeting a BGroupView.
107
108	Methods called on this builder will be directed to
109	\c view->GroupLayout().
110
111	\param view The BGroupView this builder will target.
112
113	\since Haiku R1
114*/
115
116
117/*!
118	\fn BLayoutBuilder::Group<ParentBuilder>::Group(
119		orientation orientation, float spacing)
120	\brief Creates a new BGroupView and targets it.
121
122	Methods called on this builder will be directed to the new BGroupView's
123	BGroupLayout.
124
125	\param orientation The orientation for the new BGroupView.
126	\param spacing The spacing for the new BGroupView.
127
128	\since Haiku R1
129*/
130
131
132//! @}
133
134
135/*!
136	\name Adding BViews and BLayoutItems
137*/
138
139
140//! @{
141
142/*!
143	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view)
144	\brief Add a BView to the BGroupLayout this builder represents.
145
146	\param view The BView to be added.
147	\see BGroupLayout::AddView(BView*)
148
149	\since Haiku R1
150*/
151
152
153/*!
154	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BView* view,
155		float weight)
156	\brief Add BView to the BGroupLayout this builder represents.
157
158	\param view The BView to be added.
159	\param weight The weight to give \a view.
160
161	\see BGroupLayout::AddView(BView* view, float weight)
162
163	\since Haiku R1
164*/
165
166
167/*!
168	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(
169		BLayoutItem* item)
170	\brief Add a BLayoutItem to the BGroupLayout this builder represents.
171
172	\param item The BLayoutItem to be added.
173
174	\see BGroupLayout::AddItem(BLayoutItem*)
175
176	\since Haiku R1
177*/
178
179
180/*!
181	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::Add(BLayoutItem*
182		item, float weight)
183	\brief Add a BLayoutItem the BGroupLayout this builder represents.
184
185	\param item The BLayoutItem to be added.
186	\param weight The weight to give \a item.
187	\see BGroupLayout::AddItem(BLayoutItem* item, float weight)
188
189	\since Haiku R1
190*/
191
192
193//! @}
194
195
196/*!
197	\name Adding BLayouts and their BView Pairs
198
199	A set of methods that add a BLayout or BView subclass and return a
200	BLayoutBuilder::Base subclass representing the newly added object. These
201	methods push a new builder on top of the stack, you will not be using
202	\c this builder again until you call End().
203*/
204
205
206//! @{
207
208
209/*!
210	\fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
211		orientation orientation, float spacing, float weight)
212	\brief Construct and add a viewless BGroupLayout, then return a GroupBuilder
213	       representing the newly added layout.
214
215	\param orientation The orientation to use for the new BGroupLayout.
216	\param spacing The spacing to use for the new BGroupLayout.
217	\param weight The weight for the new BGroupLayout in the BGroupLayout this
218	       builder represents.
219
220	\returns A GroupBuilder representing the newly created BGroupLayout.
221
222	\since Haiku R1
223*/
224
225
226/*!
227	\fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(BGroupView*
228		groupView, float weight)
229	\brief Add BGroupView and return a builder representing the newly added
230	       BGroupView.
231
232	\param groupView The BGroupView to be added.
233	\param weight The weight for \a groupView in the BGroupLayout this builder
234	       represents.
235
236	\returns A GroupBuilder representing \a groupView.
237
238	\since Haiku R1
239*/
240
241
242/*!
243	\fn GroupBuilder BLayoutBuilder::Group<ParentBuilder>::AddGroup(
244		BGroupLayout* groupLayout, float weight)
245	\brief Add a BGroupLayout and return a builder representing the newly added
246	       BGroupLayout.
247
248	\param groupLayout The BGroupLayout to be added.
249	\param weight The weight for \a groupLayout in the BGroupLayout this builder
250		represents.
251
252	\returns A GroupBuilder representing \a groupLayout.
253
254	\since Haiku R1
255*/
256
257
258/*!
259	\fn GridBuilder	BLayoutBuilder::Group<ParentBuilder>::AddGrid(
260		float horizontalSpacing = 0.0f, float verticalSpacing = 0.0f,
261		float weight = 1.0f)
262	\brief Create and add a viewless BGridLayout, then return a builder
263	       representing the newly created BGridLayout.
264
265	\param horizontalSpacing The horizontal spacing for the new BGridLayout.
266	\param verticalSpacing The vertical spacing for the new BGridLayout.
267	\param weight The weight for the new BGroupLayout in the BGroupLayout this
268		builder represents.
269
270	\returns A GridBuilder representing the newly created BGridLayout.
271
272	\since Haiku R1
273*/
274
275
276/*!
277	\fn GridBuilder BLayoutBuilder::Group<ParentBuilder>::AddGrid(
278		BGridLayout* gridLayout, float weight = 1.0f)
279	\brief Add a BGridLayout, then return a builder the newly added BGridLayout.
280
281	\param gridLayout The BGridLayout to be added and used to construct the
282		returned GridBuilder.
283	\param weight The weight for \a groupLayout in the BGroupLayout this builder
284		represents.
285
286	\returns a GridBuilder representing \a gridLayout.
287
288	\since Haiku R1
289*/
290
291
292/*!
293	\fn GridBuilder	BLayoutBuilder::Group<ParentBuilder>::AddGrid(
294		BGridView* gridView, float weight = 1.0f)
295	\brief Add a BGridView, then return a builder the newly added BGridView.
296
297	\param gridView The BGridView to be added and used to construct the
298		returned GridBuilder.
299	\param weight The weight for \a groupLayout in the BGroupLayout this builder
300		represents.
301
302	\returns a GridBuilder representing \a gridView.
303
304	\since Haiku R1
305*/
306
307
308/*!
309	\fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
310		orientation orientation, float spacing, float weight)
311	\brief Create and add a new BSplitView with a weight of \c weight, then
312		return a SplitBuilder representing the new BSplitView.
313
314	\param orientation The orientation of the new BSplitView.
315	\param spacing The spacing of the new BSplitView.
316	\param weight The weight, in this BGroupLayout for the new BSplitView.
317
318	\returns a SplitBuilder representing the new BSplitView.
319
320	\since Haiku R1
321*/
322
323
324/*!
325	\fn SplitBuilder BLayoutBuilder::Group<ParentBuilder>::AddSplit(
326		BSplitView* splitView, float weight = 1.0f)
327	\brief Add a BSplitView to the BGroupLayout this builder represents and
328		return a SplitBuilder representing the BSplitView.
329
330	\param splitView The BSplitView to be added.
331	\param weight The weight of the BSplitView in the BGroupLayout this builder
332		represents.
333
334	\since Haiku R1
335*/
336
337
338//! @}
339
340
341/*!
342	\name Adding BSpaceLayoutItems
343
344	Some convenience methods for adding special BSpaceLayoutItems.
345*/
346
347
348//! @{
349
350
351/*!
352	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::AddGlue(
353		float weight = 1.0f)
354	\brief Add a BSpaceLayoutItem created by BSpaceLayoutItem::CreateGlue()
355		to the BGroupLayout this builder represents.
356
357	\param weight The weight of the BSpaceLayoutItem in the BGroupLayout this
358		builder represents
359
360	\since Haiku R1
361*/
362
363
364/*!
365	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::AddStrut(float size)
366	\brief Add a BSpaceLayoutItem created by
367	      BSpaceLayoutItem::CreateHorizontalStrut() or
368	      BSpaceLayoutItem::CreateVerticalStrut() to the BGroupLayout
369	      this builder represents.
370
371	\param size The width or height of the strut to be created (depending on
372		the orientation of the BGroupLayout this builder represents).
373
374	\since Haiku R1
375*/
376
377
378//!@}
379
380
381/*!
382	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::SetInsets(float left,
383		 float top, float right, float bottom)
384	\brief Call the BTwoDimensionalLayout::SetInsets() method on the
385		BGroupLayout this builder represents.
386
387	\since Haiku R1
388*/
389
390
391/*!
392	\name Accessors
393*/
394
395
396//! @{
397
398
399/*!
400	\fn BGroupLayout* BLayoutBuilder::Group<ParentBuilder>::Layout() const
401	\brief Get the BGroupLayout this builder represents.
402
403	\since Haiku R1
404*/
405
406
407/*!
408	\fn BView* BLayoutBuilder::Group<ParentBuilder>::View() const
409	\brief Get the BView this builder's BGroupLayout is attached to.
410
411	\since Haiku R1
412*/
413
414
415/*!
416	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::GetLayout(
417		BGroupLayout** _layout)
418	\brief Get the BGroupLayout this builder represents.
419
420	\param[out] _layout The BGroupLayout this builder represents.
421
422	\since Haiku R1
423*/
424
425
426/*!
427	\fn ThisBuilder& BLayoutBuilder::Group<ParentBuilder>::GetView(
428		BView** _view)
429	\brief Get the BView this builder's BGroupLayout is attached to.
430
431	\param[out] _view The BView this builder's BGroupLayout is attached to.
432
433	\since Haiku R1
434*/
435
436
437/*!
438	\fn BLayoutBuilder::Group<ParentBuilder>::operator BGroupLayout*()
439	\brief Cast this builder into the BGroupLayout it represents.
440
441	\since Haiku R1
442*/
443
444
445//!@}
446