Esempio n. 1
0
        /// <summary>
        /// MouseDownEvent
        /// </summary>
        /// <param name="args">args</param>
        protected override void MouseDownEvent(MouseClickEventArgs args)
        {
            if (args.Button == MouseButton.Left)
            {
                if (Contains(args.MousePosition))
                {
                    if (OwnerFrame.RegisterPrecedenceEvent(this))
                    {
                        _MouseButton = MouseButton.Left;
                    }
                    TimeLine.TimePosition = GetTime(args.MousePosition.x);
                    args.Handled          = true;
                }
                else
                {
                    if (_MouseButton != MouseButton.None)
                    {
                        OwnerFrame.UnregisterPrecedenceEvent(this);
                    }
                    _MouseButton = MouseButton.None;
                }
            }
            else if (args.Button == MouseButton.Right)
            {
                if (Contains(args.MousePosition))
                {
                    double time = GetTime(args.MousePosition.x);
                    if (args.Shift && TimeLine.SelectionLenght > 0)
                    {
                        AddTime(time);
                    }
                    else
                    {
                        _StartSelectionTime = time;
                        TimeLine.SelectTime(time, time);
                    }
                    if (OwnerFrame.RegisterPrecedenceEvent(this))
                    {
                        _MouseButton = MouseButton.Right;
                    }
                    args.Handled = true;
                }
                else
                {
                    if (_MouseButton != MouseButton.None)
                    {
                        OwnerFrame.UnregisterPrecedenceEvent(this);
                    }
                    _MouseButton = MouseButton.None;
                }
            }

            base.MouseDownEvent(args);
        }
Esempio n. 2
0
 /// <summary>
 /// Occurs when mouse button was released.(if WantsMouseEvents = true)
 /// </summary>
 /// <param name="args"> MouseClickEventArgs </param>
 protected override void MouseUpEvent(MouseClickEventArgs args)
 {
     if (args.Button == MouseButton.Left)
     {
         if (_IsMouseDown)
         {
             OwnerFrame.UnregisterPrecedenceEvent(this);
         }
         _IsMouseDown = false;
         args.Handled = true;
     }
     base.MouseUpEvent(args);
 }
Esempio n. 3
0
 /// <summary>
 /// Occurs when mouse button was released.(if WantsMouseEvents = true)
 /// </summary>
 /// <param name="args"> MouseClickEventArgs </param>
 protected override void MouseUpEvent(MouseClickEventArgs args)
 {
     if (args.Button == _MouseButton)
     {
         if (_MouseButton != MouseButton.None)
         {
             OwnerFrame.UnregisterPrecedenceEvent(this);
         }
         _MouseButton = MouseButton.None;
         args.Handled = true;
     }
     base.MouseUpEvent(args);
 }
Esempio n. 4
0
 public override void HandleEvent(Event e)
 {
     if (e != null && e.type != EventType.Used)
     {
         if (_MouseButton != MouseButton.None)
         {
             EventType type = e.type;
             if (type == EventType.MouseDrag)
             {
                 MouseButton        mb   = ConvertButton(e.button);
                 MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta);
                 MouseDragEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else if (type == EventType.mouseDown)
             {
                 if (!Contains(e.mousePosition))
                 {
                     OwnerFrame.UnregisterPrecedenceEvent(this);
                     _MouseButton = MouseButton.None;
                 }
             }
             else if (type == EventType.MouseUp || e.rawType == EventType.MouseUp)
             {
                 MouseButton         mb   = ConvertButton(e.button);
                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                 MouseUpEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else
             {
                 base.HandleEvent(e);
             }
         }
         else
         {
             base.HandleEvent(e);
         }
     }
 }
Esempio n. 5
0
 public override void HandleEvent(Event e)
 {
     if (!IsEnabled)
     {
         return;
     }
     if (e != null && e.type != EventType.Used)
     {
         if (_IsMouseDown)
         {
             EventType type = e.type;
             if (type == EventType.MouseDrag)
             {
                 MouseButton        mb   = ConvertButton(e.button);
                 MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta);
                 MouseDragEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else if (type == EventType.mouseDown)
             {
                 if (!Contains(e.mousePosition))
                 {
                     if (_IsMouseDown)
                     {
                         OwnerFrame.UnregisterPrecedenceEvent(this);
                     }
                     _IsMouseDown = false;
                 }
             }
             else if (type == EventType.MouseUp || e.rawType == EventType.MouseUp)
             {
                 MouseButton         mb   = ConvertButton(e.button);
                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                 MouseUpEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else
             {
                 base.HandleEvent(e);
             }
         }
         else
         {
             if (WantsMouseEvents)
             {
                 if (e.isMouse)
                 {
                     EventType type       = e.type;
                     Vector2   localMouse = e.mousePosition;
                     if (_RenderAreaWidthOverFlow.Contains(localMouse))
                     {
                         if (type == EventType.MouseDown)
                         {
                             MouseButton mb = ConvertButton(e.button);
                             if (mb == MouseButton.Left)
                             {
                                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                                 MouseDownEvent(args);
                                 if (args.Handled)
                                 {
                                     e.Use();
                                 }
                             }
                         }
                     }
                 }
             }
             base.HandleEvent(e);
         }
     }
 }