1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of layout constraints classes
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 wxLeft
, wxTop
, wxRight
, wxBottom
, wxWidth
, wxHeight
,
12 wxCentre
, wxCenter
= wxCentre
, wxCentreX
, wxCentreY
28 const int wxLAYOUT_DEFAULT_MARGIN
= 0;
30 // ----------------------------------------------------------------------------
31 // wxIndividualLayoutConstraint: a constraint on window position
32 // ----------------------------------------------------------------------------
34 class wxIndividualLayoutConstraint
: public wxObject
37 wxIndividualLayoutConstraint();
39 // note that default copy ctor and assignment operators are ok
41 virtual ~wxIndividualLayoutConstraint();
43 void Set(wxRelationship rel
,
47 int margin
= wxLAYOUT_DEFAULT_MARGIN
);
50 // Sibling relationships
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
);
58 // 'Same edge' alignment
60 void SameAs(wxWindow
*otherW
, wxEdge edge
, int margin
= wxLAYOUT_DEFAULT_MARGIN
);
62 // The edge is a percentage of the other window's edge
63 void PercentOf(wxWindow
*otherW
, wxEdge wh
, int per
);
66 // Edge has absolute value
68 void Absolute(int val
);
71 // Dimension is unconstrained
76 // Dimension is 'as is' (use current size settings)
83 wxWindow
*GetOtherWindow();
84 wxEdge
GetMyEdge() const;
85 void SetEdge(wxEdge which
);
88 void SetMargin(int m
);
90 int GetPercent() const;
91 int GetOtherEdge() const;
94 wxRelationship
GetRelationship();
95 void SetRelationship(wxRelationship r
);
97 // Reset constraint if it mentions otherWin
98 bool ResetIfWin(wxWindow
*otherW
);
100 // Try to satisfy constraint
101 bool SatisfyConstraint(wxLayoutConstraints
*constraints
, wxWindow
*win
);
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;
108 // ----------------------------------------------------------------------------
109 // wxLayoutConstraints: the complete set of constraints for a window
110 // ----------------------------------------------------------------------------
112 class wxLayoutConstraints
: public wxObject
116 wxIndividualLayoutConstraint left
;
117 wxIndividualLayoutConstraint top
;
118 wxIndividualLayoutConstraint right
;
119 wxIndividualLayoutConstraint bottom
;
121 wxIndividualLayoutConstraint width
;
122 wxIndividualLayoutConstraint height
;
123 // Centre constraints
124 wxIndividualLayoutConstraint centreX
;
125 wxIndividualLayoutConstraint centreY
;
127 wxLayoutConstraints();
129 // note that default copy ctor and assignment operators are ok
131 virtual ~wxLayoutConstraints();
133 bool SatisfyConstraints(wxWindow
*win
, int *noChanges
);
134 bool AreSatisfied() const;