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.LayoutConstraints` class as
 
  47 one of eight possible constraints that a window can be involved in.
 
  48 You will never need to create an instance of
 
  49 wx.IndividualLayoutConstraint, rather you should create a
 
  50 `wx.LayoutConstraints` instance and use the individual contstraints
 
  53 Constraints are initially set to have the relationship
 
  54 wx.Unconstrained, which means that their values should be calculated
 
  55 by looking at known constraints.
 
  57 The Edge specifies the type of edge or dimension of a window.
 
  61     ==================  ==============================================
 
  62     wx.Left             The left edge.
 
  64     wx.Right            The right edge.
 
  65     wx.Bottom           The bottom edge.
 
  66     wx.CentreX          The x-coordinate of the centre of the window.
 
  67     wx.CentreY          The y-coordinate of the centre of the window. 
 
  68     ==================  ==============================================
 
  71 The Relationship specifies the relationship that this edge or
 
  72 dimension has with another specified edge or dimension. Normally, the
 
  73 user doesn't use these directly because functions such as Below and
 
  74 RightOf are a convenience for using the more general Set function.
 
  78     ==================  ==============================================
 
  79     wx.Unconstrained    The edge or dimension is unconstrained
 
  80                         (the default for edges.)
 
  81     wx.AsIs             The edge or dimension is to be taken from the current
 
  82                         window position or size (the default for dimensions.)
 
  83     wx.Above            The edge should be above another edge.
 
  84     wx.Below            The edge should be below another edge.
 
  85     wx.LeftOf           The edge should be to the left of another edge.
 
  86     wx.RightOf          The edge should be to the right of another edge.
 
  87     wx.SameAs           The edge or dimension should be the same as another edge
 
  89     wx.PercentOf        The edge or dimension should be a percentage of another
 
  91     wx.Absolute         The edge or dimension should be a given absolute value.
 
  92     ==================  ==============================================
 
  94 :see: `wx.LayoutConstraints`, `wx.Window.SetConstraints`
 
  98 class wxIndividualLayoutConstraint : public wxObject
 
 101 //    wxIndividualLayoutConstraint();
 
 102 //    ~wxIndividualLayoutConstraint();
 
 105         void , Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE,
 
 106                    int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN),
 
 107         "Sets the properties of the constraint. Normally called by one of the
 
 108 convenience functions such as Above, RightOf, SameAs.", "");
 
 112         void , LeftOf(wxWindow *sibling, int marg = 0),
 
 113         "Constrains this edge to be to the left of the given window, with an
 
 114 optional margin. Implicitly, this is relative to the left edge of the
 
 118         void , RightOf(wxWindow *sibling, int marg = 0),
 
 119         "Constrains this edge to be to the right of the given window, with an
 
 120 optional margin. Implicitly, this is relative to the right edge of the
 
 124         void , Above(wxWindow *sibling, int marg = 0),
 
 125         "Constrains this edge to be above the given window, with an optional
 
 126 margin. Implicitly, this is relative to the top edge of the other
 
 130         void , Below(wxWindow *sibling, int marg = 0),
 
 131         "Constrains this edge to be below the given window, with an optional
 
 132 margin. Implicitly, this is relative to the bottom edge of the other
 
 136         void , SameAs(wxWindow *otherW, wxEdge edge, int marg = 0),
 
 137         "Constrains this edge or dimension to be to the same as the edge of the
 
 138 given window, with an optional margin.", "");
 
 142         void , PercentOf(wxWindow *otherW, wxEdge wh, int per),
 
 143         "Constrains this edge or dimension to be to a percentage of the given
 
 144 window, with an optional margin.", "");
 
 148         void , Absolute(int val),
 
 149         "Constrains this edge or dimension to be the given absolute value.", "");
 
 152         void , Unconstrained(),
 
 153         "Sets this edge or dimension to be unconstrained, that is, dependent on
 
 154 other edges and dimensions from which this value can be deduced.", "");
 
 159         "Sets this edge or constraint to be whatever the window's value is at
 
 160 the moment. If either of the width and height constraints are *as is*,
 
 161 the window will not be resized, but moved instead. This is important
 
 162 when considering panel items which are intended to have a default
 
 163 size, such as a button, which may take its size from the size of the
 
 168         wxWindow *, GetOtherWindow(),
 
 172         wxEdge , GetMyEdge() const,
 
 176         void , SetEdge(wxEdge which),
 
 180         void , SetValue(int v),
 
 188         void , SetMargin(int m),
 
 192         int , GetValue() const,
 
 196         int , GetPercent() const,
 
 200         int , GetOtherEdge() const,
 
 204         bool , GetDone() const,
 
 208         void , SetDone(bool d),
 
 212         wxRelationship , GetRelationship(),
 
 216         void , SetRelationship(wxRelationship r),
 
 221         bool , ResetIfWin(wxWindow *otherW),
 
 222         "Reset constraint if it mentions otherWin", "");
 
 226         bool , SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win),
 
 227         "Try to satisfy constraint", "");
 
 231         int , GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const,
 
 232         "Get the value of this edge or dimension, or if this\n"
 
 233         "is not determinable, -1.", "");
 
 237 DocStr(wxLayoutConstraints,
 
 238 "**Note:** constraints are now deprecated and you should use sizers
 
 241 Objects of this class can be associated with a window to define its
 
 242 layout constraints, with respect to siblings or its parent.
 
 244 The class consists of the following eight constraints of class
 
 245 wx.IndividualLayoutConstraint, some or all of which should be accessed
 
 246 directly to set the appropriate constraints.
 
 248     * left: represents the left hand edge of the window
 
 249     * right: represents the right hand edge of the window
 
 250     * top: represents the top edge of the window
 
 251     * bottom: represents the bottom edge of the window
 
 252     * width: represents the width of the window
 
 253     * height: represents the height of the window
 
 254     * centreX: represents the horizontal centre point of the window
 
 255     * centreY: represents the vertical centre point of the window 
 
 257 Most constraints are initially set to have the relationship
 
 258 wxUnconstrained, which means that their values should be calculated by
 
 259 looking at known constraints. The exceptions are width and height,
 
 260 which are set to wxAsIs to ensure that if the user does not specify a
 
 261 constraint, the existing width and height will be used, to be
 
 262 compatible with panel items which often have take a default size. If
 
 263 the constraint is ``wx.AsIs``, the dimension will not be changed.
 
 265 :see: `wx.IndividualLayoutConstraint`, `wx.Window.SetConstraints`
 
 269 class wxLayoutConstraints : public wxObject
 
 275     wxIndividualLayoutConstraint left;
 
 276     wxIndividualLayoutConstraint top;
 
 277     wxIndividualLayoutConstraint right;
 
 278     wxIndividualLayoutConstraint bottom;
 
 281     wxIndividualLayoutConstraint width;
 
 282     wxIndividualLayoutConstraint height;
 
 284     // Centre constraints
 
 285     wxIndividualLayoutConstraint centreX;
 
 286     wxIndividualLayoutConstraint centreY;
 
 291         wxLayoutConstraints(),
 
 294     ~wxLayoutConstraints();
 
 297         bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
 
 298         "SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
 
 300     bool AreSatisfied() const;
 
 303 //---------------------------------------------------------------------------