/// <summary> /// Subtracts a <see cref="Terminal.Gui.Pos"/> from a <see cref="Terminal.Gui.Pos"/>, yielding a new <see cref="T:Terminal.Gui.Pos"/>. /// </summary> /// <param name="left">The <see cref="Terminal.Gui.Pos"/> to subtract from (the minuend).</param> /// <param name="right">The <see cref="Terminal.Gui.Pos"/> to subtract (the subtrahend).</param> /// <returns>The <see cref="T:Terminal.Gui.Pos"/> that is the <c>left</c> minus <c>right</c>.</returns> public static Pos operator -(Pos left, Pos right) { PosCombine newPos = new PosCombine(false, left, right); if (posCombine?.ToString() != newPos.ToString()) { ((PosView)left).Target.SetNeedsLayout(); } return(posCombine = newPos); }
static void SetPosCombine(Pos left, PosCombine newPos) { if (posCombine?.ToString() != newPos.ToString()) { var view = left as PosView; if (view != null) { view.Target.SetNeedsLayout(); } } }
/// <summary> /// Subtracts a <see cref="Terminal.Gui.Pos"/> from a <see cref="Terminal.Gui.Pos"/>, yielding a new <see cref="Pos"/>. /// </summary> /// <param name="left">The <see cref="Terminal.Gui.Pos"/> to subtract from (the minuend).</param> /// <param name="right">The <see cref="Terminal.Gui.Pos"/> to subtract (the subtrahend).</param> /// <returns>The <see cref="Pos"/> that is the <c>left</c> minus <c>right</c>.</returns> public static Pos operator -(Pos left, Pos right) { if (left is PosAbsolute && right is PosAbsolute) { posCombine = null; return(new PosAbsolute(left.Anchor(0) - right.Anchor(0))); } PosCombine newPos = new PosCombine(false, left, right); SetPosCombine(left, newPos); return(posCombine = newPos); }
/// <summary> /// Subtracts a <see cref="Terminal.Gui.Pos"/> from a <see cref="Terminal.Gui.Pos"/>, yielding a new <see cref="Pos"/>. /// </summary> /// <param name="left">The <see cref="Terminal.Gui.Pos"/> to subtract from (the minuend).</param> /// <param name="right">The <see cref="Terminal.Gui.Pos"/> to subtract (the subtrahend).</param> /// <returns>The <see cref="Pos"/> that is the <c>left</c> minus <c>right</c>.</returns> public static Pos operator -(Pos left, Pos right) { PosCombine newPos = new PosCombine(false, left, right); if (posCombine?.ToString() != newPos.ToString()) { var view = left as PosView; if (view != null) { view.Target.SetNeedsLayout(); } } return(posCombine = newPos); }