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