protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { bool res = base.OnButtonReleaseEvent(evnt); if (DoPopupMenu != null && evnt.IsContextMenuButton()) { return(true); } return(res); }
protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { this.Selection.SelectFunction = (s, m, p, b) => { return(true); }; Gtk.TreePath buttonReleasePath; //If OnButtonPressEvent attempted on making deselection and dragging was not started //check if we are on same item as when we clicked(could be different if dragging is disabled) if (selectOnRelease && GetPathAtPos((int)evnt.X, (int)evnt.Y, out buttonReleasePath) && buttonPressPath.Compare(buttonReleasePath) == 0) { //Simulate what would happen in OnButtonPressEvent if we were not blocking selection //notice that item is currently 100% selected since this check was performed in OnButtonPressEvent if (Selection.Mode == Gtk.SelectionMode.Multiple && (evnt.State & Gdk.ModifierType.ControlMask) > 0) { Selection.UnselectPath(buttonReleasePath); } else { //UnselectAll in case multiple were selected we want only our item to be selected now //if it was clicked but not dragged Selection.UnselectAll(); Selection.SelectPath(buttonReleasePath); } buttonPressPath = null; } selectOnRelease = false; bool res = base.OnButtonReleaseEvent(evnt); if (DoPopupMenu != null && evnt.IsContextMenuButton()) { return(true); } return(res); }