private void MouseMove(IMouseDevice device, IInputElement root, Point p) { IInteractive source; if (this.Captured == null) { this.InputManager.SetPointerOver(this, root, p); source = root as IInteractive; } else { Point offset = new Point(); foreach (IVisual ancestor in this.Captured.GetVisualAncestors()) { offset += ancestor.Bounds.Position; } this.InputManager.SetPointerOver(this, this.Captured, p - offset); source = this.Captured as IInteractive; } if (source != null) { source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, OriginalSource = source, Source = source, }); } }
private void LeaveWindow(IMouseDevice device, ulong timestamp, IInputRoot root, InputModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); ClearPointerOver(this, timestamp, root, inputModifiers); }
protected VimTestBase() { _vim = CompositionContainer.GetExportedValue<IVim>(); _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>(); _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>(); _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>(); _wordUtilFactory = CompositionContainer.GetExportedValue<IWordUtilFactory>(); _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>(); _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>(); _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>(); _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>(); _keyboardDevice = CompositionContainer.GetExportedValue<IKeyboardDevice>(); _mouseDevice = CompositionContainer.GetExportedValue<IMouseDevice>(); _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>(); _clipboardDevice.Text = String.Empty; // One setting we do differ on for a default is 'timeout'. We don't want them interferring // with the reliability of tests. The default is on but turn it off here to prevent any // problems _vim.GlobalSettings.Timeout = false; // Don't let the personal VimRc of the user interfere with the unit tests _vim.AutoLoadVimRc = false; // Don't show trace information in the unit tests. It really clutters the output in an // xUnit run VimTrace.TraceSwitch.Level = TraceLevel.Off; }
private void MouseDown(IMouseDevice device, uint timestamp, IInputElement root, Point p) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { var settings = Locator.Current.GetService <IPlatformSettings>(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) { _clickCount = 0; } ++_clickCount; _lastClickTime = timestamp; _lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, Source = source, ClickCount = _clickCount, }; source.RaiseEvent(e); } } }
private bool MouseMove(IMouseDevice device, IInputRoot root, Point p, InputModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); IInputElement source; if (Captured == null) { source = SetPointerOver(this, root, p); } else { SetPointerOver(this, root, Captured); source = Captured; } var e = new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, Source = source, InputModifiers = inputModifiers }; source?.RaiseEvent(e); return(e.Handled); }
private void LeaveWindow(IMouseDevice device, IInputRoot root) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); ClearPointerOver(this, root); }
private bool MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta, InputModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); var hit = HitTest(root, p); if (hit != null) { var source = GetSource(hit); var e = new PointerWheelEventArgs { Device = this, RoutedEvent = InputElement.PointerWheelChangedEvent, Source = source, Delta = delta, InputModifiers = inputModifiers }; source?.RaiseEvent(e); return(e.Handled); } return(false); }
private bool MouseUp(IMouseDevice device, IInputRoot root, Point p, MouseButton button, InputModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); var hit = HitTest(root, p); if (hit != null) { var source = GetSource(hit); var e = new PointerReleasedEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, Source = source, MouseButton = button, InputModifiers = inputModifiers }; source?.RaiseEvent(e); return(e.Handled); } return(false); }
private void MouseDown(IMouseDevice device, IVisual visual, Point p) { IVisual hit = visual.GetVisualAt(p); if (hit != null) { IInteractive source = this.GetSource(hit); if (source != null) { source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, OriginalSource = source, Source = source, }); } IInputElement focusable = this.GetFocusable(hit); if (focusable != null && focusable.Focusable) { focusable.Focus(); } } }
private bool MouseMove(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, KeyModifiers inputModifiers) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); IInputElement?source; if (_pointer.Captured == null) { source = SetPointerOver(this, timestamp, root, p, properties, inputModifiers); } else { SetPointerOver(this, timestamp, root, _pointer.Captured, properties, inputModifiers); source = _pointer.Captured; } if (source is object) { var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, p, timestamp, properties, inputModifiers); source.RaiseEvent(e); return(e.Handled); } return(false); }
private bool MouseMove(IMouseDevice device, IInputRoot root, Point p, InputModifiers inputModifiers) { IInputElement source; if (Captured == null) { source = SetPointerOver(this, root, p); } else { var elements = Captured.GetSelfAndVisualAncestors().OfType <IInputElement>().ToList(); SetPointerOver(this, root, elements); source = Captured; } var e = new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, Source = source, InputModifiers = inputModifiers }; source.RaiseEvent(e); return(e.Handled); }
CefEventFlags GetMouseModifiers(IMouseDevice mouse) { var result = CefEventFlags.None; var buttons = mouse.PressedButtons; foreach (var button in mouse.DownButtons) { switch (button) { case MouseButton.Left: result |= CefEventFlags.LeftMouseButton; break; case MouseButton.Middle: result |= CefEventFlags.MiddleMouseButton; break; case MouseButton.Right: result |= CefEventFlags.RightMouseButton; break; case MouseButton.Extended1: break; case MouseButton.Extended2: break; default: break; } } return(result); }
private bool MouseWheel(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, Vector delta, KeyModifiers inputModifiers, IInputElement?hitTest) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); var source = _pointer.Captured ?? hitTest; // KeyModifiers.Shift should scroll in horizontal direction. This does not work on every platform. // If Shift-Key is pressed and X is close to 0 we swap the Vector. if (inputModifiers == KeyModifiers.Shift && MathUtilities.IsZero(delta.X)) { delta = new Vector(delta.Y, delta.X); } if (source is not null) { var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); source?.RaiseEvent(e); return(e.Handled); } return(false); }
protected VimTestBase() { _vim = CompositionContainer.GetExportedValue <IVim>(); _vimBufferFactory = CompositionContainer.GetExportedValue <IVimBufferFactory>(); _vimErrorDetector = CompositionContainer.GetExportedValue <IVimErrorDetector>(); _commonOperationsFactory = CompositionContainer.GetExportedValue <ICommonOperationsFactory>(); _wordUtilFactory = CompositionContainer.GetExportedValue <IWordUtilFactory>(); _bufferTrackingService = CompositionContainer.GetExportedValue <IBufferTrackingService>(); _foldManagerFactory = CompositionContainer.GetExportedValue <IFoldManagerFactory>(); _bulkOperations = CompositionContainer.GetExportedValue <IBulkOperations>(); _keyUtil = CompositionContainer.GetExportedValue <IKeyUtil>(); _keyboardDevice = CompositionContainer.GetExportedValue <IKeyboardDevice>(); _mouseDevice = CompositionContainer.GetExportedValue <IMouseDevice>(); _clipboardDevice = CompositionContainer.GetExportedValue <IClipboardDevice>(); _clipboardDevice.Text = String.Empty; // One setting we do differ on for a default is 'timeout'. We don't want them interferring // with the reliability of tests. The default is on but turn it off here to prevent any // problems _vim.GlobalSettings.Timeout = false; // Don't let the personal VimRc of the user interfere with the unit tests _vim.AutoLoadVimRc = false; // Don't show trace information in the unit tests. It really clutters the output in an // xUnit run VimTrace.TraceSwitch.Level = TraceLevel.Off; }
public MouseProcessor(IVimBuffer buffer, IMouseDevice mouseDevice) { _buffer = buffer; _selection = buffer.TextView.Selection; _mouseDevice = mouseDevice; _selection.SelectionChanged += OnSelectionChanged; }
private void LeaveWindow(IMouseDevice device, ulong timestamp, IInputRoot root, PointerPointProperties properties, KeyModifiers inputModifiers) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); ClearPointerOver(this, timestamp, root, properties, inputModifiers); }
public WindowBaseImpl(AvaloniaNativePlatformOptions opts) { _gpu = opts.UseGpu; _deferredRendering = opts.UseDeferredRendering; _keyboard = AvaloniaLocator.Current.GetService <IKeyboardDevice>(); _mouse = AvaloniaLocator.Current.GetService <IMouseDevice>(); _cursorFactory = AvaloniaLocator.Current.GetService <IStandardCursorFactory>(); }
public MouseDeviceState(PointerDeviceState pointerState, IMouseDevice mouseDevice) { this.PointerState = pointerState; this.MouseDevice = mouseDevice; DownButtons = new ReadOnlySet <MouseButton>(downButtons); PressedButtons = new ReadOnlySet <MouseButton>(pressedButtons); ReleasedButtons = new ReadOnlySet <MouseButton>(releasedButtons); }
public TopLevelView(TopLevelImpl tl) { _tl = tl; _mouse = AvaloniaLocator.Current.GetService <IMouseDevice>(); _keyboard = AvaloniaLocator.Current.GetService <IKeyboardDevice>(); RegisterForDraggedTypes(new string[] { "public.data" // register for any kind of data. }); }
public override void Initialize(IGameEngine engine) { base.Initialize(engine); // Get mouse device. Device = Engine.Systems.First <IInputDeviceSystem>().First(d => d is IMouseDevice) as IMouseDevice; // Initialize manager. manager = new MouseInputManager(Device); }
public Reticle(bool eyeMode, string resourcePath, SpriteLoaderFlyweight textureFlyweight) { if(eyeMode) { _mouse = new EyeDevice(EYE_DEVICE_HZ); } else { _mouse = new MouseDevice(); } _resourcePath = resourcePath; _textureLoader = textureFlyweight; _width = 30; _height = 30; }
public WpfTopLevelImpl() { PresentationSource.AddSourceChangedHandler(this, OnSourceChanged); _hook = WndProc; _ttl = this; _surfaces = new object[] { new WritableBitmapSurface(this), new Direct2DImageSurface(this) }; _mouse = new WpfMouseDevice(this); _keyboard = AvaloniaLocator.Current.GetService <IKeyboardDevice>(); ControlRoot = new CustomControlRoot(this); SnapsToDevicePixels = true; Focusable = true; DataContextChanged += delegate { ControlRoot.DataContext = DataContext; }; }
private void MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); source?.RaiseEvent(new PointerWheelEventArgs { Device = this, RoutedEvent = InputElement.PointerWheelChangedEvent, Source = source, Delta = delta, InputModifiers = inputModifiers }); } }
private void MouseUp(IMouseDevice device, IInputRoot root, Point p, MouseButton button, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); source?.RaiseEvent(new PointerReleasedEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, Source = source, MouseButton = button, InputModifiers = inputModifiers }); } }
public VimEditorHost(CompositionContainer compositionContainer) : base(compositionContainer) { _vim = CompositionContainer.GetExportedValue <IVim>(); _vimBufferFactory = CompositionContainer.GetExportedValue <IVimBufferFactory>(); _vimErrorDetector = CompositionContainer.GetExportedValue <IVimErrorDetector>(); _commonOperationsFactory = CompositionContainer.GetExportedValue <ICommonOperationsFactory>(); _bufferTrackingService = CompositionContainer.GetExportedValue <IBufferTrackingService>(); _foldManagerFactory = CompositionContainer.GetExportedValue <IFoldManagerFactory>(); _bulkOperations = CompositionContainer.GetExportedValue <IBulkOperations>(); _keyUtil = CompositionContainer.GetExportedValue <IKeyUtil>(); _protectedOperations = CompositionContainer.GetExportedValue <IProtectedOperations>(); _keyboardDevice = CompositionContainer.GetExportedValue <IKeyboardDevice>(); _mouseDevice = CompositionContainer.GetExportedValue <IMouseDevice>(); _clipboardDevice = CompositionContainer.GetExportedValue <IClipboardDevice>(); _editorFormatMapService = CompositionContainer.GetExportedValue <IEditorFormatMapService>(); _classificationFormatMapService = CompositionContainer.GetExportedValue <IClassificationFormatMapService>(); }
public VimEditorHost(CompositionContainer compositionContainer) : base(compositionContainer) { _vim = CompositionContainer.GetExportedValue<IVim>(); _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>(); _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>(); _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>(); _wordUtil = CompositionContainer.GetExportedValue<IWordUtil>(); _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>(); _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>(); _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>(); _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>(); _vimProtectedOperations = CompositionContainer.GetExportedValue<IVimProtectedOperations>(); _keyboardDevice = CompositionContainer.GetExportedValue<IKeyboardDevice>(); _mouseDevice = CompositionContainer.GetExportedValue<IMouseDevice>(); _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>(); }
private bool MouseDown(IMouseDevice device, uint timestamp, IInputElement root, Point p, MouseButton button, InputModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { var settings = AvaloniaLocator.Current.GetService <IPlatformSettings>(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) { _clickCount = 0; } ++_clickCount; _lastClickTime = timestamp; _lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressedEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, Source = source, ClickCount = _clickCount, MouseButton = button, InputModifiers = inputModifiers }; source.RaiseEvent(e); return(e.Handled); } } return(false); }
private void MouseUp(IMouseDevice device, IInputRoot root, Point p) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, Source = source, }); } } }
private bool GestureSwipe(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, Vector delta, KeyModifiers inputModifiers, IInputElement?hitTest) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); var source = _pointer.Captured ?? hitTest; if (source != null) { var e = new PointerDeltaEventArgs(Gestures.PointerTouchPadGestureSwipeEvent, source, _pointer, root, p, timestamp, props, inputModifiers, delta); source?.RaiseEvent(e); return(e.Handled); } return(false); }
public static Mock <IVim> CreateVim( IRegisterMap registerMap = null, IMarkMap map = null, IVimGlobalSettings globalSettings = null, IVimGlobalAbbreviationMap globalAbbreviationMap = null, IVimGlobalKeyMap globalKeyMap = null, IVimHost host = null, IKeyboardDevice keyboardDevice = null, IMouseDevice mouseDevice = null, IVimData vimData = null, IMacroRecorder macroRecorder = null, ISearchService searchService = null, Dictionary <string, VariableValue> variableMap = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); registerMap = registerMap ?? CreateRegisterMap().Object; map = map ?? new MarkMap(new BufferTrackingService()); globalSettings = globalSettings ?? new GlobalSettings(); host = host ?? new MockVimHost(); variableMap = variableMap ?? new Dictionary <string, VariableValue>(); globalKeyMap = globalKeyMap ?? new GlobalKeyMap(variableMap); macroRecorder = macroRecorder ?? CreateMacroRecorder(factory: factory).Object; searchService = searchService ?? factory.Create <ISearchService>().Object; keyboardDevice = keyboardDevice ?? (factory.Create <IKeyboardDevice>(MockBehavior.Loose)).Object; mouseDevice = mouseDevice ?? (factory.Create <IMouseDevice>(MockBehavior.Loose)).Object; vimData = vimData ?? VimUtil.CreateVimData(); globalAbbreviationMap = globalAbbreviationMap ?? new GlobalAbbreviationMap(); var mock = factory.Create <IVim>(MockBehavior.Strict); mock.SetupGet(x => x.RegisterMap).Returns(registerMap); mock.SetupGet(x => x.MarkMap).Returns(map); mock.SetupGet(x => x.GlobalSettings).Returns(globalSettings); mock.SetupGet(x => x.GlobalAbbreviationMap).Returns(globalAbbreviationMap); mock.SetupGet(x => x.GlobalKeyMap).Returns(globalKeyMap); mock.SetupGet(x => x.VimHost).Returns(host); mock.SetupGet(x => x.VimData).Returns(vimData); mock.SetupGet(x => x.MacroRecorder).Returns(macroRecorder); mock.SetupGet(x => x.SearchService).Returns(searchService); mock.SetupGet(x => x.VariableMap).Returns(variableMap); return(mock); }
private bool MouseMove(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, KeyModifiers inputModifiers, Lazy <IReadOnlyList <RawPointerPoint>?>?intermediatePoints, IInputElement?hitTest) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); var source = _pointer.Captured ?? hitTest; if (source is object) { var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, p, timestamp, properties, inputModifiers, intermediatePoints); source.RaiseEvent(e); return(e.Handled); } return(false); }
private bool MouseWheel(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, Vector delta, KeyModifiers inputModifiers) { Contract.Requires <ArgumentNullException>(device != null); Contract.Requires <ArgumentNullException>(root != null); var hit = HitTest(root, p); if (hit != null) { var source = GetSource(hit); var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); source?.RaiseEvent(e); return(e.Handled); } return(false); }
private bool MouseUp(IMouseDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement?hitTest) { device = device ?? throw new ArgumentNullException(nameof(device)); root = root ?? throw new ArgumentNullException(nameof(root)); var source = _pointer.Captured ?? hitTest; if (source is not null) { var e = new PointerReleasedEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, _lastMouseDownButton); source?.RaiseEvent(e); _pointer.Capture(null); return(e.Handled); } return(false); }
public Ui(string name, IView view, IStaticContainerControl root, IMouseDevice mouse, IKeyboardDevice keyboard) { Name = !string.IsNullOrEmpty(name) ? name : throw new ArgumentNullException(nameof(name)); View = view ?? throw new ArgumentNullException(nameof(view)); Root = root ?? throw new ArgumentNullException(nameof(root)); this.mouse = mouse ?? throw new ArgumentNullException(nameof(mouse)); this.keyboard = keyboard ?? throw new ArgumentNullException(nameof(keyboard)); var context = new ControlFocusManagerContext(); mouseFocusManager = new ControlMouseFocusManager(root, context); keyboardFocusManager = new ControlKeyboardFocusManager(root, context); UiCanvas.ScreenSizeChanged += UserInterfaceCanvas_ScreenSizeChanged; }
protected VimTestBase() { // Parts of the core editor in Vs2012 depend on there being an Application.Current value else // they will throw a NullReferenceException. Create one here to ensure the unit tests successfully // pass if (Application.Current == null) { new Application(); } _vim = CompositionContainer.GetExportedValue<IVim>(); _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>(); _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>(); _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>(); _wordUtil = CompositionContainer.GetExportedValue<IWordUtil>(); _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>(); _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>(); _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>(); _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>(); _vimProtectedOperations = CompositionContainer.GetExportedValue<IVimProtectedOperations>(); _keyboardDevice = CompositionContainer.GetExportedValue<IKeyboardDevice>(); _mouseDevice = CompositionContainer.GetExportedValue<IMouseDevice>(); _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>(); _clipboardDevice.Text = String.Empty; // One setting we do differ on for a default is 'timeout'. We don't want them interfering // with the reliability of tests. The default is on but turn it off here to prevent any // problems _vim.GlobalSettings.Timeout = false; // Don't let the personal VimRc of the user interfere with the unit tests _vim.AutoLoadVimRc = false; // Don't show trace information in the unit tests. It really clutters the output in an // xUnit run VimTrace.TraceSwitch.Level = TraceLevel.Off; }
public static Mock<IVim> CreateVim( IRegisterMap registerMap = null, IMarkMap map = null, IVimGlobalSettings settings = null, IVimHost host = null, IKeyMap keyMap = null, IKeyboardDevice keyboardDevice = null, IMouseDevice mouseDevice = null, IVimData vimData = null, IMacroRecorder macroRecorder = null, ISearchService searchService = null, Dictionary<string, VariableValue> variableMap = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); registerMap = registerMap ?? CreateRegisterMap().Object; map = map ?? new MarkMap(new BufferTrackingService()); settings = settings ?? new GlobalSettings(); host = host ?? new MockVimHost(); keyMap = keyMap ?? (new KeyMap(settings, new Dictionary<string, VariableValue>())); macroRecorder = macroRecorder ?? CreateMacroRecorder(factory: factory).Object; searchService = searchService ?? factory.Create<ISearchService>().Object; keyboardDevice = keyboardDevice ?? (factory.Create<IKeyboardDevice>(MockBehavior.Loose)).Object; mouseDevice = mouseDevice ?? (factory.Create<IMouseDevice>(MockBehavior.Loose)).Object; vimData = vimData ?? VimUtil.CreateVimData(); variableMap = variableMap ?? new Dictionary<string, VariableValue>(); var mock = factory.Create<IVim>(MockBehavior.Strict); mock.SetupGet(x => x.RegisterMap).Returns(registerMap); mock.SetupGet(x => x.MarkMap).Returns(map); mock.SetupGet(x => x.GlobalSettings).Returns(settings); mock.SetupGet(x => x.VimHost).Returns(host); mock.SetupGet(x => x.KeyMap).Returns(keyMap); mock.SetupGet(x => x.VimData).Returns(vimData); mock.SetupGet(x => x.MacroRecorder).Returns(macroRecorder); mock.SetupGet(x => x.SearchService).Returns(searchService); mock.SetupGet(x => x.VariableMap).Returns(variableMap); return mock; }
public MouseManager(IMouseDevice mouseDevice) { _mouseDevice = mouseDevice; }
public static Mock<IVim> CreateVim( IRegisterMap registerMap = null, MarkMap map = null, IVimGlobalSettings settings = null, IVimHost host = null, IKeyMap keyMap = null, IChangeTracker changeTracker = null, IKeyboardDevice keyboardDevice = null, IMouseDevice mouseDevice = null) { registerMap = registerMap ?? CreateRegisterMap().Object; map = map ?? new MarkMap(new TrackingLineColumnService()); settings = settings ?? new GlobalSettings(); host = host ?? new MockVimHost(); keyMap = keyMap ?? (new KeyMap()); keyboardDevice = keyboardDevice ?? (new Mock<IKeyboardDevice>(MockBehavior.Loose)).Object; mouseDevice = mouseDevice ?? (new Mock<IMouseDevice>(MockBehavior.Loose)).Object; changeTracker = changeTracker ?? new ChangeTracker(new TextChangeTrackerFactory(keyboardDevice, mouseDevice)); var mock = new Mock<IVim>(MockBehavior.Strict); mock.Setup(x => x.RegisterMap).Returns(registerMap); mock.Setup(x => x.MarkMap).Returns(map); mock.Setup(x => x.Settings).Returns(settings); mock.Setup(x => x.VimHost).Returns(host); mock.Setup(x => x.KeyMap).Returns(keyMap); mock.Setup(x => x.ChangeTracker).Returns(changeTracker); return mock; }
private void MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { source.RaiseEvent(new PointerWheelEventArgs { Device = this, RoutedEvent = InputElement.PointerWheelChangedEvent, Source = source, Delta = delta, InputModifiers = inputModifiers }); } } }
private void MouseUp(IMouseDevice device, IInputRoot root, Point p, MouseButton button, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { source.RaiseEvent(new PointerReleasedEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, Source = source, MouseButton = button, InputModifiers = inputModifiers }); } } }
private void MouseMove(IMouseDevice device, IInputRoot root, Point p, InputModifiers inputModifiers) { IInputElement source; if (Captured == null) { source = SetPointerOver(this, root, p); } else { var elements = Captured.GetSelfAndVisualAncestors().OfType<IInputElement>().ToList(); SetPointerOver(this, root, elements); source = Captured; } source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, Source = source, InputModifiers = inputModifiers }); }
private bool MouseUp(IMouseDevice device, IInputRoot root, Point p, MouseButton button, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { var source = GetSource(hit); var e = new PointerReleasedEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, Source = source, MouseButton = button, InputModifiers = inputModifiers }; source?.RaiseEvent(e); return e.Handled; } return false; }
private void LeaveWindow(IMouseDevice device, IInputRoot root) { ClearPointerOver(this, root); }
private void LeaveWindow(IMouseDevice device, IInputElement root) { this.ClearPointerOver(this); }
private void MouseDown(IMouseDevice device, uint timestamp, IInputElement root, Point p) { var hit = this.HitTest(root, p); if (hit != null) { IInteractive source = this.GetSource(hit); if (source != null) { var settings = Locator.Current.GetService<IPlatformSettings>(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; if (!this.lastClickRect.Contains(p) || timestamp - this.lastClickTime > doubleClickTime) { this.clickCount = 0; } ++this.clickCount; this.lastClickTime = timestamp; this.lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, OriginalSource = source, Source = source, ClickCount = this.clickCount, }; source.RaiseEvent(e); } } }
private void MouseMove(IMouseDevice device, IInputElement root, Point p) { IInteractive source; if (this.Captured == null) { this.SetPointerOver(this, root, p); source = root as IInteractive; } else { Point offset = new Point(); foreach (IVisual ancestor in this.Captured.GetVisualAncestors()) { offset += ancestor.Bounds.Position; } this.SetPointerOver(this, this.Captured, p - offset); source = this.Captured as IInteractive; } if (source != null) { source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerMovedEvent, OriginalSource = source, Source = source, }); } }
private void MouseWheel(IMouseDevice device, IInputElement root, Point p, Vector delta) { var hit = this.HitTest(root, p); if (hit != null) { IInteractive source = this.GetSource(hit); if (source != null) { source.RaiseEvent(new PointerWheelEventArgs { Device = this, RoutedEvent = InputElement.PointerWheelChangedEvent, OriginalSource = source, Source = source, Delta = delta, }); } } }
private void MouseDown(IMouseDevice device, uint timestamp, IInputElement root, Point p, MouseButton button, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { IInteractive source = GetSource(hit); if (source != null) { var settings = PerspexLocator.Current.GetService<IPlatformSettings>(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) { _clickCount = 0; } ++_clickCount; _lastClickTime = timestamp; _lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressEventArgs { Device = this, RoutedEvent = InputElement.PointerPressedEvent, Source = source, ClickCount = _clickCount, MouseButton = button, InputModifiers = inputModifiers }; source.RaiseEvent(e); } } }
private void MouseUp(IMouseDevice device, IInputElement root, Point p) { var hit = this.HitTest(root, p); if (hit != null) { IInteractive source = this.GetSource(hit); if (source != null) { source.RaiseEvent(new PointerEventArgs { Device = this, RoutedEvent = InputElement.PointerReleasedEvent, OriginalSource = source, Source = source, }); } } }
private bool MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta, InputModifiers inputModifiers) { var hit = HitTest(root, p); if (hit != null) { var source = GetSource(hit); var e = new PointerWheelEventArgs { Device = this, RoutedEvent = InputElement.PointerWheelChangedEvent, Source = source, Delta = delta, InputModifiers = inputModifiers }; source?.RaiseEvent(e); return e.Handled; } return false; }