Remove obsolete VisualAge-related files.
[wxWidgets.git] / interface / wx / layout.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: layout.h
3 // Purpose: interface of layout constraints classes
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8
9 enum wxEdge
10 {
11 wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
12 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
13 };
14
15 enum wxRelationship
16 {
17 wxUnconstrained,
18 wxAsIs,
19 wxPercentOf,
20 wxAbove,
21 wxBelow,
22 wxLeftOf,
23 wxRightOf,
24 wxSameAs,
25 wxAbsolute
26 };
27
28 const int wxLAYOUT_DEFAULT_MARGIN = 0;
29
30 // ----------------------------------------------------------------------------
31 // wxIndividualLayoutConstraint: a constraint on window position
32 // ----------------------------------------------------------------------------
33
34 class wxIndividualLayoutConstraint : public wxObject
35 {
36 public:
37 wxIndividualLayoutConstraint();
38
39 // note that default copy ctor and assignment operators are ok
40
41 virtual ~wxIndividualLayoutConstraint();
42
43 void Set(wxRelationship rel,
44 wxWindow *otherW,
45 wxEdge otherE,
46 int val = 0,
47 int margin = wxLAYOUT_DEFAULT_MARGIN);
48
49 //
50 // Sibling relationships
51 //
52 void LeftOf(wxWindow *sibling, int margin = wxLAYOUT_DEFAULT_MARGIN);
53 void RightOf(wxWindow *sibling, int margin = wxLAYOUT_DEFAULT_MARGIN);
54 void Above(wxWindow *sibling, int margin = wxLAYOUT_DEFAULT_MARGIN);
55 void Below(wxWindow *sibling, int margin = wxLAYOUT_DEFAULT_MARGIN);
56
57 //
58 // 'Same edge' alignment
59 //
60 void SameAs(wxWindow *otherW, wxEdge edge, int margin = wxLAYOUT_DEFAULT_MARGIN);
61
62 // The edge is a percentage of the other window's edge
63 void PercentOf(wxWindow *otherW, wxEdge wh, int per);
64
65 //
66 // Edge has absolute value
67 //
68 void Absolute(int val);
69
70 //
71 // Dimension is unconstrained
72 //
73 void Unconstrained();
74
75 //
76 // Dimension is 'as is' (use current size settings)
77 //
78 void AsIs();
79
80 //
81 // Accessors
82 //
83 wxWindow *GetOtherWindow();
84 wxEdge GetMyEdge() const;
85 void SetEdge(wxEdge which);
86 void SetValue(int v);
87 int GetMargin();
88 void SetMargin(int m);
89 int GetValue() const;
90 int GetPercent() const;
91 int GetOtherEdge() const;
92 bool GetDone() const;
93 void SetDone(bool d);
94 wxRelationship GetRelationship();
95 void SetRelationship(wxRelationship r);
96
97 // Reset constraint if it mentions otherWin
98 bool ResetIfWin(wxWindow *otherW);
99
100 // Try to satisfy constraint
101 bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win);
102
103 // Get the value of this edge or dimension, or if this
104 // is not determinable, -1.
105 int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
106 };
107
108 // ----------------------------------------------------------------------------
109 // wxLayoutConstraints: the complete set of constraints for a window
110 // ----------------------------------------------------------------------------
111
112 class wxLayoutConstraints : public wxObject
113 {
114 public:
115 // Edge constraints
116 wxIndividualLayoutConstraint left;
117 wxIndividualLayoutConstraint top;
118 wxIndividualLayoutConstraint right;
119 wxIndividualLayoutConstraint bottom;
120 // Size constraints
121 wxIndividualLayoutConstraint width;
122 wxIndividualLayoutConstraint height;
123 // Centre constraints
124 wxIndividualLayoutConstraint centreX;
125 wxIndividualLayoutConstraint centreY;
126
127 wxLayoutConstraints();
128
129 // note that default copy ctor and assignment operators are ok
130
131 virtual ~wxLayoutConstraints();
132
133 bool SatisfyConstraints(wxWindow *win, int *noChanges);
134 bool AreSatisfied() const;
135 };
136