private void TreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode Node = e.Node; if (e.Button == System.Windows.Forms.MouseButtons.Right) { TreeView.SelectedNode = e.Node; FolderContextMenu.Tag = e.Node; FolderContextMenu.Show(TreeView.PointToScreen(e.Location)); } else if (e.X >= e.Node.Bounds.Left - 32 && e.X < e.Node.Bounds.Left - 16) { TreeNodeData NodeData = (TreeNodeData)Node.Tag; SetSelected(Node, (NodeData.NumSelectedFiles == 0)? SelectionType.All : SelectionType.None); } }
// when a user has clicked on the folder tree private void tree_button_release(object o, ButtonReleaseEventArgs args) { if (args.Event.Button != 3) return; TreeIter iter; if (!this.Selection.GetSelected (out iter)) return; Folder folder = (Folder) store.GetValue (iter, 0); if (folder.Path == Utils.RootNode) return; FolderContextMenu menu = new FolderContextMenu (folder); menu.ShowAll (); menu.Popup (); }