public void OnPointerUp(PointerEventData pointer) { if (Item.IsEmpty || IsBlocked) { return; } if (pointer.button == PointerEventData.InputButton.Right) { RightClicked?.Invoke(this); return; } if (pointer.button != PointerEventData.InputButton.Left) { return; } Clicked?.Invoke(this); if (Time.time - this.lastClickTime < 0.25f) { DoubleClicked?.Invoke(this); } this.lastClickTime = Time.time; }
public void DoubleClick(NSObject sender) { if (tableView.ClickedRow < items.Count) { DoubleClicked?.Invoke(items? [(int)tableView.ClickedRow]); } }
[GLib.ConnectBefore] // Otherwise this is handled internally, and we won't see it private void OnDoubleClick(object sender, ButtonPressEventArgs e) { if (e.Event.Type == Gdk.EventType.TwoButtonPress && e.Event.Button == 1 && DoubleClicked != null) { DoubleClicked.Invoke(this, e); } }
private void Update() { if (Input.touchCount == 0) { DirectionChanged?.Invoke(Vector2Int.up); return; } Touch directionTouch = Input.touches[0]; if (directionTouch.phase == TouchPhase.Began) { TouchData touchData = new TouchData(directionTouch.position, Time.time); _directionTouch = touchData; if (IsDoubleClicked(directionTouch)) { DoubleClicked?.Invoke(); } } else if (directionTouch.phase == TouchPhase.Stationary && Time.time - _directionTouch.Time > 0.1f) { int direction = (int)Mathf.Sign(_directionTouch.Position.x - Camera.main.pixelWidth / 2); DirectionChanged?.Invoke(Vector2Int.left * direction); } if (Input.touchCount > 1) { Touch lastTouch = Input.touches[Input.touchCount - 1]; if (IsDoubleClicked(lastTouch)) { DoubleClicked?.Invoke(); } } }
/// <summary>User has double clicked the list box.</summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDoubleClick(object sender, MouseEventArgs e) { if (DoubleClicked != null) { DoubleClicked.Invoke(this, e); } }
private void OnDoubleClick(object sender, ButtonPressEventArgs e) { try { if (e.Event.Type == Gdk.EventType.TwoButtonPress && e.Event.Button == 1 && DoubleClicked != null) { DoubleClicked.Invoke(sender, e); } if (e.Event.Button == 3) { TreePath path = Listview.GetPathAtPos((int)e.Event.X, (int)e.Event.Y); if (path != null) { Listview.SelectPath(path); if (popup.Children.Count() > 0) { popup.Popup(); } } e.RetVal = true; } } catch (Exception err) { ShowError(err); } }
public void OnPointerClick(PointerEventData pointer) { Clicked?.Invoke(this); if (Time.time - this.lastClickTime < 0.25f) { DoubleClicked?.Invoke(this); } this.lastClickTime = Time.time; }
protected async Task ClickHandler(MouseEventArgs e) { // https://stackoverflow.com/questions/5497073/how-to-differentiate-single-click-event-and-double-click-event // works good enough. Click is still called before the double click, but it is advise to not use both events anyway. if (e.Detail == 1) { await Clicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(e)); } else if (e.Detail == 2) { await DoubleClicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(e)); } }
//from IPointerDownHandler public void OnPointerDown(PointerEventData eventData) { Clicked?.Invoke(this, null); if (_doubleClickStarted && _doubleClickTimer < _doubleClickDelay) { DoubleClicked?.Invoke(this, null); } else { _doubleClickTimer = 0f; _doubleClickStarted = true; } }
/// <summary> /// Handles the row clicked event. /// </summary> /// <param name="eventArgs">Supplies information about a mouse event that is being raised.</param> /// <returns>A task that represents the asynchronous operation.</returns> protected Task OnClickHandler(MouseEventArgs eventArgs) { // https://stackoverflow.com/questions/5497073/how-to-differentiate-single-click-event-and-double-click-event // works good enough. Click is still called before the double click, but it is advise to not use both events anyway. // We'll be treating any Detail higher then 2 as the user constantly clicking, therefore triggering Single Click. if (eventArgs.Detail == 1 || eventArgs.Detail > 2) { return(Clicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(eventArgs))); } else if (eventArgs.Detail == 2) { return(DoubleClicked.InvokeAsync(EventArgsMapper.ToMouseEventArgs(eventArgs))); } return(Task.CompletedTask); }
public void OnPointerUp(PointerEventData pointer) { if (pointer.button != PointerEventData.InputButton.Left) { return; } Clicked?.Invoke(this); if (Time.time - this.lastClickTime < 0.25f) { DoubleClicked?.Invoke(this); return; } this.lastClickTime = Time.time; }
private void Update() { if (Input.GetKeyDown(KeyCode.LeftArrow)) { DirectionChanged?.Invoke(Vector2Int.right); } if (Input.GetKeyDown(KeyCode.RightArrow)) { DirectionChanged?.Invoke(Vector2Int.left); } if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) { DirectionChanged?.Invoke(Vector2Int.up); } if (Input.GetKeyDown(KeyCode.Space)) { DoubleClicked?.Invoke(); } }
/// <summary> /// A row in the tree view has been activated /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnRowActivated(object sender, RowActivatedArgs e) { try { timer.Stop(); if (treeview1.GetRowExpanded(e.Path)) { treeview1.CollapseRow(e.Path); } else { treeview1.ExpandRow(e.Path, false); } e.RetVal = true; DoubleClicked?.Invoke(this, new EventArgs()); } catch (Exception err) { ShowError(err); } }
// TODO: the following code need to be cleaned up. // TODO: rubberband selection behaves different than Gtk.IconView. This needs to be fixed. // TODO: selection by clicks behaves different than Gtk.IconView. This needs to be fixed. protected override bool OnButtonPressEvent(EventButton evnt) { int cell_num = CellAtPosition((int)evnt.X, (int)evnt.Y); start_select_event = evnt; selection_start = new Point((int)evnt.X, (int)evnt.Y); selection_modifier = evnt.State; isRectSelection = false; isDragDrop = false; switch (evnt.Type) { case EventType.TwoButtonPress: if (evnt.Button != 1 || (evnt.State & (ModifierType.ControlMask | ModifierType.ShiftMask)) != 0) { return(false); } DoubleClicked?.Invoke(this, new BrowsableEventArgs(cell_num, null)); return(true); case EventType.ButtonPress: GrabFocus(); // on a cell : context menu if button 3 // cell selection is done on button release if (evnt.Button == 3) { ContextMenu(evnt, cell_num); return(true); } return(false); } return(false); }
private void OnDoubleLeftClicked() { DoubleClicked?.Invoke(this, new ClickEventArgs(Mouse.Button.Left)); }
private void imageListView_ItemDoubleClick(object sender, ItemClickEventArgs e) { imageListView.ClearSelection(); e.Item.Selected = true; DoubleClicked?.Invoke(this, EventArgs.Empty); }
private void Initialize(IHostResourceProvider hostResources, object selectedValue) { this.selectedValue = selectedValue; Frame = new CGRect(10, 35, 630, 305); var FrameHeightHalf = (Frame.Height - 32) / 2; var FrameWidthHalf = (Frame.Width - 32) / 2; var FrameWidthThird = (Frame.Width - 32) / 3; this.progressIndicator = new NSProgressIndicator(new CGRect(FrameWidthThird, FrameHeightHalf, 32, 32)) { Hidden = true, Style = NSProgressIndicatorStyle.Spinning, TranslatesAutoresizingMaskIntoConstraints = false, }; AddSubview(this.progressIndicator); this.resourceTable = new FirstResponderTableView { AutoresizingMask = NSViewResizingMask.WidthSizable, HeaderView = null, }; this.dataSource = new ResourceTableDataSource(viewModel); var resourceTableDelegate = new ResourceTableDelegate(hostResources, dataSource); resourceTableDelegate.ResourceSelected += (sender, e) => { this.previewPanel.SelectedResource = SelectedResource; this.selectedValue = BrushPropertyViewModel.GetCommonBrushForResource(SelectedResource); ResourceSelected?.Invoke(this, EventArgs.Empty); }; this.resourceTable.Delegate = resourceTableDelegate; this.resourceTable.DataSource = dataSource; NSTableColumn resourceImages = new NSTableColumn(ResourceImageColId) { Title = Properties.Resources.ResourceTableImageColumnTitle, Width = 32 }; this.resourceTable.AddColumn(resourceImages); NSTableColumn resourceTypes = new NSTableColumn(ResourceTypeColId) { Title = Properties.Resources.ResourceTableTypeColumnTitle, Width = 150 }; this.resourceTable.AddColumn(resourceTypes); NSTableColumn resourceName = new NSTableColumn(ResourceNameColId) { Title = Properties.Resources.ResourceTableNameColumnTitle, Width = 150 }; resourceTable.AddColumn(resourceName); NSTableColumn resourceValue = new NSTableColumn(ResourceValueColId) { Title = Properties.Resources.ResourceTableValueColumnTitle, Width = 45 }; this.resourceTable.AddColumn(resourceValue); this.resourceTable.DoubleClick += (object sender, EventArgs e) => { DoubleClicked?.Invoke(this, EventArgs.Empty); }; // create a table view and a scroll view this.tableContainer = new NSScrollView(new CGRect(0, 0, resourceTable.TableColumns()[0].Width + resourceTable.TableColumns()[1].Width + resourceTable.TableColumns()[2].Width + 10, Frame.Height)) { TranslatesAutoresizingMaskIntoConstraints = false, }; this.tableContainer.DocumentView = resourceTable; AddSubview(this.tableContainer); this.previewPanel = new RequestResourcePreviewPanel(hostResources, new CGRect(Frame.Width - FrameWidthThird, 0, FrameWidthThird, Frame.Height)); AddSubview(this.previewPanel); this.AddConstraints(new[] { NSLayoutConstraint.Create(this.tableContainer, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, -190f), NSLayoutConstraint.Create(this.tableContainer, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, 0f), }); ReloadData(); }
public override void OnDoubleClick() { DoubleClicked?.Invoke(this); }
protected override bool HandleDoubleClick(int x, int y, Event.Button button) { DoubleClicked?.Invoke(this, new ClickEventArgs(x - TotalX, y - TotalY)); return(true); }
public virtual void OnDoubleClicked() { DoubleClicked?.Invoke(this); }
public void SendDoubleClicked(Coordinate pos) { DoubleClicked?.Invoke(this, new MapDoubleClickedEventArgs(pos)); }