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/GroupLayout.h  rev 38207
10 *		src/kits/interface/GroupLayout.cpp  rev 38207
11 */
12
13
14/*!
15	\file GroupLayout.h
16	\ingroup layout
17	\ingroup libbe
18	\brief Describes the BGroupLayout class.
19*/
20
21
22/*!
23	\class BGroupLayout
24	\ingroup layout
25	\ingroup libbe
26	\brief The BGroupLayout class is a simple BLayout subclass that
27		arranges the items it holds within a vertical or horizontal box.
28
29	In a horizontal BGroupLayout, each BLayoutItem is given the same vertical
30	area, but different horizontal areas. In a vertical BGroupLayout, each
31	BLayoutItem is given the same horizontal area, but different vertical areas.
32	Despite this, because of alignment and size constraints, the items in a
33	BGroupLayout may not all use the same vertical or horizontal area on screen.
34	Some BLayoutItems may have alignments that cause them to sit at the bottom
35	of the area they are given, for example. This is not a flaw or bug, but
36	something that you may come across when using this class.
37
38	In a BGroupLayout, each BLayoutItem or BView has a weight, the default
39	weight is \c 1.0f. When a BGroupLayout is not given enough space to satisfy
40	the minimum sizes of all items, then space is distributed according to
41	weight, while still attempting to satisfy minimum size constraints.
42	Weighting is scaled over the sum weight of all the items in this layout.
43	If a particular item has half of the sum weight of all items, it
44	will get half of the total space, unless this exceeds that item's maximum
45	size. If the space for an item exceeds the items maximum size, the excess
46	will be distributed to other items.
47
48	\warning This class is not yet finalized, if you use it in your software
49	         assume that it will break some time in the future.
50
51	\since Haiku R1
52*/
53
54
55/*!
56	\fn BGroupLayout::BGroupLayout(orientation orientation, float spacing)
57	\brief Creates a new BGroupLayout.
58
59	\param orientation The orientation of this BGroupLayout.
60	\param spacing The spacing between BLayoutItems in this BGroupLayout.
61
62	\since Haiku R1
63*/
64
65
66/*!
67	\fn BGroupLayout::~BGroupLayout()
68	\brief Destructor method.
69
70	Standard Destructor.
71
72	\since Haiku R1
73*/
74
75
76/*!
77	\fn BGroupLayout::BGroupLayout(BMessage* from)
78	\brief Archive constructor.
79
80	\param from The message to construct the BGroupLayout from.
81
82	\since Haiku R1
83*/
84
85
86/*!
87	\fn float BGroupLayout::Spacing() const
88	\brief Get the amount of spacing (in pixels) between each item.
89
90	\since Haiku R1
91*/
92
93
94/*!
95	\fn void BGroupLayout::SetSpacing(float spacing)
96	\brief Set the amount of spacing (in pixels) between each item.
97
98	\since Haiku R1
99*/
100
101
102/*!
103	\fn orientation BGroupLayout::Orientation() const
104	\brief Get the #orientation of this BGroupLayout.
105
106	\since Haiku R1
107*/
108
109
110/*!
111	\fn void BGroupLayout::SetOrientation(orientation orientation)
112	\brief Set the #orientation of this BGroupLayout.
113
114	\param orientation The new #orientation of this BGroupLayout.
115
116	\since Haiku R1
117*/
118
119
120/*!
121	\fn float BGroupLayout::ItemWeight(int32 index) const
122	\brief Get the weight of the item at \a index.
123
124	\since Haiku R1
125*/
126
127
128/*!
129	\fn void BGroupLayout::SetItemWeight(int32 index, float weight)
130	\brief Set the weight of the item at \a index.
131
132	\since Haiku R1
133*/
134
135
136/*!
137	\fn BLayoutItem* BGroupLayout::AddView(BView* child)
138	\brief Adds \a child to this layout as the last item. In a vertical
139	       BGroupLayout, \a child will be on the right, in a horizontal
140	       BGroupLayout, \a child will be at the bottom.
141
142	\a child will have a weight of \c 1.0f.
143
144	\since Haiku R1
145*/
146
147
148/*!
149	\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child)
150	\brief Adds \a child to this layout at \a index.
151
152	\a child will have a weight of \c 1.0f.
153
154	\since Haiku R1
155*/
156
157
158/*!
159	\fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight)
160	\brief Adds \a child to the end of this layout with a weight of
161		\a weight.
162
163	\since Haiku R1
164*/
165
166
167/*!
168	\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child,
169		float weight)
170	\brief Adds \a child this layout at \a index with a weight of
171	       \a weight.
172
173	\since Haiku R1
174*/
175
176
177/*!
178	\fn bool BGroupLayout::AddItem(BLayoutItem* item)
179	\brief Adds \a item to this layout as the last item. In a vertical
180	       BGroupLayout, \a item will be on the right, in a horizontal
181	       BGroupLayout, \a item will be at the bottom.
182
183	\a item will have a weight of \c 1.0f.
184
185	\since Haiku R1
186*/
187
188
189/*!
190	\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item)
191	\brief Adds \a item to this layout at \a index.
192
193	\a item will have a weight of \c 1.0f.
194
195	\since Haiku R1
196*/
197
198
199/*!
200	\fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight)
201	\brief Adds \a item to the end of this layout with a weight of
202	       \a weight.
203
204	\since Haiku R1
205*/
206
207
208/*!
209	\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item,
210		float weight)
211	\brief Adds \a item this layout at \a index with a weight of
212	       \a weight.
213
214	\since Haiku R1
215*/
216
217
218/*!
219	\fn static BArchivable* BGroupLayout::Instantiate(BMessage *from)
220	\brief Instantiate the layout from the message \a from.
221
222	\since Haiku R1
223*/
224