-class WXDLLEXPORT wxIndividualLayoutConstraint: public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint)
-
- protected:
- // To be allowed to modify the internal variables
- friend class wxIndividualLayoutConstraint_Serialize;
-
- // 'This' window is the parent or sibling of otherWin
- wxWindow *otherWin;
-
- wxEdge myEdge;
- wxRelationship relationship;
- int margin;
- int value;
- int percent;
- wxEdge otherEdge;
- bool done;
-
- public:
- wxIndividualLayoutConstraint();
- ~wxIndividualLayoutConstraint();
-
- void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
-
- //
- // Sibling relationships
- //
- void LeftOf(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
- void RightOf(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
- void Above(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
- void Below(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
-
- //
- // 'Same edge' alignment
- //
- void SameAs(wxWindow *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN);
-
- // The edge is a percentage of the other window's edge
- void PercentOf(wxWindow *otherW, wxEdge wh, int per);
-
- //
- // Edge has absolute value
- //
- void Absolute(int val);
-
- //
- // Dimension is unconstrained
- //
- inline void Unconstrained() { relationship = wxUnconstrained; }
-
- //
- // Dimension is 'as is' (use current size settings)
- //
- inline void AsIs() { relationship = wxAsIs; }
-
- //
- // Accessors
- //
- inline wxWindow *GetOtherWindow() { return otherWin; }
- inline wxEdge GetMyEdge() const { return myEdge; }
- inline void SetEdge(wxEdge which) { myEdge = which; }
- inline void SetValue(int v) { value = v; }
- inline int GetMargin() { return margin; }
- inline void SetMargin(int m) { margin = m; }
- inline int GetValue() const { return value; }
- inline int GetPercent() const { return percent; }
- inline int GetOtherEdge() const { return otherEdge; }
- inline bool GetDone() const { return done; }
- inline void SetDone(bool d) { done = d; }
- inline wxRelationship GetRelationship() { return relationship; }
- inline void SetRelationship(wxRelationship r) { relationship = r; }
-
- // Reset constraint if it mentions otherWin
- bool ResetIfWin(wxWindow *otherW);
-
- // Try to satisfy constraint
- bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win);
-
- // Get the value of this edge or dimension, or if this
- // is not determinable, -1.
- int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
-};
-
-class WXDLLEXPORT wxLayoutConstraints: public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxLayoutConstraints)
-
- public:
- // Edge constraints
- wxIndividualLayoutConstraint left;
- wxIndividualLayoutConstraint top;
- wxIndividualLayoutConstraint right;
- wxIndividualLayoutConstraint bottom;
- // Size constraints
- wxIndividualLayoutConstraint width;
- wxIndividualLayoutConstraint height;
- // Centre constraints
- wxIndividualLayoutConstraint centreX;
- wxIndividualLayoutConstraint centreY;
-
- wxLayoutConstraints();
- ~wxLayoutConstraints();
-
- bool SatisfyConstraints(wxWindow *win, int *noChanges);
- bool AreSatisfied() const
- {
- return left.GetDone() && top.GetDone() && right.GetDone() &&
- bottom.GetDone() && centreX.GetDone() && centreY.GetDone();
- }
-};
-
-bool WXDLLEXPORT wxOldDoLayout(wxWindow *win);