]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_constraints.i
reSWIGged
[wxWidgets.git] / wxPython / src / _constraints.i
CommitLineData
d14a1e28
RD
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
861d4832 45DocStr(wxIndividualLayoutConstraint,
d07d2bc9
RD
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.", "
861d4832 52
d07d2bc9
RD
53Constraints are initially set to have the relationship
54wx.Unconstrained, which means that their values should be calculated
55by looking at known constraints.
861d4832
RD
56
57The Edge specifies the type of edge or dimension of a window.
58
d07d2bc9
RD
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
861d4832 80 (the default for edges.)
d07d2bc9 81 wx.AsIs The edge or dimension is to be taken from the current
861d4832 82 window position or size (the default for dimensions.)
d07d2bc9
RD
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
861d4832 88 or dimension.
d07d2bc9 89 wx.PercentOf The edge or dimension should be a percentage of another
861d4832 90 edge or dimension.
d07d2bc9
RD
91 wx.Absolute The edge or dimension should be a given absolute value.
92 ================== ==============================================
861d4832 93
d07d2bc9 94:see: `wx.LayoutConstraints`, `wx.Window.SetConstraints`
861d4832
RD
95");
96
d07d2bc9 97
d14a1e28
RD
98class wxIndividualLayoutConstraint : public wxObject
99{
100public:
101// wxIndividualLayoutConstraint();
102// ~wxIndividualLayoutConstraint();
103
861d4832
RD
104 DocDeclStr(
105 void , Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE,
106 int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN),
d07d2bc9
RD
107 "Sets the properties of the constraint. Normally called by one of the
108convenience functions such as Above, RightOf, SameAs.", "");
861d4832 109
d14a1e28 110
861d4832
RD
111 DocDeclStr(
112 void , LeftOf(wxWindow *sibling, int marg = 0),
d07d2bc9
RD
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.", "");
861d4832
RD
116
117 DocDeclStr(
118 void , RightOf(wxWindow *sibling, int marg = 0),
d07d2bc9
RD
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.", "");
861d4832
RD
122
123 DocDeclStr(
124 void , Above(wxWindow *sibling, int marg = 0),
d07d2bc9
RD
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.", "");
861d4832
RD
128
129 DocDeclStr(
130 void , Below(wxWindow *sibling, int marg = 0),
d07d2bc9
RD
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.", "");
861d4832
RD
134
135 DocDeclStr(
136 void , SameAs(wxWindow *otherW, wxEdge edge, int marg = 0),
d07d2bc9
RD
137 "Constrains this edge or dimension to be to the same as the edge of the
138given window, with an optional margin.", "");
861d4832
RD
139
140
141 DocDeclStr(
142 void , PercentOf(wxWindow *otherW, wxEdge wh, int per),
d07d2bc9
RD
143 "Constrains this edge or dimension to be to a percentage of the given
144window, with an optional margin.", "");
861d4832
RD
145
146
147 DocDeclStr(
148 void , Absolute(int val),
d07d2bc9 149 "Constrains this edge or dimension to be the given absolute value.", "");
861d4832
RD
150
151 DocDeclStr(
152 void , Unconstrained(),
d07d2bc9
RD
153 "Sets this edge or dimension to be unconstrained, that is, dependent on
154other edges and dimensions from which this value can be deduced.", "");
861d4832
RD
155
156
157 DocDeclStr(
158 void , AsIs(),
d07d2bc9
RD
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.", "");
861d4832
RD
165
166
167 DocDeclStr(
168 wxWindow *, GetOtherWindow(),
d07d2bc9 169 "", "");
861d4832
RD
170
171 DocDeclStr(
172 wxEdge , GetMyEdge() const,
d07d2bc9 173 "", "");
861d4832
RD
174
175 DocDeclStr(
176 void , SetEdge(wxEdge which),
d07d2bc9 177 "", "");
861d4832
RD
178
179 DocDeclStr(
180 void , SetValue(int v),
d07d2bc9 181 "", "");
861d4832
RD
182
183 DocDeclStr(
184 int , GetMargin(),
d07d2bc9 185 "", "");
861d4832
RD
186
187 DocDeclStr(
188 void , SetMargin(int m),
d07d2bc9 189 "", "");
861d4832
RD
190
191 DocDeclStr(
192 int , GetValue() const,
d07d2bc9 193 "", "");
861d4832
RD
194
195 DocDeclStr(
196 int , GetPercent() const,
d07d2bc9 197 "", "");
861d4832
RD
198
199 DocDeclStr(
200 int , GetOtherEdge() const,
d07d2bc9 201 "", "");
861d4832
RD
202
203 DocDeclStr(
204 bool , GetDone() const,
d07d2bc9 205 "", "");
861d4832
RD
206
207 DocDeclStr(
208 void , SetDone(bool d),
d07d2bc9 209 "", "");
861d4832
RD
210
211 DocDeclStr(
212 wxRelationship , GetRelationship(),
d07d2bc9 213 "", "");
861d4832
RD
214
215 DocDeclStr(
216 void , SetRelationship(wxRelationship r),
d07d2bc9 217 "", "");
861d4832
RD
218
219
220 DocDeclStr(
221 bool , ResetIfWin(wxWindow *otherW),
d07d2bc9 222 "Reset constraint if it mentions otherWin", "");
861d4832
RD
223
224
225 DocDeclStr(
226 bool , SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win),
d07d2bc9 227 "Try to satisfy constraint", "");
861d4832
RD
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"
d07d2bc9 233 "is not determinable, -1.", "");
76b8fa1d
RD
234
235 %property(Done, GetDone, SetDone, doc="See `GetDone` and `SetDone`");
236 %property(Margin, GetMargin, SetMargin, doc="See `GetMargin` and `SetMargin`");
237 %property(MyEdge, GetMyEdge, doc="See `GetMyEdge`");
238 %property(OtherEdge, GetOtherEdge, doc="See `GetOtherEdge`");
239 %property(OtherWindow, GetOtherWindow, doc="See `GetOtherWindow`");
240 %property(Percent, GetPercent, doc="See `GetPercent`");
241 %property(Relationship, GetRelationship, SetRelationship, doc="See `GetRelationship` and `SetRelationship`");
242 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
243
d14a1e28
RD
244};
245
c5633576 246
861d4832 247DocStr(wxLayoutConstraints,
d07d2bc9
RD
248"**Note:** constraints are now deprecated and you should use sizers
249instead.
861d4832 250
d07d2bc9
RD
251Objects of this class can be associated with a window to define its
252layout constraints, with respect to siblings or its parent.
861d4832
RD
253
254The class consists of the following eight constraints of class
255wx.IndividualLayoutConstraint, some or all of which should be accessed
256directly to set the appropriate constraints.
d14a1e28 257
861d4832
RD
258 * left: represents the left hand edge of the window
259 * right: represents the right hand edge of the window
260 * top: represents the top edge of the window
261 * bottom: represents the bottom edge of the window
262 * width: represents the width of the window
263 * height: represents the height of the window
264 * centreX: represents the horizontal centre point of the window
265 * centreY: represents the vertical centre point of the window
266
d07d2bc9
RD
267Most constraints are initially set to have the relationship
268wxUnconstrained, which means that their values should be calculated by
269looking at known constraints. The exceptions are width and height,
270which are set to wxAsIs to ensure that if the user does not specify a
271constraint, the existing width and height will be used, to be
272compatible with panel items which often have take a default size. If
273the constraint is ``wx.AsIs``, the dimension will not be changed.
274
275:see: `wx.IndividualLayoutConstraint`, `wx.Window.SetConstraints`
276", "");
861d4832 277
d07d2bc9 278
d14a1e28
RD
279class wxLayoutConstraints : public wxObject
280{
281public:
282 %immutable;
861d4832 283
d14a1e28
RD
284 // Edge constraints
285 wxIndividualLayoutConstraint left;
286 wxIndividualLayoutConstraint top;
287 wxIndividualLayoutConstraint right;
288 wxIndividualLayoutConstraint bottom;
861d4832 289
d14a1e28
RD
290 // Size constraints
291 wxIndividualLayoutConstraint width;
292 wxIndividualLayoutConstraint height;
861d4832 293
d14a1e28
RD
294 // Centre constraints
295 wxIndividualLayoutConstraint centreX;
296 wxIndividualLayoutConstraint centreY;
861d4832 297
d14a1e28 298 %mutable;
d14a1e28 299
861d4832
RD
300 DocCtorStr(
301 wxLayoutConstraints(),
d07d2bc9 302 "", "");
c5633576
RD
303
304 ~wxLayoutConstraints();
6c3b4aae
RD
305
306 DocDeclA(
307 bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
308 "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
309
d14a1e28
RD
310 bool AreSatisfied() const;
311};
312
313//---------------------------------------------------------------------------