xref: /haiku/docs/user/interface/TwoDimensionalLayout.dox (revision a906d0a031e721e2f2ec9d95274103e74a3a774f)
1/*!
2	\class BTwoDimensionalLayout
3	\ingroup interface
4	\ingroup layout
5	\ingroup libbe
6
7	\brief Abstract BLayout subclass arranging items within rows and columns.
8
9	This class manages all the tricky work of actually positioning/resizing
10	items, as well as calculating size constraints and providing extra features,
11	such as spacing/insets and alignment of multiple BTwoDimensionalLayouts.
12	Derived classes need only implement a few hook methods to get a working
13	layout.
14
15	\warning This class is not yet finalized, if you use it in your software
16	assume that it will break some time in the future.
17*/
18
19
20/*!
21	\struct BTwoDimensionalLayout::ColumnRowConstraints
22	\brief Used by BTwoDimensionalLayout derived classes to communicate the
23		size constraints for a given column or row to the
24		BTwoDimensionalLayout class.
25*/
26
27
28/*!
29	\struct BTwoDimensionalLayout::Dimensions
30	\brief Used by BTwoDimensionalLayout derived classes to communicate the
31		positioning and size of a BLayoutItem, in terms of columns and rows to
32		the BTwoDimensionalLayout class.
33*/
34
35
36/*!
37	\fn void BTwoDimensionalLayout::AlignLayoutWith(
38		BTwoDimensionalLayout* other, enum orientation)
39	\brief Align the BLayoutItems in two BTwoDimensionalLayouts with each other
40		within a certain orientation.
41
42	When two (or more) BTwoDimensionalLayouts are aligned within a certain
43	orientation, then the BLayoutItems within those BTwoDimensionalLayouts will
44	have identical widths or heights (depending on how the
45	BTwoDimensionalLayouts are aligned).
46
47	If you align two BGroupLayouts horizontally, for example, then the
48	BLayoutItems at index 0 in both BGroupLayouts will be given the same
49	horizontal area. The same is true for the BLayoutItems at index 1, 2, etc..
50	Not all BTwoDimensionalLayouts have to have an item at each index for the
51	alignment to proceed.
52
53	\param other The BTwoDimensionalLayout to be aligned with.
54	\param orientation The orientation on which to be aligned.
55*/
56
57
58/*!
59	\fn void BTwoDimensionalLayout::SetInsets(float left, float top,
60		float right, float bottom)
61	\brief Set the insets for this BTwoDimensionalLayout (in pixels).
62
63	Set the spacing around the edges of this BTwoDimensionalLayout. If you
64	pass B_USE_DEFAULT_SPACING for a certain parameter, that parameter will
65	be replaced with the value returned by BControlLook::DefaultItemSpacing().
66
67	\see BTwoDimensionalLayout::GetInsets();
68*/
69
70
71/*!
72	\fn void BTwoDimensionalLayout::GetInsets(float* left, float* top,
73		float* right, float* bottom) const
74	\brief Get the insets for this BTwoDimensionalLayout (in pixels).
75
76	Passing NULL for any paramater is not an error, such parameters will
77	be ignored.
78
79	\see BTwoDimensionalLayout::SetInsets();
80*/
81
82
83/*!
84	\name BTwoDimensionalLayout Hook methods
85
86	These methods are called automatically as needed during layout, and
87	provide the BTwoDimensionalLayout class with the necessary information
88	to properly layout the BLayoutItems in this BTwoDimensionalLayout.
89
90	@{
91*/
92
93
94/*!
95	\fn void BTwoDimensionalLayout::PrepareItems(enum orientation)
96	\brief Prepare the BLayoutItems in this BTwoDimensionalLayout subclass
97		for layout within a certain orientation.
98
99	This is a good place to update cache information that will be used in
100	other hook methods, for example.
101*/
102
103
104/*!
105	\fn bool BTwoDimensionalLayout::HasMultiColumnItems()
106	\brief Tests whether or not this BTwoDimensionalLayout contains any
107		BLayoutItems spanning more than one column.
108
109	The BTwoDimensionalLayout implementation returns false.
110*/
111
112
113/*!
114	\fn bool BTwoDimensionalLayout::HasMultiRowItems()
115	\brief Tests whether or not this BTwoDimensionalLayout contains any
116		BLayoutItems spanning more than one row.
117
118	The BTwoDimensionalLayout implementation returns false.
119*/
120
121
122/*!
123	\fn int32 BTwoDimensionalLayout::InternalCountColumns()
124	\brief Return the number of columns in this BTwoDimensionalLayout.
125*/
126
127
128/*!
129	\fn int32 BTwoDimensionalLayout::InternalCountRows()
130	\brief Return the number of rows in this BTwoDimensionalLayout.
131*/
132
133
134/*!
135	\fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation,
136		int32 index, ColumnRowConstraints* constraints)
137	\brief Fill in the ColumnRowConstraints for a certain column or row in
138		this BTwoDimensionalLayout.
139
140	This method is used to communicate the size constraints and weight for
141	a given row/column in this BTwoDimensionalLayout.
142*/
143
144
145/*!
146	\fn void BTwoDimensionalLayout::GetItemDimensions(BLayoutItem* item,
147		Dimensions* dimensions)
148	\brief Tell the base class what column and row a BLayoutItem is in, as
149		well as how many columns and rows it covers.
150*/
151
152
153//@}
154