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