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