public AnchorToArgs(IAnchorable anchorTo, PositionType positionType, int x, int y, AnchorType type) { AnchorTo = anchorTo; PositionType = positionType; OffsetX = x; OffsetY = y; AnchorType = type; }
/// <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."); }
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(); }
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."); }
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)); }
public Control Add(Control control, IAnchorable anchor, AnchorAlignment align, PositionOffset offset) { control.AnchorTo(anchor, align, offset); return(Add(control)); }
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."); }
public AnchorToArgs(IAnchorable anchorTo) : this(anchorTo, PositionType.Inside_Top_Left, 0, 0, AnchorType.Bounds) { }