1 /////////////////////////////////////////////////////////////////////////////
 
   2 // Name:        _constraints.i
 
   3 // Purpose:     SWIG interface defs for the layout constraints
 
   7 // Created:     3-July-1997
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  21 //---------------------------------------------------------------------------
 
  27     wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
 
  28     wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
 
  45 DocStr(wxIndividualLayoutConstraint,
 
  46 "Objects of this class are stored in the wx.LayoutConstraint class as one of
 
  47 eight possible constraints that a window can be involved in.  You will never
 
  48 need to create an instance of wx.IndividualLayoutConstraint, rather you should
 
  49 use create a wx.LayoutContstraints instance and use the individual contstraints
 
  52 Constraints are initially set to have the relationship wx.Unconstrained, which
 
  53 means that their values should be calculated by looking at known constraints.
 
  55 The Edge specifies the type of edge or dimension of a window.
 
  59     wx.Left     The left edge.
 
  61     wx.Right    The right edge.
 
  62     wx.Bottom   The bottom edge.
 
  63     wx.CentreX  The x-coordinate of the centre of the window.
 
  64     wx.CentreY  The y-coordinate of the centre of the window. 
 
  67 The Relationship specifies the relationship that this edge or dimension has
 
  68 with another specified edge or dimension. Normally, the user doesn't use these
 
  69 directly because functions such as Below and RightOf are a convenience for
 
  70 using the more general Set function.
 
  74     wx.Unconstrained    The edge or dimension is unconstrained
 
  75                         (the default for edges.)
 
  76     wx.AsIs             The edge or dimension is to be taken from the current
 
  77                         window position or size (the default for dimensions.)
 
  78     wx.Above            The edge should be above another edge.
 
  79     wx.Below            The edge should be below another edge.
 
  80     wx.LeftOf           The edge should be to the left of another edge.
 
  81     wx.RightOf          The edge should be to the right of another edge.
 
  82     wx.SameAs           The edge or dimension should be the same as another edge
 
  84     wx.PercentOf        The edge or dimension should be a percentage of another
 
  86     wx.Absolute         The edge or dimension should be a given absolute value.
 
  90 // wxIndividualLayoutConstraint: a constraint on window position
 
  91 class wxIndividualLayoutConstraint : public wxObject
 
  94 //    wxIndividualLayoutConstraint();
 
  95 //    ~wxIndividualLayoutConstraint();
 
  98         void , Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE,
 
  99                    int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN),
 
 104         void , LeftOf(wxWindow *sibling, int marg = 0),
 
 105         "Sibling relationship");
 
 108         void , RightOf(wxWindow *sibling, int marg = 0),
 
 109         "Sibling relationship");
 
 112         void , Above(wxWindow *sibling, int marg = 0),
 
 113         "Sibling relationship");
 
 116         void , Below(wxWindow *sibling, int marg = 0),
 
 117         "Sibling relationship");
 
 120         void , SameAs(wxWindow *otherW, wxEdge edge, int marg = 0),
 
 121         "'Same edge' alignment");
 
 125         void , PercentOf(wxWindow *otherW, wxEdge wh, int per),
 
 126         "The edge is a percentage of the other window's edge");
 
 130         void , Absolute(int val),
 
 131         "Edge has absolute value");
 
 134         void , Unconstrained(),
 
 135         "Dimension is unconstrained");
 
 140         "Dimension is 'as is' (use current size settings)");
 
 144         wxWindow *, GetOtherWindow(),
 
 148         wxEdge , GetMyEdge() const,
 
 152         void , SetEdge(wxEdge which),
 
 156         void , SetValue(int v),
 
 164         void , SetMargin(int m),
 
 168         int , GetValue() const,
 
 172         int , GetPercent() const,
 
 176         int , GetOtherEdge() const,
 
 180         bool , GetDone() const,
 
 184         void , SetDone(bool d),
 
 188         wxRelationship , GetRelationship(),
 
 192         void , SetRelationship(wxRelationship r),
 
 197         bool , ResetIfWin(wxWindow *otherW),
 
 198         "Reset constraint if it mentions otherWin");
 
 202         bool , SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win),
 
 203         "Try to satisfy constraint");
 
 207         int , GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const,
 
 208         "Get the value of this edge or dimension, or if this\n"
 
 209         "is not determinable, -1.");
 
 212 DocStr(wxLayoutConstraints,
 
 213 "Note: constraints are now deprecated and you should use sizers instead.
 
 215 Objects of this class can be associated with a window to define its layout
 
 216 constraints, with respect to siblings or its parent.
 
 218 The class consists of the following eight constraints of class
 
 219 wx.IndividualLayoutConstraint, some or all of which should be accessed
 
 220 directly to set the appropriate constraints.
 
 222     * left: represents the left hand edge of the window
 
 223     * right: represents the right hand edge of the window
 
 224     * top: represents the top edge of the window
 
 225     * bottom: represents the bottom edge of the window
 
 226     * width: represents the width of the window
 
 227     * height: represents the height of the window
 
 228     * centreX: represents the horizontal centre point of the window
 
 229     * centreY: represents the vertical centre point of the window 
 
 231 Most constraints are initially set to have the relationship wxUnconstrained,
 
 232 which means that their values should be calculated by looking at known
 
 233 constraints. The exceptions are width and height, which are set to wxAsIs to
 
 234 ensure that if the user does not specify a constraint, the existing width and
 
 235 height will be used, to be compatible with panel items which often have take a
 
 236 default size. If the constraint is wxAsIs, the dimension will not be changed.
 
 239 // wxLayoutConstraints: the complete set of constraints for a window
 
 240 class wxLayoutConstraints : public wxObject
 
 246     wxIndividualLayoutConstraint left;
 
 247     wxIndividualLayoutConstraint top;
 
 248     wxIndividualLayoutConstraint right;
 
 249     wxIndividualLayoutConstraint bottom;
 
 252     wxIndividualLayoutConstraint width;
 
 253     wxIndividualLayoutConstraint height;
 
 255     // Centre constraints
 
 256     wxIndividualLayoutConstraint centreX;
 
 257     wxIndividualLayoutConstraint centreY;
 
 262         wxLayoutConstraints(),
 
 266         bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
 
 267         "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
 
 269     bool AreSatisfied() const;
 
 272 //---------------------------------------------------------------------------