public void StartHoverSelection(IWindowWrapper currentWindow) { StopHoverSelection(); var nativeWindow = currentWindow.NativeObject as NSWindow; endSelection = false; clickMonitor = NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.LeftMouseDown, (NSEvent theEvent) => { StopHoverSelection(); var selected = GetHoverSelectedView(); if (selected != null) { HoverSelectionEnded?.Invoke(this, new ViewWrapper(selected)); } else { HoverSelectionEnded?.Invoke(this, null); } return(null); }); moveMonitor = NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.MouseMoved, (NSEvent theEvent) => { if (endSelection) { return(null); } var point = nativeWindow.ConvertBaseToScreen(theEvent.LocationInWindow); if (!nativeWindow.AccessibilityFrame.Contains(point)) { return(null); } containerViews.Clear(); AddContainerViews(nativeWindow.ContentView, point, containerViews); if (containerViews.Count > 0) { index = containerViews.Count - 1; } else { index = -1; } var selectedView = GetHoverSelectedView(); if (selectedView != null) { HoverSelecting?.Invoke(this, new ViewWrapper(selectedView)); } return(null); }); }
public void PreviousHoverSelection() { if (index >= containerViews.Count - 2) { return; } index++; var selectedView = GetHoverSelectedView(); if (selectedView != null) { HoverSelecting?.Invoke(this, new View(selectedView)); } }
public void DeepHoverSelection() { if (index == 0) { return; } index--; var selectedView = GetHoverSelectedView(); if (selectedView != null) { HoverSelecting?.Invoke(this, new View(selectedView)); } }