1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of layout constraints classes
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 wxLeft
, wxTop
, wxRight
, wxBottom
, wxWidth
, wxHeight
,
13 wxCentre
, wxCenter
= wxCentre
, wxCentreX
, wxCentreY
29 const int wxLAYOUT_DEFAULT_MARGIN
= 0;
31 // ----------------------------------------------------------------------------
32 // wxIndividualLayoutConstraint: a constraint on window position
33 // ----------------------------------------------------------------------------
35 class wxIndividualLayoutConstraint
: public wxObject
38 wxIndividualLayoutConstraint();
40 // note that default copy ctor and assignment operators are ok
42 virtual ~wxIndividualLayoutConstraint();
44 void Set(wxRelationship rel
,
48 int margin
= wxLAYOUT_DEFAULT_MARGIN
);
51 // Sibling relationships
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
);
59 // 'Same edge' alignment
61 void SameAs(wxWindow
*otherW
, wxEdge edge
, int margin
= wxLAYOUT_DEFAULT_MARGIN
);
63 // The edge is a percentage of the other window's edge
64 void PercentOf(wxWindow
*otherW
, wxEdge wh
, int per
);
67 // Edge has absolute value
69 void Absolute(int val
);
72 // Dimension is unconstrained
77 // Dimension is 'as is' (use current size settings)
84 wxWindow
*GetOtherWindow();
85 wxEdge
GetMyEdge() const;
86 void SetEdge(wxEdge which
);
89 void SetMargin(int m
);
91 int GetPercent() const;
92 int GetOtherEdge() const;
95 wxRelationship
GetRelationship();
96 void SetRelationship(wxRelationship r
);
98 // Reset constraint if it mentions otherWin
99 bool ResetIfWin(wxWindow
*otherW
);
101 // Try to satisfy constraint
102 bool SatisfyConstraint(wxLayoutConstraints
*constraints
, wxWindow
*win
);
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;
109 // ----------------------------------------------------------------------------
110 // wxLayoutConstraints: the complete set of constraints for a window
111 // ----------------------------------------------------------------------------
113 class wxLayoutConstraints
: public wxObject
117 wxIndividualLayoutConstraint left
;
118 wxIndividualLayoutConstraint top
;
119 wxIndividualLayoutConstraint right
;
120 wxIndividualLayoutConstraint bottom
;
122 wxIndividualLayoutConstraint width
;
123 wxIndividualLayoutConstraint height
;
124 // Centre constraints
125 wxIndividualLayoutConstraint centreX
;
126 wxIndividualLayoutConstraint centreY
;
128 wxLayoutConstraints();
130 // note that default copy ctor and assignment operators are ok
132 virtual ~wxLayoutConstraints();
134 bool SatisfyConstraints(wxWindow
*win
, int *noChanges
);
135 bool AreSatisfied() const;