コード例 #1
0
 void fileTree_NodeMouseReleased(object sender, TreeMouseEventArgs e)
 {
     if (e.Button == MouseButtonCode.MB_BUTTON1)
     {
         lastMouseEventPos     = e.MousePosition;
         fileTree.SelectedNode = e.Node;
         DirectoryNode dirNode = e.Node as DirectoryNode;
         if (dirNode != null)
         {
             if (NodeContextEvent != null)
             {
                 NodeContextEvent.Invoke(this, dirNode.DirectoryPath, true, dirNode.Parent == null);
             }
         }
         else
         {
             FileNode fileNode = e.Node as FileNode;
             if (fileNode != null)
             {
                 if (NodeContextEvent != null)
                 {
                     NodeContextEvent.Invoke(this, fileNode.FilePath, false, fileNode.Parent == null);
                 }
             }
         }
     }
 }
コード例 #2
0
 void tree_NodeMouseReleased(object sender, TreeMouseEventArgs e)
 {
     if (e.Button == MouseButtonCode.MB_BUTTON1)
     {
         EditInterfaceTreeNode node = e.Node as EditInterfaceTreeNode;
         tree.SelectedNode    = e.Node;
         currentMenuInterface = node.EditInterface;
         if (currentMenuInterface.hasCommands())
         {
             PopupMenu menu = Gui.Instance.createWidgetT("PopupMenu", "PopupMenu", 0, 0, 1000, 1000, Align.Default, "Overlapped", "") as PopupMenu;
             menu.ItemAccept += new MyGUIEvent(menu_ItemAccept);
             menu.Closed     += new MyGUIEvent(menu_Closed);
             menu.Visible     = false;
             foreach (EditInterfaceCommand command in currentMenuInterface.getCommands())
             {
                 MenuItem item = menu.addItem(command.Name);
                 item.UserObject = command;
             }
             LayerManager.Instance.upLayerItem(menu);
             menu.setPosition(e.MousePosition.x, e.MousePosition.y);
             menu.ensureVisible();
             menu.setVisibleSmooth(true);
         }
     }
 }