/// <summary> /// Provede obsluhu MouseLeave /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void MouseLeave(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.MouseOverPartChange(this.LastMouseOverPart, null, e); this.LastMouseOverPart = TrackBarAreaType.None; this.MouseDragOffset = null; this.MouseOverPoint = null; this.Repaint(); }
/// <summary> /// Provede obsluhu MouseUp. /// Tato metoda není volaná po skončení procesu Drag and Move, pouze po LeftDown bez následného Drag. /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void LeftUp(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.Value = this.ValueDrag; this.ValueDragOriginal = null; this.MouseDragOffset = null; this.MouseOverPoint = e.MouseAbsolutePoint; this.ToolTipPrepare(e, false, true); this.Repaint(); }
/// <summary> /// Provede obsluhu MouseOver /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void MouseOver(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.MouseOverPoint = e.MouseAbsolutePoint; if (partType != this.LastMouseOverPart) { this.MouseOverPartChange(this.LastMouseOverPart, partType, e); this.LastMouseOverPart = partType; } this.Repaint(); }
/// <summary> /// Provede obsluhu MouseDrag Move /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void LeftDragMove(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { if (!this.MouseDragOffset.HasValue || !e.MouseRelativePoint.HasValue) { return; } Point dragPoint = e.MouseRelativePoint.Value.Sub(this.MouseDragOffset.Value); this.ValueDrag = this.GetValueForPoint(dragPoint); this.ToolTipPrepare(e, true, true); this.Repaint(); }
/// <summary> /// Řeší interaktivitu /// </summary> /// <param name="e"></param> protected override void AfterStateChanged(GInteractiveChangeStateArgs e) { TrackBarAreaType partType = this.GetPartType(e); switch (e.ChangeState) { case GInteractiveChangeState.MouseEnter: this.MouseEnter(partType, e); break; case GInteractiveChangeState.MouseOver: this.MouseOver(partType, e); break; case GInteractiveChangeState.LeftDown: this.LeftDown(partType, e); break; case GInteractiveChangeState.LeftDragMoveBegin: this.LeftDragBegin(partType, e); break; case GInteractiveChangeState.LeftDragMoveStep: this.LeftDragMove(partType, e); break; case GInteractiveChangeState.LeftDragMoveDone: this.LeftDragDrop(partType, e); break; case GInteractiveChangeState.LeftUp: this.LeftUp(partType, e); break; case GInteractiveChangeState.MouseLeave: this.MouseLeave(partType, e); break; } base.AfterStateChanged(e); }
/// <summary> /// Provede obsluhu LeftDown /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void LeftDown(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.MouseOverPoint = null; this.ValueDragOriginal = this.Value; switch (partType) { case TrackBarAreaType.NonActive: case TrackBarAreaType.Area: // Kliknuto do aktivní plochy, ale ne do oblasti TrackPointeru: // => okamžitě přemístíme TrackPointeru na daný bod, a budeme očekávat Drag and Move: this.ValueDrag = this.GetTrackValue(e); this.MouseDragOffset = new Point(0, 0); break; case TrackBarAreaType.Pointer: // Kliknuto do prostoru TrackPointeru: // => TrackPointer nikam nepřemísťujeme, určíme jenom offset pozice myši od TrackPointeru, a počkáme jestli uživatel sám provede Drag and Move: this.MouseDragOffset = e.MouseRelativePoint.Value.Sub(this.TrackPoint); break; } this.LastMouseOverPart = partType; this.ToolTipPrepare(e, true, true); this.Repaint(); }
/// <summary> /// Provede obsluhu MouseDrag Begin /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void LeftDragBegin(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.MouseOverPoint = null; this.ToolTipPrepare(e, true, true); this.Repaint(); }
/// <summary> /// Provede obsluhu MouseEnter /// </summary> /// <param name="partType"></param> /// <param name="e"></param> protected virtual void MouseEnter(TrackBarAreaType partType, GInteractiveChangeStateArgs e) { this.MouseOverPartChange(null, partType, e); this.ToolTipPrepare(e, false, false); }