Exemplo n.º 1
0
 public AnchorToArgs(IAnchorable anchorTo, PositionType positionType, int x, int y, AnchorType type)
 {
     AnchorTo     = anchorTo;
     PositionType = positionType;
     OffsetX      = x;
     OffsetY      = y;
     AnchorType   = type;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Anchor this control to another.
 /// </summary>
 /// <param name="target">anchor to</param>
 /// <param name="owner">this object</param>
 /// <param name="alignment">alignment type</param>
 /// <param name="offset">position offset</param>
 public AnchorComponent(IAnchorable target, IAnchorable owner, AnchorAlignment alignment, PositionOffset offset)
 {
     _target   = target;
     _owner    = owner;
     Alignment = alignment;
     Offset    = offset;
     _target.PositionChanged += OnAnchorMoved;
 }
 public void AnchorTo(IAnchorable target, PositionType style, int offsetX = 0, int offsetY = 0, AnchorType anchorType = AnchorType.Bounds)
 {
     if (target != (IAnchorable)this)
     {
         RemoveAnchor();
         _anchor = new AnchorComponent(target, this, anchorType, style, new MonoGame.Extended.Size2(offsetX, offsetY));
         return;
     }
     Console.WriteLine("WARNING: Attempted to anchor this object to itself.");
 }
Exemplo n.º 4
0
 public AnchorComponent(IAnchorable target, IAnchorable owner, AnchorType anchorType, PositionType positionType, Size2 offset)
 {
     _target                      = target;
     _owner                       = owner;
     _anchorType                  = anchorType;
     _positionType                = positionType;
     _anchorOffset                = offset;
     _target.OnPositionChanged   += AnchorMoved;
     _target.OnDimmensionChanged += DimmensionChange;
     InitialPlacement();
 }
Exemplo n.º 5
0
 public void AnchorTo(IAnchorable target, AnchorAlignment alignment, PositionOffset offset)
 {
     if (target.GetHashCode() != GetHashCode())
     {
         RemoveAnchor();
         Anchor   = new AnchorComponent(target, this, alignment, offset);
         Position = Anchor.AnchoredPosition;
         Anchored = true;
         return;
     }
     throw new NotSupportedException("Cannot anchor an object to itself.");
 }
Exemplo n.º 6
0
 public void AnchorTo(IAnchorable target, PositionType style, int offsetX = 0, int offsetY = 0, AnchorType anchorType = AnchorType.Bounds)
 {
     RemoveAnchor();
     _anchor = new AnchorComponent(target, this, anchorType, style, new MonoGame.Extended.Size2(offsetX, offsetY));
 }
Exemplo n.º 7
0
 public Control Add(Control control, IAnchorable anchor, AnchorAlignment align, PositionOffset offset)
 {
     control.AnchorTo(anchor, align, offset);
     return(Add(control));
 }
Exemplo n.º 8
0
 public void AnchorTo(IAnchorable target, PositionType style, int offsetX = 0, int offsetY = 0, AnchorType anchorType = AnchorType.Bounds)
 {
     throw new NotSupportedException("Can't anchor this viewport to anything.");
 }
Exemplo n.º 9
0
 public AnchorToArgs(IAnchorable anchorTo)
     : this(anchorTo, PositionType.Inside_Top_Left, 0, 0, AnchorType.Bounds)
 {
 }