コード例 #1
0
        private void OnResourceRightClicked(Base item, ClickedEventArgs args)
        {
            Resource ClickedResource = (Resource)(((ResourceNode)item).Resource);

            Menu RightClickMenu = new Menu(Parent);
            {
                if (ClickedResource is Folder) {
                    Folder FolderResource = ClickedResource as Folder;
                    MenuItem Add = RightClickMenu.AddItem("Add");
                    {
                        MenuItem submenu = Add.Menu.AddItem("Folder");
                        {
                            submenu.SetImage(@"Data\folder.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                Folder res = new Folder();
                                res.Name = "New Folder";
                                FolderResource.Add(res);
                                new AddFolder(res, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Texture");
                        {
                            submenu.SetImage(@"Data\texture.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                FSTexture tex = new FSTexture();
                                tex.Name = "NewTexture.png";
                                tex.Load(new Bitmap(16, 16));
                                FolderResource.Add(tex);
                                new AddTexture(tex, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Block Type");
                        {
                            submenu.SetImage(@"Data\blocktype.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                BlockType bt = new BlockType();
                                bt.Name = "NewBlock.block";
                                FolderResource.Add(bt);
                                new AddBlockType(bt, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Code File");
                        {
                            submenu.SetImage(@"Data\SharedCode.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                CodeFile cf = new CodeFile();
                                cf.Name = "NewClass.cs";
                                FolderResource.Add(cf);
                                new AddCode(cf, ClickedResource.ID).Send();
                            };
                        }
                    }
                }

                MenuItem Rename = RightClickMenu.AddItem("Rename");
                Rename.Clicked += delegate(Base sender, ClickedEventArgs renameargs) {
                    ((ResourceNode)item).StartRename();
                };
            }

            Point LocalPos = Parent.CanvasPosToLocal(new Point(args.X, args.Y));
            RightClickMenu.SetPosition(LocalPos.X - 6, LocalPos.Y - 28); //Subtracting bounds of inner panel
            RightClickMenu.Show();
        }
コード例 #2
0
ファイル: AddFolder.cs プロジェクト: CloneDeath/FantasyScape
 public AddFolder(Folder folder, Guid parent)
 {
     this.folder = folder;
     this.parent = parent;
 }
コード例 #3
0
 public UpdateFolder(Folder folder)
 {
     this.folder = folder;
 }
コード例 #4
0
ファイル: AddFolder.cs プロジェクト: CloneDeath/FantasyScape
 public AddFolder()
 {
     folder = new Folder();
 }
コード例 #5
0
 public UpdateFolder()
 {
     folder = new Folder();
 }