예제 #1
0
        private void                OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            var originalSource = GetOriginalSource(e);
            var ie             = new MouseWheelInputEventArgs(this, e.MouseDevice.GetWheel(), e.Timestamp, e.Delta, Orientation.Vertical);

            OnPreviewMouseWheel(originalSource, ie);

            e.Handled = true;
        }
예제 #2
0
        private void                OnPreviewInput(object sender, MouseWheelInputEventArgs e)
        {
            Debug.Assert(sender == Element);
            var client = _clients.FirstOrDefault(c => c.IsActive(e));

            if (client != null)
            {
                client.OnPreviewInput(sender, e);
            }
        }
예제 #3
0
 public override bool IsActive(MouseWheelInputEventArgs e)
 {
     if (e.Orientation == Orientation.Horizontal)
     {
         EnsureLoaded();
         return(Orientation == Orientation.Horizontal);
     }
     else
     {
         return(base.IsActive(e));
     }
 }
예제 #4
0
        private void                OnInput(object sender, MouseWheelInputEventArgs e)
        {
            Debug.Assert(sender == Element);
            e.Controller = this;
            var client = _clients.FirstOrDefault(c => c.IsActive(e));

            if (client != null)
            {
                _exitElement = client.ExitElement;
                client.OnInput(sender, e);
            }
        }
예제 #5
0
        protected bool                          TransferMotion(MouseWheelInputEventArgs e)
        {
            var shaft = GetMotionShaft(e.Wheel);

            if (shaft.Transfer(MotionInput, e))
            {
                return(true); // client can still move - stop event propagation
            }
            if (NestedMotionEnabled)
            {
                return(false); // let the mouse wheel event propagate up the visual tree
            }
            // empty the shaft transfer staging area and stop event propagation
            return(shaft.Transfer(NativeMotionTarget.Terminal, e));
        }
예제 #6
0
 private IntPtr              MouseHorizontalWheelHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     switch (msg)
     {
     case WM_MOUSEHWHEEL:
     {
         var timestamp      = Environment.TickCount;
         var originalSource = Mouse.DirectlyOver;
         var delta          = (short)unchecked ((uint)(long)wParam >> 16);
         var ie             = new MouseWheelInputEventArgs(this, MouseWheel.Current, timestamp, -delta, Orientation.Horizontal);
         OnPreviewMouseWheel(originalSource, ie);
         break;
     }
     }
     return(IntPtr.Zero);
 }
예제 #7
0
 public virtual void                     OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotion(e);
 }
예제 #8
0
 public virtual void                     OnPreviewInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = GetMotionShaft(e.Wheel) == null;
 }
예제 #9
0
 public override void                    OnInput(object sender, MouseWheelInputEventArgs e)
 {
     e.Handled = TransferMotionNative(e);
 }
예제 #10
0
 protected bool                          TransferMotionNative(MouseWheelInputEventArgs e)
 {
     return(GetMotionShaft(e.Wheel).Transfer(this as INativeMotionTarget, e));
 }
예제 #11
0
 public override bool                        IsActive(MouseWheelInputEventArgs e)
 {
     return(e.Orientation == Orientation.Vertical && base.IsActive(e));
 }
예제 #12
0
        private void                OnPreviewMouseWheel(IInputElement originalSource, MouseWheelInputEventArgs ie)
        {
            // Update wheel motion info
            var info = ie.Wheel.PreTransmit(ie.Timestamp, ie.Delta);

            // 1. Tunneling event
            // Clients and behaviors use this tunneling event to update the wheel transfer
            // case by dynamically creating / retrieving motion shafts.
            ie.RoutedEvent = PreviewMouseWheelInputEvent;
            originalSource.RaiseEvent(ie);

            // In cooperation with clients and behaviors, if inputEventArgs.Handled is set to true,
            // the controller lets the underlying mouse wheel tunneling event continue its route.
            if (ie.Handled)
            {
                return;
            }

            // Fill motion reservoir
            ie.Wheel.Transmit(info, ie.Delta, null);
            // 2. Bubbling event
            // Clients consume the motion here
            ie.RoutedEvent = MouseWheelInputEvent;
            originalSource.RaiseEvent(ie);
            // 3. Remaining motion is processed here
            ie.EndCommand();
        }
예제 #13
0
 public void                                 OnInput(object sender, MouseWheelInputEventArgs e)
 {
     Behavior.OnInput(sender, e);
 }
예제 #14
0
 public virtual bool                         IsActive(MouseWheelInputEventArgs e)
 {
     EnsureLoaded();
     return(Modifiers == Keyboard.Modifiers);
 }