xref: /haiku/docs/user/interface/GroupLayout.dox (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
1/*! \class BGroupLayout
2	\ingroup interface
3	\ingroup layout
4	\ingroup libbe
5	\brief The BGroupLayout class is a simple BLayout subclass that
6	arranges the items it holds within a vertical or horizontal box.
7
8	In a horizontal BGroupLayout, each BLayoutItem is given the same vertical
9	area, but different horizontal areas. In a vertical BGroupLayout, each
10	BLayoutItem is given the same horizontal area, but different vertical areas.
11	Despite this, because of alignment and size constraints, the items in a
12	BGroupLayout may not all use the same vertical or horizontal area on screen.
13	Some BLayoutItems may have alignments that cause them to sit at the bottom
14	of the area they are given, for example. This is not a flaw or bug, but
15	something that you may come across when using this class.
16
17	In a BGroupLayout, each BLayoutItem or BView has a weight, the default
18	weight is \c 1.0f. When a BGroupLayout is not given enough space to satisfy
19	the minimum sizes of all items, then space is distributed according to
20	weight, while still attempting to satisfy minimum size constraints.
21	Weighting is scaled over the sum weight of all the items in this layout.
22	If a particular item has half of the sum weight of all items, it
23	will get half of the total space, unless this exceeds that item's maximum
24	size. If the space for an item exceeds the items maximum size, the excess
25	will be distributed to other items.
26
27	\warning This class is not yet finalized, if you use it in your software
28	assume that it will break some time in the future.
29*/
30
31
32/*!
33	\fn BGroupLayout::BGroupLayout(enum orientation, float spacing)
34	\brief Creates a new BGroupLayout.
35
36	\param orientation The orientation of this BGroupLayout.
37	\param spacing The spacing between BLayoutItems in this BGroupLayout.
38*/
39
40
41/*!
42	\fn BGroupLayout::BGroupLayout(BMessage* from)
43	\brief Archive constructor.
44*/
45
46
47/*!
48	\fn float BGroupLayout::Spacing() const
49	\brief Get the amount of spacing (in pixels) between each item.
50*/
51
52
53/*!
54	\fn void BGroupLayout::SetSpacing(float spacing)
55	\brief Set the amount of spacing (in pixels) between each item.
56*/
57
58
59/*!
60	\fn orientation BGroupLayout::Orientation() const
61	\brief Get the orientation of this BGroupLayout.
62*/
63
64
65/*!
66	\fn void BGroupLayout::SetOrientation(enum orientation)
67	\brief Set the orientation of this BGroupLayout.
68	\param orientation The new orientation of this BGroupLayout.
69*/
70
71
72/*!
73	\fn float BGroupLayout::ItemWeight(int32 index) const
74	\brief Get the weight of the item at \c index.
75*/
76
77
78/*!
79	\fn void BGroupLayout::SetItemWeight(int32 index, float weight)
80	\brief Set the weight of the item at \c index.
81*/
82
83
84/*!
85	\fn BLayoutItem* BGroupLayout::AddView(BView* child)
86	\brief Adds \a child to this layout as the last item. In a vertical
87		BGroupLayout, \c child will be on the right, in a horizontal
88		BGroupLayout, \c child will be at the bottom.
89
90	\c child will have a weight of 1.0f.
91*/
92
93
94/*!
95	\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child)
96	\brief Adds \c child to this layout at \c index.
97
98	\c child will have a weight of 1.0f.
99*/
100
101
102/*!
103	\fn BLayoutItem* BGroupLayout::AddView(BView* child, float weight)
104	\brief Adds \c child to the end of this layout with a weight of
105		\c weight.
106*/
107
108
109/*!
110	\fn BLayoutItem* BGroupLayout::AddView(int32 index, BView* child,
111		float weight)
112	\brief Adds \c child this layout at \c index with a weight of
113		\c weight.
114*/
115
116
117/*!
118	\fn bool BGroupLayout::AddItem(BLayoutItem* item)
119	\brief Adds \a item to this layout as the last item. In a vertical
120		BGroupLayout, \c item will be on the right, in a horizontal
121		BGroupLayout, \c item will be at the bottom.
122
123	\c item will have a weight of 1.0f.
124*/
125
126
127/*!
128	\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item)
129	\brief Adds \c item to this layout at \c index.
130
131	\c item will have a weight of 1.0f.
132*/
133
134
135/*!
136	\fn bool BGroupLayout::AddItem(BLayoutItem* item, float weight)
137	\brief Adds \c item to the end of this layout with a weight of
138		\c weight.
139*/
140
141
142/*!
143	\fn bool BGroupLayout::AddItem(int32 index, BLayoutItem* item, float weight)
144	\brief Adds \c item this layout at \c index with a weight of
145		\c weight.
146*/
147