]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_constraints.i
Lots of bup fixes, API updates, etc
[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
45// wxIndividualLayoutConstraint: a constraint on window position
46class wxIndividualLayoutConstraint : public wxObject
47{
48public:
49// wxIndividualLayoutConstraint();
50// ~wxIndividualLayoutConstraint();
51
52 void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
53
54 //
55 // Sibling relationships
56 //
57 void LeftOf(wxWindow *sibling, int marg = 0);
58 void RightOf(wxWindow *sibling, int marg = 0);
59 void Above(wxWindow *sibling, int marg = 0);
60 void Below(wxWindow *sibling, int marg = 0);
61
62 //
63 // 'Same edge' alignment
64 //
65 void SameAs(wxWindow *otherW, wxEdge edge, int marg = 0);
66
67 // The edge is a percentage of the other window's edge
68 void PercentOf(wxWindow *otherW, wxEdge wh, int per);
69
70 //
71 // Edge has absolute value
72 //
73 void Absolute(int val);
74
75 //
76 // Dimension is unconstrained
77 //
78 void Unconstrained() { relationship = wxUnconstrained; }
79
80 //
81 // Dimension is 'as is' (use current size settings)
82 //
83 void AsIs() { relationship = wxAsIs; }
84
85 //
86 // Accessors
87 //
88 wxWindow *GetOtherWindow();
89 wxEdge GetMyEdge() const;
90 void SetEdge(wxEdge which);
91 void SetValue(int v);
92 int GetMargin();
93 void SetMargin(int m);
94 int GetValue() const;
95 int GetPercent() const;
96 int GetOtherEdge() const;
97 bool GetDone() const;
98 void SetDone(bool d);
99 wxRelationship GetRelationship();
100 void SetRelationship(wxRelationship r);
101
102 // Reset constraint if it mentions otherWin
103 bool ResetIfWin(wxWindow *otherW);
104
105 // Try to satisfy constraint
106 bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win);
107
108 // Get the value of this edge or dimension, or if this
109 // is not determinable, -1.
110 int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
111
112};
113
114
115// wxLayoutConstraints: the complete set of constraints for a window
116class wxLayoutConstraints : public wxObject
117{
118public:
119 %immutable;
120 // Edge constraints
121 wxIndividualLayoutConstraint left;
122 wxIndividualLayoutConstraint top;
123 wxIndividualLayoutConstraint right;
124 wxIndividualLayoutConstraint bottom;
125 // Size constraints
126 wxIndividualLayoutConstraint width;
127 wxIndividualLayoutConstraint height;
128 // Centre constraints
129 wxIndividualLayoutConstraint centreX;
130 wxIndividualLayoutConstraint centreY;
131 %mutable;
132
133 wxLayoutConstraints();
134
6c3b4aae
RD
135
136 DocDeclA(
137 bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
138 "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
139
d14a1e28
RD
140 bool AreSatisfied() const;
141};
142
143//---------------------------------------------------------------------------