]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_constraints.i
Added some info panels that show size and colour attributes about the widget
[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
RD
45DocStr(wxIndividualLayoutConstraint,
46"Objects of this class are stored in the wx.LayoutConstraint class as one of
47eight possible constraints that a window can be involved in. You will never
48need to create an instance of wx.IndividualLayoutConstraint, rather you should
49use create a wx.LayoutContstraints instance and use the individual contstraints
50that it contains.
51
52Constraints are initially set to have the relationship wx.Unconstrained, which
53means that their values should be calculated by looking at known constraints.
54
55The Edge specifies the type of edge or dimension of a window.
56
57 Edges
58
59 wx.Left The left edge.
60 wx.Top The top edge.
61 wx.Right The right edge.
62 wx.Bottom The bottom edge.
63 wx.CentreX The x-coordinate of the centre of the window.
64 wx.CentreY The y-coordinate of the centre of the window.
65
66
67The Relationship specifies the relationship that this edge or dimension has
68with another specified edge or dimension. Normally, the user doesn't use these
69directly because functions such as Below and RightOf are a convenience for
70using the more general Set function.
71
72 Relationships
73
74 wx.Unconstrained The edge or dimension is unconstrained
75 (the default for edges.)
76 wx.AsIs The edge or dimension is to be taken from the current
77 window position or size (the default for dimensions.)
78 wx.Above The edge should be above another edge.
79 wx.Below The edge should be below another edge.
80 wx.LeftOf The edge should be to the left of another edge.
81 wx.RightOf The edge should be to the right of another edge.
82 wx.SameAs The edge or dimension should be the same as another edge
83 or dimension.
84 wx.PercentOf The edge or dimension should be a percentage of another
85 edge or dimension.
86 wx.Absolute The edge or dimension should be a given absolute value.
87
88");
89
d14a1e28
RD
90// wxIndividualLayoutConstraint: a constraint on window position
91class wxIndividualLayoutConstraint : public wxObject
92{
93public:
94// wxIndividualLayoutConstraint();
95// ~wxIndividualLayoutConstraint();
96
861d4832
RD
97 DocDeclStr(
98 void , Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE,
99 int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN),
100 "");
101
d14a1e28 102
861d4832
RD
103 DocDeclStr(
104 void , LeftOf(wxWindow *sibling, int marg = 0),
105 "Sibling relationship");
106
107 DocDeclStr(
108 void , RightOf(wxWindow *sibling, int marg = 0),
109 "Sibling relationship");
110
111 DocDeclStr(
112 void , Above(wxWindow *sibling, int marg = 0),
113 "Sibling relationship");
114
115 DocDeclStr(
116 void , Below(wxWindow *sibling, int marg = 0),
117 "Sibling relationship");
118
119 DocDeclStr(
120 void , SameAs(wxWindow *otherW, wxEdge edge, int marg = 0),
121 "'Same edge' alignment");
122
123
124 DocDeclStr(
125 void , PercentOf(wxWindow *otherW, wxEdge wh, int per),
126 "The edge is a percentage of the other window's edge");
127
128
129 DocDeclStr(
130 void , Absolute(int val),
131 "Edge has absolute value");
132
133 DocDeclStr(
134 void , Unconstrained(),
135 "Dimension is unconstrained");
136
137
138 DocDeclStr(
139 void , AsIs(),
140 "Dimension is 'as is' (use current size settings)");
141
142
143 DocDeclStr(
144 wxWindow *, GetOtherWindow(),
145 "");
146
147 DocDeclStr(
148 wxEdge , GetMyEdge() const,
149 "");
150
151 DocDeclStr(
152 void , SetEdge(wxEdge which),
153 "");
154
155 DocDeclStr(
156 void , SetValue(int v),
157 "");
158
159 DocDeclStr(
160 int , GetMargin(),
161 "");
162
163 DocDeclStr(
164 void , SetMargin(int m),
165 "");
166
167 DocDeclStr(
168 int , GetValue() const,
169 "");
170
171 DocDeclStr(
172 int , GetPercent() const,
173 "");
174
175 DocDeclStr(
176 int , GetOtherEdge() const,
177 "");
178
179 DocDeclStr(
180 bool , GetDone() const,
181 "");
182
183 DocDeclStr(
184 void , SetDone(bool d),
185 "");
186
187 DocDeclStr(
188 wxRelationship , GetRelationship(),
189 "");
190
191 DocDeclStr(
192 void , SetRelationship(wxRelationship r),
193 "");
194
195
196 DocDeclStr(
197 bool , ResetIfWin(wxWindow *otherW),
198 "Reset constraint if it mentions otherWin");
199
200
201 DocDeclStr(
202 bool , SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win),
203 "Try to satisfy constraint");
204
205
206 DocDeclStr(
207 int , GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const,
208 "Get the value of this edge or dimension, or if this\n"
209 "is not determinable, -1.");
d14a1e28
RD
210};
211
861d4832
RD
212DocStr(wxLayoutConstraints,
213"Note: constraints are now deprecated and you should use sizers instead.
214
215Objects of this class can be associated with a window to define its layout
216constraints, with respect to siblings or its parent.
217
218The class consists of the following eight constraints of class
219wx.IndividualLayoutConstraint, some or all of which should be accessed
220directly to set the appropriate constraints.
d14a1e28 221
861d4832
RD
222 * left: represents the left hand edge of the window
223 * right: represents the right hand edge of the window
224 * top: represents the top edge of the window
225 * bottom: represents the bottom edge of the window
226 * width: represents the width of the window
227 * height: represents the height of the window
228 * centreX: represents the horizontal centre point of the window
229 * centreY: represents the vertical centre point of the window
230
231Most constraints are initially set to have the relationship wxUnconstrained,
232which means that their values should be calculated by looking at known
233constraints. The exceptions are width and height, which are set to wxAsIs to
234ensure that if the user does not specify a constraint, the existing width and
235height will be used, to be compatible with panel items which often have take a
236default size. If the constraint is wxAsIs, the dimension will not be changed.
237");
238
d14a1e28
RD
239// wxLayoutConstraints: the complete set of constraints for a window
240class wxLayoutConstraints : public wxObject
241{
242public:
243 %immutable;
861d4832 244
d14a1e28
RD
245 // Edge constraints
246 wxIndividualLayoutConstraint left;
247 wxIndividualLayoutConstraint top;
248 wxIndividualLayoutConstraint right;
249 wxIndividualLayoutConstraint bottom;
861d4832 250
d14a1e28
RD
251 // Size constraints
252 wxIndividualLayoutConstraint width;
253 wxIndividualLayoutConstraint height;
861d4832 254
d14a1e28
RD
255 // Centre constraints
256 wxIndividualLayoutConstraint centreX;
257 wxIndividualLayoutConstraint centreY;
861d4832 258
d14a1e28 259 %mutable;
d14a1e28 260
861d4832
RD
261 DocCtorStr(
262 wxLayoutConstraints(),
263 "");
6c3b4aae
RD
264
265 DocDeclA(
266 bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
267 "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
268
d14a1e28
RD
269 bool AreSatisfied() const;
270};
271
272//---------------------------------------------------------------------------