]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: layout.h | |
e54c96f1 | 3 | // Purpose: interface of wxIndividualLayoutConstraint |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxIndividualLayoutConstraint | |
11 | @wxheader{layout.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | Objects of this class are stored in the wxLayoutConstraint class |
14 | as one of eight possible constraints that a window can be involved in. | |
7c913512 | 15 | |
23324ae1 FM |
16 | Constraints are initially set to have the relationship wxUnconstrained, |
17 | which means that their values should be calculated by looking at known | |
18 | constraints. | |
7c913512 | 19 | |
23324ae1 FM |
20 | @library{wxcore} |
21 | @category{winlayout} | |
7c913512 | 22 | |
e54c96f1 FM |
23 | @see @ref overview_constraintsoverview "Overview and examples", |
24 | wxLayoutConstraints, wxWindow::SetConstraints. | |
23324ae1 FM |
25 | */ |
26 | class wxIndividualLayoutConstraint : public wxObject | |
27 | { | |
28 | public: | |
29 | /** | |
30 | Constructor. Not used by the end-user. | |
31 | */ | |
32 | wxIndividualLayoutConstraint(); | |
33 | ||
34 | /** | |
35 | Constrains this edge to be above the given window, with an | |
36 | optional margin. Implicitly, this is relative to the top edge of the other | |
37 | window. | |
38 | */ | |
4cc4bfaf | 39 | void Above(wxWindow* otherWin, int margin = 0); |
23324ae1 FM |
40 | |
41 | /** | |
42 | Constrains this edge or dimension to be the given absolute value. | |
43 | */ | |
44 | void Absolute(int value); | |
45 | ||
46 | /** | |
47 | Sets this edge or constraint to be whatever the window's value is | |
48 | at the moment. If either of the width and height constraints | |
49 | are @e as is, the window will not be resized, but moved instead. | |
50 | This is important when considering panel items which are intended | |
51 | to have a default size, such as a button, which may take its size | |
52 | from the size of the button label. | |
53 | */ | |
4cc4bfaf | 54 | void AsIs(); |
23324ae1 FM |
55 | |
56 | /** | |
57 | Constrains this edge to be below the given window, with an | |
58 | optional margin. Implicitly, this is relative to the bottom edge of the other | |
59 | window. | |
60 | */ | |
4cc4bfaf | 61 | void Below(wxWindow* otherWin, int margin = 0); |
23324ae1 FM |
62 | |
63 | /** | |
64 | The @e wxEdge enumerated type specifies the type of edge or dimension of a | |
65 | window. | |
66 | ||
67 | wxLeft | |
68 | ||
23324ae1 FM |
69 | The left edge. |
70 | ||
71 | wxTop | |
72 | ||
23324ae1 FM |
73 | The top edge. |
74 | ||
75 | wxRight | |
76 | ||
23324ae1 FM |
77 | The right edge. |
78 | ||
79 | wxBottom | |
80 | ||
23324ae1 FM |
81 | The bottom edge. |
82 | ||
83 | wxCentreX | |
84 | ||
23324ae1 FM |
85 | The x-coordinate of the centre of the window. |
86 | ||
87 | wxCentreY | |
88 | ||
23324ae1 FM |
89 | The y-coordinate of the centre of the window. |
90 | ||
91 | The @e wxRelationship enumerated type specifies the relationship that | |
92 | this edge or dimension has with another specified edge or dimension. Normally, | |
93 | the user | |
94 | doesn't use these directly because functions such as @e Below and @e RightOf | |
95 | are a convenience | |
96 | for using the more general @e Set function. | |
97 | ||
98 | wxUnconstrained | |
99 | ||
23324ae1 FM |
100 | The edge or dimension is unconstrained (the default for edges. |
101 | ||
102 | wxAsIs | |
103 | ||
23324ae1 FM |
104 | The edge or dimension is to be taken from the current window position or size |
105 | (the | |
106 | default for dimensions. | |
107 | ||
108 | wxAbove | |
109 | ||
23324ae1 FM |
110 | The edge should be above another edge. |
111 | ||
112 | wxBelow | |
113 | ||
23324ae1 FM |
114 | The edge should be below another edge. |
115 | ||
116 | wxLeftOf | |
117 | ||
23324ae1 FM |
118 | The edge should be to the left of another edge. |
119 | ||
120 | wxRightOf | |
121 | ||
23324ae1 FM |
122 | The edge should be to the right of another edge. |
123 | ||
124 | wxSameAs | |
125 | ||
23324ae1 FM |
126 | The edge or dimension should be the same as another edge or dimension. |
127 | ||
128 | wxPercentOf | |
129 | ||
23324ae1 FM |
130 | The edge or dimension should be a percentage of another edge or dimension. |
131 | ||
132 | wxAbsolute | |
133 | ||
23324ae1 FM |
134 | The edge or dimension should be a given absolute value. |
135 | */ | |
136 | ||
137 | ||
138 | /** | |
139 | Constrains this edge to be to the left of the given window, with an | |
140 | optional margin. Implicitly, this is relative to the left edge of the other | |
141 | window. | |
142 | */ | |
4cc4bfaf | 143 | void LeftOf(wxWindow* otherWin, int margin = 0); |
23324ae1 FM |
144 | |
145 | /** | |
146 | Constrains this edge or dimension to be to a percentage of the given window, | |
147 | with an | |
148 | optional margin. | |
149 | */ | |
4cc4bfaf | 150 | void PercentOf(wxWindow* otherWin, wxEdge edge, int per); |
23324ae1 FM |
151 | |
152 | /** | |
153 | Constrains this edge to be to the right of the given window, with an | |
154 | optional margin. Implicitly, this is relative to the right edge of the other | |
155 | window. | |
156 | */ | |
4cc4bfaf | 157 | void RightOf(wxWindow* otherWin, int margin = 0); |
23324ae1 FM |
158 | |
159 | /** | |
160 | Constrains this edge or dimension to be to the same as the edge of the given | |
161 | window, with an | |
162 | optional margin. | |
163 | */ | |
4cc4bfaf | 164 | void SameAs(wxWindow* otherWin, wxEdge edge, int margin = 0); |
23324ae1 FM |
165 | |
166 | /** | |
167 | Sets the properties of the constraint. Normally called by one of the convenience | |
168 | functions such as Above, RightOf, SameAs. | |
169 | */ | |
4cc4bfaf FM |
170 | void Set(wxRelationship rel, wxWindow* otherWin, |
171 | wxEdge otherEdge, int value = 0, | |
172 | int margin = 0); | |
23324ae1 FM |
173 | |
174 | /** | |
175 | Sets this edge or dimension to be unconstrained, that is, dependent on | |
176 | other edges and dimensions from which this value can be deduced. | |
177 | */ | |
178 | void Unconstrained(); | |
179 | }; | |
180 | ||
181 | ||
e54c96f1 | 182 | |
23324ae1 FM |
183 | /** |
184 | @class wxLayoutConstraints | |
185 | @wxheader{layout.h} | |
7c913512 | 186 | |
e54c96f1 | 187 | @b Note: constraints are now deprecated and you should use sizers() instead. |
7c913512 | 188 | |
23324ae1 FM |
189 | Objects of this class can be associated with a window to define its |
190 | layout constraints, with respect to siblings or its parent. | |
7c913512 | 191 | |
23324ae1 FM |
192 | The class consists of the following eight constraints of class |
193 | wxIndividualLayoutConstraint, | |
194 | some or all of which should be accessed directly to set the appropriate | |
195 | constraints. | |
7c913512 | 196 | |
23324ae1 FM |
197 | @b left: represents the left hand edge of the window |
198 | @b right: represents the right hand edge of the window | |
199 | @b top: represents the top edge of the window | |
200 | @b bottom: represents the bottom edge of the window | |
201 | @b width: represents the width of the window | |
202 | @b height: represents the height of the window | |
203 | @b centreX: represents the horizontal centre point of the window | |
204 | @b centreY: represents the vertical centre point of the window | |
7c913512 | 205 | |
23324ae1 FM |
206 | Most constraints are initially set to have the relationship wxUnconstrained, |
207 | which means that their values should be calculated by looking at known | |
208 | constraints. | |
209 | The exceptions are @e width and @e height, which are set to wxAsIs to | |
210 | ensure that if the user does not specify a constraint, the existing | |
211 | width and height will be used, to be compatible with panel items which often | |
212 | have take a default size. If the constraint is wxAsIs, the dimension will | |
213 | not be changed. | |
7c913512 | 214 | |
23324ae1 | 215 | @b wxPerl note: In wxPerl the constraints are accessed as |
7c913512 | 216 | |
23324ae1 FM |
217 | @code |
218 | constraint = Wx::LayoutConstraints-new(); | |
219 | constraint-centreX-AsIs(); | |
220 | constraint-centreY-Unconstrained(); | |
221 | @endcode | |
7c913512 FM |
222 | |
223 | ||
23324ae1 FM |
224 | @library{wxcore} |
225 | @category{winlayout} | |
7c913512 | 226 | |
e54c96f1 | 227 | @see @ref overview_constraintsoverview "Overview and examples", |
23324ae1 FM |
228 | wxIndividualLayoutConstraint, wxWindow::SetConstraints |
229 | */ | |
230 | class wxLayoutConstraints : public wxObject | |
231 | { | |
232 | public: | |
233 | /** | |
234 | Constructor. | |
235 | */ | |
236 | wxLayoutConstraints(); | |
237 | ||
238 | /** | |
239 | wxIndividualLayoutConstraint bottom | |
23324ae1 FM |
240 | Constraint for the bottom edge. |
241 | */ | |
242 | ||
243 | ||
244 | /** | |
245 | wxIndividualLayoutConstraint centreX | |
23324ae1 FM |
246 | Constraint for the horizontal centre point. |
247 | */ | |
248 | ||
249 | ||
250 | /** | |
251 | wxIndividualLayoutConstraint centreY | |
23324ae1 FM |
252 | Constraint for the vertical centre point. |
253 | */ | |
254 | ||
255 | ||
256 | /** | |
257 | wxIndividualLayoutConstraint height | |
23324ae1 FM |
258 | Constraint for the height. |
259 | */ | |
260 | ||
261 | ||
262 | /** | |
263 | wxIndividualLayoutConstraint left | |
23324ae1 FM |
264 | Constraint for the left-hand edge. |
265 | */ | |
266 | ||
267 | ||
268 | /** | |
269 | wxIndividualLayoutConstraint right | |
23324ae1 FM |
270 | Constraint for the right-hand edge. |
271 | */ | |
272 | ||
273 | ||
274 | /** | |
275 | wxIndividualLayoutConstraint top | |
23324ae1 FM |
276 | Constraint for the top edge. |
277 | */ | |
278 | ||
279 | ||
280 | /** | |
281 | wxIndividualLayoutConstraint width | |
23324ae1 FM |
282 | Constraint for the width. |
283 | */ | |
284 | }; | |
e54c96f1 | 285 |