public ElementPosition StretchRightTo(IGuispaceElement anchor, float xPortionAnchor, float marginX)
        {
            this.positioners.Add(new StretchRightToPositioner(anchor.Position, xPortionAnchor, marginX));
            this.dependsOn(anchor.Position);

            return(this);
        }
示例#2
0
        public void Add(AGuiElement element)
        {
            var x = this.direction.X;
            var y = this.direction.Y;

            if (this.lastElement != null)
            {
                var positionBuilder = element.Position.RelativeTo(this.lastElement, x, y, -x, -y);
                if (this.margin.HasValue)
                {
                    element.Margins += this.margin.Value;
                }
                if (element.Margins.Length > 0)
                {
                    positionBuilder.UseMargins();
                }
            }
            else
            {
                element.Position.ParentRelative(-x, -y);
            }

            this.lastElement = element;
            this.margin      = null;
        }
        public OutsidePosition RelativeTo(IGuispaceElement anchor, float xPortionAnchor, float yPortionAnchor, float xPortionThis, float yPortionThis)
        {
            var positioner = new RelativeToPositioner(anchor.Position, xPortionAnchor, yPortionAnchor, xPortionThis, yPortionThis);

            this.positioners.Add(positioner);
            this.dependsOn(anchor.Position);

            return(new OutsidePosition(this, positioner));
        }
示例#4
0
 public virtual void Attach(IGuispaceElement parent)
 {
     this.parentPosition = parent.Position;
     this.parentPosition.OnReposition += this.Recalculate;
 }
 public OutsidePosition RelativeTo(IGuispaceElement anchor)
 {
     return(this.RelativeTo(anchor, 0, 0, 0, 0));
 }
示例#6
0
 public LinearPositioner(bool horizontal, IGuispaceElement lastElement) : this(horizontal)
 {
     this.lastElement = lastElement;
 }