void Advance(bool forward) { Gtk.TreePath path = new Gtk.TreePath(); if (this.ImageThumbView.SelectedItems.Length > 0) { if (this.imageView.AdvanceSubImage(forward)) { return; } if (forward) { foreach (var selPath in this.ImageThumbView.SelectedItems) { if (path.Depth == 0 || path.Compare(selPath) < 0) { path = selPath; } } } else { foreach (var selPath in this.ImageThumbView.SelectedItems) { if (path.Depth == 0 || path.Compare(selPath) > 0) { path = selPath; } } } } path = this.GetNextPath(path, forward); this.ImageThumbView.UnselectAll(); this.SelectImagePath(path); }
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); }