Beispiel #1
0
        /// <summary>
        /// Nastaví dané souřadnice do Owner prvku. Pokud to prvek umožňuje, předá i další informace.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="boundsTarget"></param>
        private void _DragOwnerCall(GDragActionArgs e, Rectangle boundsTarget)
        {
            if (!this._DragOwnerBoundsOriginal.HasValue)
            {
                return;
            }

            Rectangle      boundsOriginal = this._DragOwnerBoundsOriginal.Value; // Souřadnice výchozí, před začátkem procesu Resize
            Rectangle      boundsCurrent  = this._InteractiveOwner.Bounds;       // Souřadnice nynější, před jejich změnou aktuálním krokem Resize
            DragActionType action         = e.DragAction;

            if (this._IResizeObject != null)
            {   // a) varianta přes interface IResizeObject a jeho metodu SetBoundsResized():
                RectangleSide side = RectangleSide.None;
                // Najdeme reálné strany, kde došlo ke změně souřadnice proti původní souřadnici:
                //  (ono při pohybu myši NAHORU na LEVÉ straně sice máme pohyb, ale nemáme změnu Bounds)
                //  (a dále při povolení UpsideDown můžeme sice pohybovat PRAVÝM resizerem doleva, ale nakonec měníme LEFT i RIGHT souřadnici)
                side = (boundsOriginal.Left != boundsTarget.Left   ? RectangleSide.Left   : RectangleSide.None)
                       | (boundsOriginal.Top != boundsTarget.Top    ? RectangleSide.Top    : RectangleSide.None)
                       | (boundsOriginal.Right != boundsTarget.Right  ? RectangleSide.Right  : RectangleSide.None)
                       | (boundsOriginal.Bottom != boundsTarget.Bottom ? RectangleSide.Bottom : RectangleSide.None);

                if (side != RectangleSide.None || action == DragActionType.DragThisCancel)
                {
                    ResizeObjectArgs args = new ResizeObjectArgs(e, boundsOriginal, boundsCurrent, boundsTarget, side);
                    this._IResizeObject.SetBoundsResized(args);
                }
            }
            else if (boundsTarget != boundsCurrent || action == DragActionType.DragThisCancel)
            {   // b) varianta s prostým setováním Bounds do prvku (tehdy, když prvek nemá interface IResizeObject):
                this._InteractiveOwner.Bounds = boundsTarget;
                ((IInteractiveItem)this._InteractiveOwner).Parent.Repaint();
            }
        }
Beispiel #2
0
 private void _DragItemDrop(GDragActionArgs e, ResizeItem resizeItem)
 {
     if (this._DragOwnerBoundsTarget.HasValue)
     {
         this._DragOwnerCall(e, this._DragOwnerBoundsTarget.Value);
     }
 }
Beispiel #3
0
 private void _DragItemCancel(GDragActionArgs e, ResizeItem resizeItem)
 {
     if (this._DragOwnerBoundsOriginal.HasValue)
     {
         this._DragOwnerCall(e, this._DragOwnerBoundsOriginal.Value);
     }
 }
Beispiel #4
0
 private void _DragItemStart(GDragActionArgs e, ResizeItem resizeItem)
 {
     this._DragOwnerBoundsOriginal = this._InteractiveOwner.Bounds;
     this._DragOwnerMouseOriginal  = e.MouseDownAbsolutePoint;
     this._DragOwnerItemSide       = resizeItem.Side;
     this._DragOwnerCall(e, this._DragOwnerBoundsOriginal.Value);
 }
Beispiel #5
0
        /// <summary>
        /// Tato metoda řídí proces Resize svého controlu s pomocí konkrétního <see cref="ResizeItem"/> prvku
        /// </summary>
        /// <param name="e"></param>
        /// <param name="resizeItem"></param>
        internal void DragItemAction(GDragActionArgs e, ResizeItem resizeItem)
        {
            switch (e.DragAction)
            {
            case DragActionType.DragThisStart:
                this._DragItemStart(e, resizeItem);
                break;

            case DragActionType.DragThisMove:
                this._DragItemMove(e, resizeItem);
                break;

            case DragActionType.DragThisCancel:
                this._DragItemCancel(e, resizeItem);
                break;

            case DragActionType.DragThisDrop:
                this._DragItemDrop(e, resizeItem);
                break;

            case DragActionType.DragThisEnd:
                this._DragItemEnd();
                break;
            }
        }
Beispiel #6
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="e"></param>
 /// <param name="boundsSource"></param>
 /// <param name="boundsCurrent"></param>
 /// <param name="boundsTarget"></param>
 /// <param name="side"></param>
 public ResizeObjectArgs(GDragActionArgs e, Rectangle boundsSource, Rectangle boundsCurrent, Rectangle boundsTarget, RectangleSide side)
 {
     this.DragArgs       = e;
     this.BoundsOriginal = boundsSource;
     this.BoundsCurrent  = boundsCurrent;
     this.BoundsTarget   = boundsTarget;
     this.ChangedSide    = side;
 }
Beispiel #7
0
        private void _DragItemMove(GDragActionArgs e, ResizeItem resizeItem)
        {
            Rectangle?bounds = this._DragItemGetBounds(e.MouseCurrentAbsolutePoint);

            if (bounds.HasValue)
            {
                this._DragOwnerBoundsTarget = bounds;
                this._DragOwnerCall(e, bounds.Value);
            }
        }
Beispiel #8
0
 /// <summary>
 /// Interakce: Drag and Drop - předání do controleru
 /// </summary>
 /// <param name="e"></param>
 protected override void DragAction(GDragActionArgs e)
 {
     // Nepoužíváme base podporu : base.DragAction(e);
     this._ResizeControl.DragItemAction(e, this);
 }