protected virtual void OnRemoved(MenuContainer container, ToolStripItem itm)
 {
     if (Removed != null)
     {
         Removed(this, new MenuEvent(itm, -1, container));
     }
 }
Ejemplo n.º 2
0
        public VoxelPatternEditor(MenuContainer Container, RenderManager RenderManager, InputManager inputManager)
        {
            Input        = inputManager;
            GUIContainer = Container;

            Load       = (FileLoaderButton)GUIContainer.ButtonList["Load"];
            SaveLookup = (SaveFileButton)GUIContainer.ButtonList["SaveLookup"];
            Save       = (ToggleButton)GUIContainer.ButtonList["Save"];
            New        = (ToggleButton)GUIContainer.ButtonList["New"];

            WallSizeXDisplay = (TextButton)GUIContainer.ButtonList["WallSizeXDisplay"];
            WallSizeYDisplay = (TextButton)GUIContainer.ButtonList["WallSizeYDisplay"];

            WallSizeX = (TextButton)GUIContainer.ButtonList["WallSizeX"];
            WallSizeY = (TextButton)GUIContainer.ButtonList["WallSizeY"];

            VoxelDisplay = (ToggleButton)GUIContainer.ButtonList["VoxelDisplay"];
            VoxelDisplay.SetGeometryTexture("Missing", "Missing");

            VoxelDisplayBackground = (ToggleButton)GUIContainer.ButtonList["VoxelDisplayBackground"];;
            VoxelDisplayBackground.SetGeometryTexture("MenuBackground", "MenuBackground");
            MaterialSelector = (TileSelectorButton)GUIContainer.ButtonList["MaterialSelector"];

            Render  = RenderManager;
            GUINode = Render.GuiNode;

            TextureLookup = new Bitmap("GFX/Structure.png");
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            MenuContainer container;
            Menu          mainMenu   = new Menu("Main menu");
            Menu          subMenu    = new Menu("Sub menu");
            Menu          subSubMenu = new Menu("sub sub Menu");

            IStep turnOnStep  = new StepContainer(TurnOn, "Turning On", "Error turning on", "Turned on sucesfully");
            IStep turnOffStep = new StepContainer(TurnOff, "Turning Off", "Error turning off");

            subSubMenu.AddItem(new ItemWithCheckBoxStep("Turned on", false, "Device", new CheckBoxStep(turnOnStep, turnOffStep), OnTurnOnChanged));
            subSubMenu.AddItem(new MonoBrickQuestion());
            subSubMenu.AddItem(new ItemWithBrickInfo());

            subMenu.AddItem(subSubMenu);
            subMenu.AddItem(new ItemWithCharacterInput("Name", "Enter Name", "Anders", OnNameChanged, false, true, true));
            subMenu.AddItem(new ItemWithNumericInput("Age", 29, OnAgeChanged, 0, 100));
            subMenu.AddItem(new ItemWithCheckBox("Loves C#", true, OnCheckedChanged));

            mainMenu.AddItem(subMenu);
            mainMenu.AddItem(new ItemWithProgramList("Programs"));

            container = new MenuContainer(mainMenu);
            container.Show(true);
        }
Ejemplo n.º 4
0
        public void HookProcessSwitch(On.ProcessManager.orig_SwitchMainProcess orig, ProcessManager instance, ProcessManager.ProcessID id)
        {
            if (instance.currentMainLoop != null)
            {
                if (instance.currentMainLoop.ID == ProcessManager.ProcessID.Game)
                {
                    Debug.Log("Switching off of game");

                    if (playerObject != null)
                    {
                        playerObject.Destroy();
                    }
                }
            }

            orig(instance, id);

            if (id == ProcessManager.ProcessID.SlugcatSelect)
            {
                currentMenu = (instance.currentMainLoop as SlugcatSelectMenu);
                newCharacterMenuContainer = new MenuContainer(currentMenu, currentMenu.pages[0], Vector2.zero);
                CreateMenu();
                currentMenu.pages[0].subObjects.Add(newCharacterMenuContainer);
                newCharacterMenuContainer.menu = currentMenu;
                UpdateMenu();
            }
            else if (isMenuInitialized)
            {
                DestroyMenu();
            }
        }
Ejemplo n.º 5
0
    /// <summary>
    /// Removes the current menu, deactivates and destroys it.
    /// </summary>
    private void RemoveAndDestroyCurrentMenu()
    {
        MenuContainer menuContainer = MenuData.Pop();

        menuContainer.Script.Deactivate();
        Destroy(menuContainer.TheGameObject);
    }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            settings = new EmailSettings();
            settings.Load();
            Menu settingMenu = new Menu("Settings");

            settingMenu.AddItem(new ItemWithCharacterInput("User Name", "User Name", settings.UserSettings.User, OnUserChanged, false, true, false));
            settingMenu.AddItem(new ItemWithCharacterInput("SMTP", "SMTP Server", settings.UserSettings.Smtp, OnSMTPChanged, false, true, false));
            settingMenu.AddItem(new ItemWithCharacterInput("Password", "SMTP Password", settings.UserSettings.Password, OnPasswordChanged, true, true, false));
            settingMenu.AddItem(new ItemWithNumericInput("Port Number", settings.UserSettings.Port, OnPortNmberChanged, 1, 49151));
            settingMenu.AddItem(new ItemWithCheckBox("Enable SSL", settings.UserSettings.EnableSsl, OnEnableSslChanged));

            Menu menu = new Menu("E-Mail Client");

            menu.AddItem(settingMenu);
            menu.AddItem(new ItemWithCharacterInput("To", "To", emailTo, (emailAddress) => emailTo         = emailAddress, false, true, false));
            menu.AddItem(new ItemWithCharacterInput("Subject", "Subject", subject, (newSubject) => subject = newSubject, false, true, false));
            menu.AddItem(new ItemWithCharacterInput("Message", "Message", "", (newMessage) => message      = newMessage));
            menu.AddItem(new ItemWithDialog <StepDialog>(new StepDialog("Sending mail ", new List <IStep> {
                SendStep
            }), "Send mail"));
            MenuContainer container = new MenuContainer(menu);

            container.Show(true);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 创建菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            string        userName = lbPublicAccount.SelectedValue;
            MenuContainer mc1      = MenuHelper.CreateContainer("文档规范");

            //mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.click, "关于", "about"));
            mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "取样标准", "http://kefeng.35shop.net:81/single20140317022338/single20140319022642/"));
            mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "行业动向", "http://kefeng.35shop.net:81/news20140310034010/"));
            //    mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.location_select, "方位", "location"));
            //mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "网页授权", OAuthAccessToken.GetOAuthUrl(userName, "http://www.xrwang.net/OAuth.aspx", OAuthScopeEnum.snsapi_userinfo, "oauth")));
            MenuContainer mc2 = MenuHelper.CreateContainer("注册登录");

            mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "个人登录", "http://kefengjiance.com/"));
            mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "企业登录", "http://kefengjiance.com/"));
            //mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.scancode_push, "个人登录", "push"));
            // mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.scancode_waitmsg, "接收扫码", "waitmsg"));
            MenuContainer mc3 = MenuHelper.CreateContainer("关于");

            mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "公司简介", "http://kefengjiance.com/"));
            mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "资质证书", "http://kefeng.35shop.net:81/single20140317022338/single20140319022612/"));
            mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "科室简介", "http://kefeng.35shop.net:81/single20140317020831/single20140317020948/"));
            //mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.pic_photo_or_album, "拍照或相册发图", "photo_or_album"));
            //mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.pic_weixin, "微信发图", "weixin"));
            ErrorMessage errorMessage = MenuHelper.Create(userName, new BaseMenu[] { mc1, mc2, mc3 });

            ltrMessage.Text = string.Format("创建菜单{0}。{1}", errorMessage.IsSuccess ? "成功" : "失败", errorMessage.IsSuccess ? "" : errorMessage.ToString());
        }
        protected virtual ToolStripItemCollection GetMenuCollection(MenuContainer at)
        {
            switch (at)
            {
            case MenuContainer.Base:
                return(mainMenu.Items);

            case MenuContainer.File:
                return(fileToolStripMenuItem.DropDownItems);

            case MenuContainer.Edit:
                return(editToolStripMenuItem.DropDownItems);

            case MenuContainer.View:
                return(viewToolStripMenuItem.DropDownItems);

            case MenuContainer.Analyzer:
                return(analyzeToolStripMenuItem.DropDownItems);

            case MenuContainer.FolderContext:
                return(folderContextMenu.Items);

            case MenuContainer.FileContext:
                return(fileContextMenu.Items);

            default:
                return(null);
            }
        }
Ejemplo n.º 9
0
    /// <summary>
    /// 创建菜单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        string        userName = lbPublicAccount.SelectedValue;
        MenuContainer mc1      = MenuHelper.CreateContainer("自在饭");

        mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.click, "关于", "about"));
        mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "官网", "http://www.zizaifan.com"));
        mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.location_select, "方位", "location"));
        mc1.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "网页授权", OAuthAccessToken.GetOAuthUrl(userName, "http://www.zizaifan.com/OAuth.aspx", OAuthScopeEnum.snsapi_userinfo, "oauth")));
        MenuContainer mc2 = MenuHelper.CreateContainer("扫描");

        mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.scancode_push, "扫码推", "push"));
        mc2.Add(MenuHelper.CreateItem(MenuTypeEnum.scancode_waitmsg, "接收扫码", "waitmsg"));
        MenuContainer mc3 = MenuHelper.CreateContainer("发图");

        mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.pic_sysphoto, "拍照发图", "sysphoto"));
        mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.pic_photo_or_album, "拍照或相册发图", "photo_or_album"));
        mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.pic_weixin, "微信发图", "weixin"));
        mc3.Add(MenuHelper.CreateItem(MenuTypeEnum.view, "JS-SDK", "http://www.zizaifan.com/wechat.aspx"));
        ErrorMessage errorMessage = MenuHelper.Create(userName, new BaseMenu[] { mc1, mc2, mc3 });

        ltrMessage.Text = string.Format("创建菜单{0}。{1}",
                                        errorMessage.IsSuccess ? "成功" : "失败",
                                        errorMessage.IsSuccess ? "" : errorMessage.ToString());
    }
 protected virtual void OnAdded(MenuContainer container, ToolStripItem itm, int index)
 {
     if (Added != null)
     {
         Added(this, new MenuEvent(itm, index, container));
     }
 }
Ejemplo n.º 11
0
 public MediaMenu()
 {
     InitializeComponent();
     MenuContainer.SetBinding(DataContextProperty, new Binding("Menu")
     {
         Source = this
     });
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Returns the menu-script of the current active menu.
 /// If currently there's no menu active then it'll return null.
 /// </summary>
 public MenuBase GetCurrentMenuScript()
 {
     if (MenuData.Count > 0)
     {
         MenuContainer currentMenu = MenuData.Peek();
         return(currentMenu.Script);
     }
     return(null);
 }
        public ToolStripItem Find(MenuContainer at, string name)
        {
            if (!_items.ContainsKey(at))
            {
                return(null);
            }

            return(_items[at].FirstOrDefault(x => x.Name == name));
        }
Ejemplo n.º 14
0
        public IMenuContainer ToContainer()
        {
            var container = new MenuContainer()
            {
                Name = _name
            };

            _menuContainer.Add(container);
            return(container);
        }
Ejemplo n.º 15
0
        public virtual bool PostEvent(Event evt)
        {
            MenuContainer parent = this.Parent_Renamed;

            if (parent != null)
            {
                parent.PostEvent(evt);
            }
            return(false);
        }
        public void Insert(MenuContainer container, ToolStripItem itm, int at)
        {
            if (!_items.ContainsKey(container))
            {
                _items.Add(container, new List <ToolStripItem>());
            }

            _items[container].Add(itm);

            OnAdded(container, itm, at);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Creates the guest menu container.
        /// </summary>
        /// <returns>MenuContainer.</returns>
        private static MenuContainer CreateGuestMenuContainer()
        {
            var res = new MenuContainer();

            {
                res.AddPart(new MonitorCloudMenuButton());
                res.AddPart(new LearnMoreMenuButton());
                res.AddPart(new BrowseWebMenuButton());
            }
            return(res);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Gets the menu.
        /// </summary>
        /// <param name="userRoles">The user roles.</param>
        /// <param name="userCulture">The user culture.</param>
        /// <returns>MenuContainer.</returns>
        public MenuContainer GetMenu(RoleContainer userRoles, string userCulture)
        {
            var res = new MenuContainer();

            foreach (var roleMenuLink in RoleMenus
                     .Where(x => userRoles.ContainsRole(x.Role)))
            {
                res.AddMenuButton(roleMenuLink.Button);
            }
            return(res);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Creates the master menu container.
        /// </summary>
        /// <returns>MenuContainer.</returns>
        private static MenuContainer CreateMasterMenuContainer()
        {
            var res = new MenuContainer();

            {
                res.AddPart(new ManageCloudSpaceMenuButton());
                res.AddPart(new MonitorCloudMenuButton());
                res.AddPart(new LearnMoreMenuButton());
            }
            return(res);
        }
Ejemplo n.º 20
0
Archivo: Bar.cs Proyecto: ikvm/Kooboo
        public List <MenuItem> SiteMenu(ApiCall call)
        {
            var user = call.Context.User;

            if (call.WebSite == null)
            {
                return(new List <MenuItem>());
            }

            List <MenuItem> menus = new List <MenuItem>();

            menus.Add(new MenuItem
            {
                Name  = Hardcoded.GetValue("Feature", call.Context),
                Items = SiteMenu_Feature(call)
            });

            menus.Add(new MenuItem
            {
                Name  = Hardcoded.GetValue("Advance", call.Context),
                Items = SiteMenu_Advance(call)
            });

            // additional menu for the extension.
            var sitemenus = MenuContainer.SubMenus(typeof(ISideBarMenu));
            var oldmenues = sitemenus.Select(o => MenuHelper.ConvertToOld(o, call.Context)).ToList();

            if (oldmenues != null && oldmenues.Any())
            {
                menus.AddRange(oldmenues);
            }

            if (user.IsAdmin)
            {
                return(menus);
            }
            else
            {
                var sitedb   = call.Context.WebSite.SiteDb();
                var siteuser = sitedb.SiteUser.Get(call.Context.User.Id);

                if (siteuser == null)
                {
                    return(null);
                }
                else
                {
                    CheckRights(menus, siteuser.Role);

                    return(menus);
                }
            }
        }
        public void Remove(MenuContainer container, ToolStripItem itm)
        {
            if (!_items.ContainsKey(container))
            {
                return;
            }
            List <ToolStripItem> list = _items[container];

            list.Remove(itm);

            OnRemoved(container, itm);
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            Menu menu = new Menu("SNATCH3R");

            container = new MenuContainer(menu);

            menu.AddItem(new MainMenuItem("Command with IR", CommandWithIR_OnEnterPressed));
            menu.AddItem(new MainMenuItem("Line following", LineFollowing_OnEnterPressed));
            menu.AddItem(new MainMenuItem("Garbage collection", GarbageCollection_OnEnterPressed));
            menu.AddItem(new MainMenuItem("Quit", Quit_OnEnterPressed));

            container.Show();
        }
Ejemplo n.º 23
0
    // == CLASS CONSTRUCTOR(S)
    // ======================================================================================

    // == CLASS METHODS
    // ======================================================================================

    void Start()
    {
        Application.targetFrameRate = 60;

        // == INITIALIZING VALUES: STATES

        _currentMenuState      = EnumMenuState.MENUSTATE_MAIN_ENTER_FLASH_IN;
        _optionSelected        = EnumMenuOptionSelected.MENUCONTAINER_MAIN_OPT_NONE;
        _creditsOptionSelected = EnumMenuCreditsOptionSelected.MENUCONTAINER_CREDITS_OPT_NONE;

        // == INITIALIZING VALUES: SOUND AND MUSIC
        audSrcMusic      = GameObject.Find("audSrcMusic").GetComponent <AudioSource>();
        audSrcMusic.loop = true;

        audSrcCameraShot = GameObject.Find("audSrcCameraShot").GetComponent <AudioSource>();

        // == INITIALIZING VALUES: SPRITES

        sprFlash  = GameObject.Find("sprFlash");
        sprShadow = GameObject.Find("sprShadow");

        sprFilm1 = GameObject.Find("sprFilm1");
        sprFilm1.GetComponent <SpriteRenderer>().enabled = false;

        sprFilm2 = GameObject.Find("sprFilm2");
        sprFilm2.GetComponent <SpriteRenderer>().enabled = false;

        sprGameLogo = GameObject.Find("sprGameLogo");
        sprGameLogo.GetComponent <SpriteRenderer>().enabled = false;

        sprSep = GameObject.Find("sprSep");
        sprSep.GetComponent <SpriteRenderer>().enabled = false;

        // == INITIALIAZING VALUES: CONTAINERS

        mnuContainerMain = new MenuContainerMain(this);
        mnuContainerMain.Start();

        mnuContainerCredits = new MenuContainerCredits(this);
        mnuContainerCredits.Start();

        mnuActiveContainer = mnuContainerMain;

        // == INITIALIAZING VALUES: UI

        // == INITIALIZING VALUES

        cameraBounds        = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, Camera.main.pixelHeight, 0));
        filmAnimationInvert = false;
    }
Ejemplo n.º 24
0
 //Menu visibility toggle
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (MenuContainer.Opacity == 1)
     {
         ToggleImage.Icon = FontAwesome.WPF.FontAwesomeIcon.ToggleOff;
         ToggleBT.ToolTip = "Mostrar menú";
         MenuContainer.BeginStoryboard((Storyboard)Application.Current.TryFindResource("LateralOut"));
     }
     else
     {
         ToggleImage.Icon = FontAwesome.WPF.FontAwesomeIcon.ToggleOn;
         ToggleBT.ToolTip = "Ocultar menú";
         MenuContainer.BeginStoryboard((Storyboard)Application.Current.TryFindResource("LateralIn"));
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Shows the popup menu at the x, y position relative to an origin
        /// component.
        /// The origin component must be contained within the component
        /// hierarchy of the popup menu's parent.  Both the origin and the parent
        /// must be showing on the screen for this method to be valid.
        /// <para>
        /// If this <code>PopupMenu</code> is being used as a <code>Menu</code>
        /// (i.e., it has a non-<code>Component</code> parent),
        /// then you cannot call this method on the <code>PopupMenu</code>.
        ///
        /// </para>
        /// </summary>
        /// <param name="origin"> the component which defines the coordinate space </param>
        /// <param name="x"> the x coordinate position to popup the menu </param>
        /// <param name="y"> the y coordinate position to popup the menu </param>
        /// <exception cref="NullPointerException">  if the parent is <code>null</code> </exception>
        /// <exception cref="IllegalArgumentException">  if this <code>PopupMenu</code>
        ///                has a non-<code>Component</code> parent </exception>
        /// <exception cref="IllegalArgumentException"> if the origin is not in the
        ///                parent's hierarchy </exception>
        /// <exception cref="RuntimeException"> if the parent is not showing on screen </exception>
        public virtual void Show(Component origin, int x, int y)
        {
            // Use localParent for thread safety.
            MenuContainer localParent = Parent_Renamed;

            if (localParent == null)
            {
                throw new NullPointerException("parent is null");
            }
            if (!(localParent is Component))
            {
                throw new IllegalArgumentException("PopupMenus with non-Component parents cannot be shown");
            }
            Component compParent = (Component)localParent;

            //Fixed 6278745: Incorrect exception throwing in PopupMenu.show() method
            //Exception was not thrown if compParent was not equal to origin and
            //was not Container
            if (compParent != origin)
            {
                if (compParent is Container)
                {
                    if (!((Container)compParent).IsAncestorOf(origin))
                    {
                        throw new IllegalArgumentException("origin not in parent's hierarchy");
                    }
                }
                else
                {
                    throw new IllegalArgumentException("origin not in parent's hierarchy");
                }
            }
            if (compParent.Peer == null || !compParent.Showing)
            {
                throw new RuntimeException("parent not showing on screen");
            }
            if (Peer_Renamed == null)
            {
                AddNotify();
            }
            lock (TreeLock)
            {
                if (Peer_Renamed != null)
                {
                    ((PopupMenuPeer)Peer_Renamed).Show(new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
                }
            }
        }
Ejemplo n.º 26
0
        public IMenuContainer Load(string menuName)
        {
            var menuContainer = new MenuContainer();

            var configRaw = File.ReadAllText($"Menus\\{menuName}.json");
            var config    = JsonConvert.DeserializeObject <JsonMenuConfiguration>(configRaw);

            foreach (var menuItemEntry in config.MenuItems)
            {
                var    title      = menuItemEntry.Title;
                Action menuAction = null;

                foreach (var actionEntry in menuItemEntry.Actions)
                {
                    var actionType    = actionEntry.Type;
                    var actionOptions = actionEntry.Options;
                    var action        = this.actionResolver.Resolve(actionType, actionOptions);

                    if (action == null)
                    {
                        //TODO error handling
                        continue;
                    }

                    if (actionOptions.CloseAfter)
                    {
                        action += this.CloseAction;
                    }

                    if (menuAction == null)
                    {
                        menuAction = action;
                    }
                    else
                    {
                        menuAction += action;
                    }
                }

                menuContainer.MenuItems.Add(new MenuItem
                {
                    Title  = title,
                    Action = new MenuAction(menuAction)
                });
            }

            return(menuContainer);
        }
 /// <summary>
 /// Called every time after the Panel is hidden
 /// </summary>
 /// <param name="animated">If set to <c>true</c> animated.</param>
 public override void ViewDidDisappear(bool animated)
 {
     if (MenuContainer != null)
     {
         MenuContainer.ViewDidDisappear(animated);
     }
     if (SubMenuContainer != null)
     {
         SubMenuContainer.ViewWillAppear(animated);
     }
     if (DetailContainer != null)
     {
         DetailContainer.ViewWillAppear(animated);
     }
     base.ViewDidDisappear(animated);
 }
 /// <summary>
 /// Called when the view will rotate.
 /// This override forwards the WillRotate callback on to each of the panel containers
 /// </summary>
 /// <param name="toInterfaceOrientation">To interface orientation.</param>
 /// <param name="duration">Duration.</param>
 public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     base.WillRotate(toInterfaceOrientation, duration);
     if (MenuContainer != null)
     {
         MenuContainer.WillRotate(toInterfaceOrientation, duration);
     }
     if (SubMenuContainer != null)
     {
         SubMenuContainer.WillRotate(toInterfaceOrientation, duration);
     }
     if (DetailContainer != null)
     {
         DetailContainer.WillRotate(toInterfaceOrientation, duration);
     }
 }
 /// <summary>
 /// Called after the view rotated
 /// This override forwards the DidRotate callback on to each of the panel containers
 /// </summary>
 /// <param name="fromInterfaceOrientation">From interface orientation.</param>
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate(fromInterfaceOrientation);
     if (MenuContainer != null)
     {
         MenuContainer.DidRotate(fromInterfaceOrientation);
     }
     if (SubMenuContainer != null)
     {
         SubMenuContainer.DidRotate(fromInterfaceOrientation);
     }
     if (DetailContainer != null)
     {
         DetailContainer.DidRotate(fromInterfaceOrientation);
     }
 }
Ejemplo n.º 30
0
        public MenuManager(Node2D Node, InputManager InputManager, Game1 MainGame)
        {
            GuiNode              = Node;
            Input                = InputManager;
            Game                 = MainGame;
            CurrentMenuState     = MenuState.Menu;
            CurrentMenuContainer = ImportMenu("MainMenu");

            MouseCursor = new MouseCursor(MainGame.GetScreenWidth() / 64);

            //MenuStorage.Add( "Inactive", new MenuContainer("Inactive", this));
            UpdateScreen();
            GuiNode.Attach(MouseCursor.Geometry);
            CurrentMenuContainer.AttachToGUI();
            //GuiNode.Attach(CurrentMenuContainer.ContainerNode);
        }
 public void Add(MenuContainer container, ToolStripItem itm)
 {
     Insert(container, itm, -1);
 }
        public void Insert(MenuContainer container, ToolStripItem itm, int at)
        {
            if (!_items.ContainsKey(container))
                _items.Add(container, new List<ToolStripItem>());

            _items[container].Add(itm);

            OnAdded(container, itm, at);
        }
        public ToolStripItem Find(MenuContainer at, string name)
        {
            if (!_items.ContainsKey(at))
                return null;

            return _items[at].FirstOrDefault(x => x.Name == name);
        }
        public void Remove(MenuContainer container, ToolStripItem itm)
        {
            if (!_items.ContainsKey(container))
                return;
            List<ToolStripItem> list = _items[container];
            list.Remove(itm);

            OnRemoved(container, itm);
        }
 protected virtual void OnAdded(MenuContainer container, ToolStripItem itm, int index)
 {
     if (Added != null)
         Added(this, new MenuEvent(itm, index, container));
 }
 protected virtual void OnRemoved(MenuContainer container, ToolStripItem itm)
 {
     if (Removed != null)
         Removed(this, new MenuEvent(itm, -1, container));
 }
 public MenuEvent(ToolStripItem itm, int index, MenuContainer at)
 {
     Item = itm;
     At = at;
     Index = index;
 }
 protected virtual ToolStripItemCollection GetMenuCollection(MenuContainer at)
 {
     switch (at)
     {
         case MenuContainer.Base:
             return mainMenu.Items;
         case MenuContainer.File:
             return fileToolStripMenuItem.DropDownItems;
         case MenuContainer.Edit:
             return editToolStripMenuItem.DropDownItems;
         case MenuContainer.View:
             return viewToolStripMenuItem.DropDownItems;
         case MenuContainer.Analyzer:
             return analyzeToolStripMenuItem.DropDownItems;
         case MenuContainer.FolderContext:
             return folderContextMenu.Items;
         case MenuContainer.FileContext:
             return fileContextMenu.Items;
         default:
             return null;
     }
 }