]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_constraints.i
Doh! I changed the AddPane parameter names but didn't change their usage.
[wxWidgets.git] / wxPython / src / _constraints.i
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: _constraints.i
3// Purpose: SWIG interface defs for the layout constraints
4//
5// Author: Robin Dunn
6//
7// Created: 3-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
18%{
19%}
20
21//---------------------------------------------------------------------------
22%newgroup;
23
24
25enum wxEdge
26{
27 wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
28 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
29};
30
31enum wxRelationship
32{
33 wxUnconstrained = 0,
34 wxAsIs,
35 wxPercentOf,
36 wxAbove,
37 wxBelow,
38 wxLeftOf,
39 wxRightOf,
40 wxSameAs,
41 wxAbsolute
42};
43
44
45DocStr(wxIndividualLayoutConstraint,
46"Objects of this class are stored in the `wx.LayoutConstraints` class as
47one of eight possible constraints that a window can be involved in.
48You will never need to create an instance of
49wx.IndividualLayoutConstraint, rather you should create a
50`wx.LayoutConstraints` instance and use the individual contstraints
51that it contains.", "
52
53Constraints are initially set to have the relationship
54wx.Unconstrained, which means that their values should be calculated
55by looking at known constraints.
56
57The Edge specifies the type of edge or dimension of a window.
58
59Edges
60------
61 ================== ==============================================
62 wx.Left The left edge.
63 wx.Top The top edge.
64 wx.Right The right edge.
65 wx.Bottom The bottom edge.
66 wx.CentreX The x-coordinate of the centre of the window.
67 wx.CentreY The y-coordinate of the centre of the window.
68 ================== ==============================================
69
70
71The Relationship specifies the relationship that this edge or
72dimension has with another specified edge or dimension. Normally, the
73user doesn't use these directly because functions such as Below and
74RightOf are a convenience for using the more general Set function.
75
76Relationships
77-------------
78 ================== ==============================================
79 wx.Unconstrained The edge or dimension is unconstrained
80 (the default for edges.)
81 wx.AsIs The edge or dimension is to be taken from the current
82 window position or size (the default for dimensions.)
83 wx.Above The edge should be above another edge.
84 wx.Below The edge should be below another edge.
85 wx.LeftOf The edge should be to the left of another edge.
86 wx.RightOf The edge should be to the right of another edge.
87 wx.SameAs The edge or dimension should be the same as another edge
88 or dimension.
89 wx.PercentOf The edge or dimension should be a percentage of another
90 edge or dimension.
91 wx.Absolute The edge or dimension should be a given absolute value.
92 ================== ==============================================
93
94:see: `wx.LayoutConstraints`, `wx.Window.SetConstraints`
95");
96
97
98class wxIndividualLayoutConstraint : public wxObject
99{
100public:
101// wxIndividualLayoutConstraint();
102// ~wxIndividualLayoutConstraint();
103
104 DocDeclStr(
105 void , Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE,
106 int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN),
107 "Sets the properties of the constraint. Normally called by one of the
108convenience functions such as Above, RightOf, SameAs.", "");
109
110
111 DocDeclStr(
112 void , LeftOf(wxWindow *sibling, int marg = 0),
113 "Constrains this edge to be to the left of the given window, with an
114optional margin. Implicitly, this is relative to the left edge of the
115other window.", "");
116
117 DocDeclStr(
118 void , RightOf(wxWindow *sibling, int marg = 0),
119 "Constrains this edge to be to the right of the given window, with an
120optional margin. Implicitly, this is relative to the right edge of the
121other window.", "");
122
123 DocDeclStr(
124 void , Above(wxWindow *sibling, int marg = 0),
125 "Constrains this edge to be above the given window, with an optional
126margin. Implicitly, this is relative to the top edge of the other
127window.", "");
128
129 DocDeclStr(
130 void , Below(wxWindow *sibling, int marg = 0),
131 "Constrains this edge to be below the given window, with an optional
132margin. Implicitly, this is relative to the bottom edge of the other
133window.", "");
134
135 DocDeclStr(
136 void , SameAs(wxWindow *otherW, wxEdge edge, int marg = 0),
137 "Constrains this edge or dimension to be to the same as the edge of the
138given window, with an optional margin.", "");
139
140
141 DocDeclStr(
142 void , PercentOf(wxWindow *otherW, wxEdge wh, int per),
143 "Constrains this edge or dimension to be to a percentage of the given
144window, with an optional margin.", "");
145
146
147 DocDeclStr(
148 void , Absolute(int val),
149 "Constrains this edge or dimension to be the given absolute value.", "");
150
151 DocDeclStr(
152 void , Unconstrained(),
153 "Sets this edge or dimension to be unconstrained, that is, dependent on
154other edges and dimensions from which this value can be deduced.", "");
155
156
157 DocDeclStr(
158 void , AsIs(),
159 "Sets this edge or constraint to be whatever the window's value is at
160the moment. If either of the width and height constraints are *as is*,
161the window will not be resized, but moved instead. This is important
162when considering panel items which are intended to have a default
163size, such as a button, which may take its size from the size of the
164button label.", "");
165
166
167 DocDeclStr(
168 wxWindow *, GetOtherWindow(),
169 "", "");
170
171 DocDeclStr(
172 wxEdge , GetMyEdge() const,
173 "", "");
174
175 DocDeclStr(
176 void , SetEdge(wxEdge which),
177 "", "");
178
179 DocDeclStr(
180 void , SetValue(int v),
181 "", "");
182
183 DocDeclStr(
184 int , GetMargin(),
185 "", "");
186
187 DocDeclStr(
188 void , SetMargin(int m),
189 "", "");
190
191 DocDeclStr(
192 int , GetValue() const,
193 "", "");
194
195 DocDeclStr(
196 int , GetPercent() const,
197 "", "");
198
199 DocDeclStr(
200 int , GetOtherEdge() const,
201 "", "");
202
203 DocDeclStr(
204 bool , GetDone() const,
205 "", "");
206
207 DocDeclStr(
208 void , SetDone(bool d),
209 "", "");
210
211 DocDeclStr(
212 wxRelationship , GetRelationship(),
213 "", "");
214
215 DocDeclStr(
216 void , SetRelationship(wxRelationship r),
217 "", "");
218
219
220 DocDeclStr(
221 bool , ResetIfWin(wxWindow *otherW),
222 "Reset constraint if it mentions otherWin", "");
223
224
225 DocDeclStr(
226 bool , SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win),
227 "Try to satisfy constraint", "");
228
229
230 DocDeclStr(
231 int , GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const,
232 "Get the value of this edge or dimension, or if this\n"
233 "is not determinable, -1.", "");
234};
235
236
237DocStr(wxLayoutConstraints,
238"**Note:** constraints are now deprecated and you should use sizers
239instead.
240
241Objects of this class can be associated with a window to define its
242layout constraints, with respect to siblings or its parent.
243
244The class consists of the following eight constraints of class
245wx.IndividualLayoutConstraint, some or all of which should be accessed
246directly to set the appropriate constraints.
247
248 * left: represents the left hand edge of the window
249 * right: represents the right hand edge of the window
250 * top: represents the top edge of the window
251 * bottom: represents the bottom edge of the window
252 * width: represents the width of the window
253 * height: represents the height of the window
254 * centreX: represents the horizontal centre point of the window
255 * centreY: represents the vertical centre point of the window
256
257Most constraints are initially set to have the relationship
258wxUnconstrained, which means that their values should be calculated by
259looking at known constraints. The exceptions are width and height,
260which are set to wxAsIs to ensure that if the user does not specify a
261constraint, the existing width and height will be used, to be
262compatible with panel items which often have take a default size. If
263the constraint is ``wx.AsIs``, the dimension will not be changed.
264
265:see: `wx.IndividualLayoutConstraint`, `wx.Window.SetConstraints`
266", "");
267
268
269class wxLayoutConstraints : public wxObject
270{
271public:
272 %immutable;
273
274 // Edge constraints
275 wxIndividualLayoutConstraint left;
276 wxIndividualLayoutConstraint top;
277 wxIndividualLayoutConstraint right;
278 wxIndividualLayoutConstraint bottom;
279
280 // Size constraints
281 wxIndividualLayoutConstraint width;
282 wxIndividualLayoutConstraint height;
283
284 // Centre constraints
285 wxIndividualLayoutConstraint centreX;
286 wxIndividualLayoutConstraint centreY;
287
288 %mutable;
289
290 DocCtorStr(
291 wxLayoutConstraints(),
292 "", "");
293
294 ~wxLayoutConstraints();
295
296 DocDeclA(
297 bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
298 "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
299
300 bool AreSatisfied() const;
301};
302
303//---------------------------------------------------------------------------