コード例 #1
0
        public Menu(Menu parentMenu, string header, string folderPath, bool isRootMenu, bool includeFilesFromRoot, bool includeFiles, bool navigateToEmptyFolder, string parentFolderNameAsFirstItem, bool addBracesToFolderNames, MenuItemChosenDelegate menuItemChosenDelegate)
        {
            this.header                 = header;
            this.parentMenu             = parentMenu;
            this.menuItemChosenDelegate = menuItemChosenDelegate;
            this.items = new MenuItems();
            if (!isRootMenu && !string.IsNullOrEmpty(parentFolderNameAsFirstItem))
            {
                MenuItem parentFolderAsFirstItem = new MenuItem(parentFolderNameAsFirstItem, this);
                parentFolderAsFirstItem.tag = folderPath;
                this.items.Add(parentFolderAsFirstItem);
            }
            foreach (string subFolderPath in CraftSynth.BuildingBlocks.IO.FileSystem.GetFolderPaths(folderPath))
            {
                MenuItem menuItem = new MenuItem();

                string subMenuName = Path.GetFileName(subFolderPath);

                Menu subMenu = new Menu(this, subMenuName, subFolderPath, false, includeFilesFromRoot, includeFiles, navigateToEmptyFolder, parentFolderNameAsFirstItem, addBracesToFolderNames, menuItemChosenDelegate);
                if (addBracesToFolderNames)
                {
                    subMenuName = string.Format("[ {0} ]", subMenuName);
                }

                menuItem.text         = subMenuName;
                menuItem.haveChildren = subMenu.items != null && subMenu.items.Count > 0;
                if (subMenu.items.Count > 0)
                {
                    menuItem.value = subMenu;
                }
                else
                {
                    if (navigateToEmptyFolder)
                    {
                        menuItem.value = subMenu;
                    }
                    else
                    {
                        menuItem.value = subFolderPath;
                    }
                }
                menuItem.tag = subFolderPath;

                this.items.Add(menuItem);
            }
            if ((includeFiles && !isRootMenu) ||
                (includeFiles && isRootMenu && includeFilesFromRoot))
            {
                foreach (string filePath in CraftSynth.BuildingBlocks.IO.FileSystem.GetFilePaths(folderPath))
                {
                    MenuItem menuItem = new MenuItem();

                    menuItem.text         = Path.GetFileName(filePath);
                    menuItem.haveChildren = false;
                    menuItem.value        = filePath;
                    menuItem.tag          = filePath;

                    this.items.Add(menuItem);
                }
            }
        }
コード例 #2
0
 public static void ChangePage(Menu parentMenu, string header, MenuItems menuItems, int?selectedIndex, MenuItemChosenDelegate menuItemChosenDelegate)
 {
     Menu.ChangePage(parentMenu, header, menuItems, selectedIndex, CraftSynth.BuildingBlocks.UI.WindowsForms.Slider.SlideType.SlideToLeft, menuItemChosenDelegate);
 }
コード例 #3
0
 public static void ChangePage(string header, MenuItems menuItems, int?selectedIndex, CraftSynth.BuildingBlocks.UI.WindowsForms.Slider.SlideType slideType, MenuItemChosenDelegate menuItemChosenDelegate)
 {
     Menu.ChangePage(null, header, menuItems, selectedIndex, slideType, menuItemChosenDelegate);
 }
コード例 #4
0
 public static void ChangePage(string header, MenuItems menuItems, CraftSynth.BuildingBlocks.UI.WindowsForms.Slider.SlideType slideType)
 {
     Menu.ChangePage(header, menuItems, slideType, null);
 }
コード例 #5
0
 public static void ChangePage(string header, MenuItems menuItems, int?selectedIndex)
 {
     Menu.ChangePage(header, menuItems, selectedIndex, null);
 }
コード例 #6
0
 public static void ChangePage(string header, MenuItems menuItems)
 {
     Menu.ChangePage(header, menuItems, null, null);
 }
コード例 #7
0
 public static void ChangePage(string header, MenuItems menuItems, MenuItemChosenDelegate menuItemChosenDelegate)
 {
     Menu.ChangePage(null, header, menuItems, null, CraftSynth.BuildingBlocks.UI.WindowsForms.Slider.SlideType.SlideToLeft, menuItemChosenDelegate);
 }
コード例 #8
0
 public static MenuItem ShowMenu(Menu parentMenu, string header, MenuItems menuItems, int?selectedIndex, MenuItemChosenDelegate menuItemChosenDelegate)
 {
     return(ShowMenu(null, parentMenu, header, menuItems, selectedIndex, menuItemChosenDelegate));
 }
コード例 #9
0
        public static MenuItem ShowMenu(Form ownerForm, Menu parentMenu, string header, MenuItems menuItems, int?selectedIndex, MenuItemChosenDelegate menuItemChosenDelegate)
        {
            OSD.InitializeIfNeeded();

            OSD.menu = new Menu();
            OSD.menu.Init(parentMenu, OSD.formMain, header, menuItems, selectedIndex, menuItemChosenDelegate);
            OSD.formMain.pnlContent.Tag  = true;
            OSD.formMain.pnlContent2.Tag = false;

            OSD.formMain.Text     = "OSD";
            OSD.formMain.TopLevel = true;
            OSD.formMain.TopMost  = true;
            OSD.formMain.Owner    = ownerForm;
            OSD.formDisplayer.ShowForm(OSD.formMain);
            OSD.formMain.ShowDialog();
            return(OSD.menu.SelectedItem);
        }
コード例 #10
0
 public static MenuItem ShowMenu(string header, MenuItems menuItems, int?selectedIndex)
 {
     return(ShowMenu(header, menuItems, selectedIndex, null));
 }
コード例 #11
0
 public static MenuItem ShowMenu(Menu parentMenu, string header, MenuItems menuItems, MenuItemChosenDelegate menuItemChosenDelegate)
 {
     return(ShowMenu(null, parentMenu, header, menuItems, null, menuItemChosenDelegate));
 }
コード例 #12
0
 public static MenuItem ShowMenu(string header, MenuItems menuItems)
 {
     return(ShowMenu(header, menuItems, null, null));
 }
コード例 #13
0
 public Menu(Menu parentMenu, string header, MenuItems menuItems) : this(parentMenu, header, menuItems, null)
 {
 }
コード例 #14
0
 public Menu(string header, MenuItems menuItems) : this(null, header, menuItems, null)
 {
 }