Пример #1
0
        /// <summary>
        /// Metoda vrátí oblast, ve které se pohybuje myš
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected virtual TrackBarAreaType GetPartType(GInteractiveChangeStateArgs e)
        {
            Point?mouseRelativePoint = e.MouseRelativePoint;               // Souřadnice myši relativně k this, tj. hodnota 0/0 znamená levý horní roh TrackBaru

            if (!mouseRelativePoint.HasValue)
            {
                return(TrackBarAreaType.None);
            }
            Point mouse = mouseRelativePoint.Value;

            Rectangle trackPointerBounds = this.TrackPointerActiveBounds;

            if (trackPointerBounds.Contains(mouse))
            {
                return(TrackBarAreaType.Pointer);
            }

            Rectangle activeBounds = this.ActiveBounds;

            if (activeBounds.Contains(mouse))
            {
                return(TrackBarAreaType.Area);
            }

            return(TrackBarAreaType.NonActive);
        }
Пример #2
0
        /// <summary>
        /// Provádí se při jakékoli interaktivní změně
        /// </summary>
        /// <param name="e"></param>
        protected override void AfterStateChanged(GInteractiveChangeStateArgs e)
        {
            base.AfterStateChanged(e);

            switch (e.ChangeState)
            {
            case GInteractiveChangeState.KeyboardKeyDown:
                if (IsKeyToActivateButton(e.KeyboardEventArgs))
                {
                    this.ButtonClickDown(false);
                }
                break;

            case GInteractiveChangeState.KeyboardKeyUp:
                if (IsPressedActiveKey)
                {
                    this.ButtonClickUp(false);
                }
                break;

            case GInteractiveChangeState.LeftDown:
                this.ButtonClickDown(true);
                break;

            case GInteractiveChangeState.LeftUp:
                if (IsPressedActiveMouse)
                {
                    this.ButtonClickUp(true);
                }
                break;
            }
        }
Пример #3
0
        /// <summary>
        /// Metoda vrátí bod nejbližší k bodu (e.MouseRelativePoint), který leží na dráze posuvníku <see cref="TrackLineBounds"/>.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected virtual decimal GetTrackValue(GInteractiveChangeStateArgs e)
        {
            Rectangle trackLine  = this.TrackLineBounds;
            Point     trackPoint = (e.MouseRelativePoint.HasValue ? e.MouseRelativePoint.Value.FitInto(trackLine) : trackLine.Location);
            decimal   value      = this.GetValueForPoint(trackPoint, trackLine);

            return(value);
        }
Пример #4
0
 /// <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();
 }
Пример #5
0
        private void _TextDoubleClick(object sender, GInteractiveChangeStateArgs e)
        {
            TextEdit textEdit = sender as TextEdit;
            string   text     = textEdit?.Tag as string;

            text = $"Text.DoubleClick na prvku:{Environment.NewLine}{text}Aktuální hodnota: \"{textEdit.Text}\"; ";
            System.Windows.Forms.MessageBox.Show(text, "TextDoubleClick", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #6
0
 /// <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();
 }
Пример #7
0
 /// <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();
 }
Пример #8
0
        /// <summary>
        /// Připraví ToolTip
        /// </summary>
        /// <param name="e"></param>
        public override void PrepareToolTip(GInteractiveChangeStateArgs e)
        {
            string toolTipText = this.ToolTipText;

            if (!String.IsNullOrEmpty(toolTipText))
            {
                e.ToolTipData.IconType  = IconImageType.Info;
                e.ToolTipData.TitleText = "Informace k prvku";
                e.ToolTipData.InfoText  = toolTipText;
            }
        }
Пример #9
0
        /// <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();
        }
Пример #10
0
        /// <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);
        }
Пример #11
0
        /// <summary>
        /// Připraví data pro ToolTip
        /// </summary>
        /// <param name="e"></param>
        /// <param name="isValueDrag"></param>
        /// <param name="isInstant"></param>
        protected virtual void ToolTipPrepare(GInteractiveChangeStateArgs e, bool isValueDrag, bool isInstant)
        {
            if (isValueDrag && !this.ToolTipShowOnDraw)
            {
                return;
            }

            string title = this.ToolTipTitle;
            string text  = this.ToolTipText;

            if (String.IsNullOrEmpty(title) && String.IsNullOrEmpty(text))
            {
                return;
            }

            e.ToolTipData.TitleText = title;
            e.ToolTipData.InfoText  = text;
            if (isInstant)
            {
                e.ToolTipData.AnimationType = (isValueDrag ? TooltipAnimationType.Instant : TooltipAnimationType.InstantInFadeOut);
            }
        }
Пример #12
0
        /// <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();
        }
Пример #13
0
 /// <summary>
 /// Interakce: po vstupu myši - nastavit kurzor
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChangedMouseEnter(GInteractiveChangeStateArgs e)
 {
     base.AfterStateChangedMouseEnter(e);
     e.RequiredCursorType = (this.Orientation == Orientation.Vertical ? SysCursorType.VSplit : SysCursorType.HSplit);
 }
Пример #14
0
 /// <summary>
 /// ToolTip nepatří prvku Resize, ale jeho vlastníkovi
 /// </summary>
 /// <param name="e"></param>
 public override void PrepareToolTip(GInteractiveChangeStateArgs e)
 {
     this.InteractiveOwner.PrepareToolTip(e);
 }
Пример #15
0
 /// <summary>
 /// Po odchodu Focusu z Containeru. Třída <see cref="InteractiveLabeledContainer"/> řídí modifikaci fontu a barvy titulku
 /// (odebráním <see cref="TitleFontModifierOnFocus"/> a <see cref="TitleTextColorOnFocus"/> z objektu <see cref="TitleLabel"/>).
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChangedFocusLeave(GInteractiveChangeStateArgs e)
 {
     base.AfterStateChangedFocusLeave(e);
     SetStylesToControls(false, true);
 }
Пример #16
0
 /// <summary>
 /// Called after any interactive change value of State
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChanged(GInteractiveChangeStateArgs e)
 {
 }
Пример #17
0
        /// <summary>
        /// Called after any interactive change value of State
        /// </summary>
        /// <param name="e"></param>
        /// <param name="childItem"></param>
        protected void AfterStateChanged(GInteractiveChangeStateArgs e, ChildItem childItem)
        {
            if (childItem != null)
            {
                this.InteractiveState = e.TargetState;
            }
            switch (e.ChangeState)
            {
            case GInteractiveChangeState.MouseEnter:
                // Mouse can Enter to main item = this (childItem != null), or to child item (childItem != null):
                this.ActiveChild = childItem;
                this.Repaint();
                if (childItem != null)
                {
                    e.RequiredCursorType = childItem.OverCursorType;
                }
                break;

            case GInteractiveChangeState.MouseLeave:
                // Mouse can Leave from main item = this (childItem != null), or from child item (childItem != null):
                this.ActiveChild = null;
                this.Repaint();
                if (childItem != null)
                {
                    e.RequiredCursorType = SysCursorType.Default;
                }
                else
                {
                    e.RepaintAllItems = true;
                }
                break;

            case GInteractiveChangeState.MouseOver:
                this.Repaint();
                break;

            case GInteractiveChangeState.LeftDragMoveBegin:
                if (childItem != null && childItem.CanDrag)
                {
                    this.BoundsDragOrigin = this.Bounds;
                    this.ActiveChild      = childItem;
                    this.Repaint(GInteractiveDrawLayer.Standard | GInteractiveDrawLayer.Interactive);
                    e.RepaintAllItems    = true;
                    e.RequiredCursorType = childItem.DragCursorType;
                    e.UserDragPoint      = this.Bounds.Location.Add(childItem.ActivePoint);
                }
                break;

            case GInteractiveChangeState.LeftDragMoveStep:
                if (this.ActiveChild != null && this.ActiveChild.CanDrag && e.UserDragPoint.HasValue)
                {
                    this.Repaint(/* GInteractiveDrawLayer.Standard | */ GInteractiveDrawLayer.Interactive);
                    Point currentPoint = e.UserDragPoint.Value;
                    this.CalculateNewBounds(this.ActiveChild, e.UserDragPoint.Value);

                    Rectangle newBounds = this.Bounds;
                    Rectangle oldBounds = (this.BoundsDragOrigin.HasValue ? this.BoundsDragOrigin.Value : newBounds);
                    this.CallBoundsChanged(oldBounds, newBounds, EventSourceType.InteractiveChanging | EventSourceType.BoundsChange);
                }
                break;

            case GInteractiveChangeState.LeftDragMoveCancel:

                if (this.BoundsDragOrigin.HasValue)
                {
                    Rectangle oldBounds = this.Bounds;
                    Rectangle newBounds = this.BoundsDragOrigin.Value;
                    this.SetBounds(newBounds, ProcessAction.PrepareInnerItems, EventSourceType.InteractiveChanged);
                    this.Repaint();
                }
                break;

            case GInteractiveChangeState.LeftDragMoveDone:
                if (this.ActiveChild != null && this.ActiveChild.CanDrag)
                {
                    Rectangle newBounds = this.Bounds;
                    Rectangle oldBounds = (this.BoundsDragOrigin.HasValue ? this.BoundsDragOrigin.Value : newBounds);
                    this.CallBoundsChanged(oldBounds, newBounds, EventSourceType.InteractiveChanged | EventSourceType.BoundsChange);
                    this.Repaint();
                }
                break;

            case GInteractiveChangeState.LeftDragMoveEnd:
                this.BoundsDragOrigin = null;
                if (childItem != null)
                {
                    e.RequiredCursorType = childItem.OverCursorType;
                }
                e.RepaintAllItems = true;
                break;

            default:
                var s = e.ChangeState;
                break;
            }
        }
Пример #18
0
 /// <summary>
 /// Called after any interactive change value of State
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChanged(GInteractiveChangeStateArgs e)
 {
     this.AfterStateChanged(e, null);
 }
Пример #19
0
 /// <summary>
 /// Called after any interactive change value of State
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChanged(GInteractiveChangeStateArgs e)
 {
     this.Owner.AfterStateChanged(e, this);
 }
Пример #20
0
 /// <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);
 }
Пример #21
0
 /// <summary>
 /// Řeší změnu pozice myši nad prvky TrackBaru
 /// </summary>
 /// <param name="oldPartType"></param>
 /// <param name="newPartType"></param>
 /// <param name="e"></param>
 protected virtual void MouseOverPartChange(TrackBarAreaType?oldPartType, TrackBarAreaType?newPartType, GInteractiveChangeStateArgs e)
 {
 }
Пример #22
0
 /// <summary>
 /// Po odchodu Focusu z containeru
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChangedFocusLeave(GInteractiveChangeStateArgs e)
 {
     base.AfterStateChangedFocusLeave(e);
 }
Пример #23
0
 /// <summary>
 /// Interakce: po odchodu myši - nastavit kurzor
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChangedMouseLeave(GInteractiveChangeStateArgs e)
 {
     base.AfterStateChangedMouseLeave(e);
     e.RequiredCursorType = SysCursorType.Default;
 }
Пример #24
0
 /// <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();
 }
Пример #25
0
 /// <summary>
 /// Called after any interactive change value of State
 /// </summary>
 /// <param name="e"></param>
 protected override void AfterStateChanged(GInteractiveChangeStateArgs e)
 {
     if (e.ChangeState == GInteractiveChangeState.LeftDragMoveStep)
     {
     }
 }
Пример #26
0
 /// <summary>
 /// Prepare layout for Tooltip in case, when ToolTip will be showed.
 /// Is called after e.ToolTipData.InfoText is prepared (contain valid text).
 /// </summary>
 /// <param name="e"></param>
 public override void PrepareToolTip(GInteractiveChangeStateArgs e)
 {
     base.PrepareToolTip(e);
     e.ToolTipData.TitleText     = "Size informations";
     e.ToolTipData.AnimationType = TooltipAnimationType.Instant;
 }