示例#1
0
文件: MenuBar.cs 项目: M1C/Eto
 public MenuBar(Generator g)
     : base(g, typeof(IMenuBar))
 {
     //BindingContext = new BindingContext();
     inner = (IMenuBar)base.Handler;
     menuItems = new MenuItemCollection(this, inner);
 }
示例#2
0
文件: Menu.cs 项目: adbre/mono
 		protected Menu (MenuItem[] items)
		{
			menu_items = new MenuItemCollection (this);

			if (items != null)
				menu_items.AddRange (items);
		}
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuItem"/> class.
 /// </summary>
 /// <param name="text">The text.</param>
 protected MenuItem(string text)
     : base(text)
 {
     _visible = true;
     _enabled = true;
     ChildItems = new MenuItemCollection();
 }
    protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
    {
        // create my menu item "Import"
        var menu = new MenuItemCollection();
        // duplicate this section for more than one icon
        var m = new MenuItem("import", "Import");
        m.Icon = "settings-alt";
        menu.Items.Add(m);

        return menu;
    }
    protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
    {
        var menu = new MenuItemCollection();
        var m = new MenuItem("drink", "Drink");
        m.Icon = "wine-glass";
        menu.Items.Add(m);

        var x = new MenuItem("detox", "Detox");
        x.Icon = "medicine";
        menu.Items.Add(x);

        return menu;
    }
        /// <summary>
        /// Adds a menu for the various find actions.
        /// </summary>
        /// <param name="menuItems">The menu item collection to add this menu item to.</param>
        /// <param name="label">The label for the menu item.</param>
        /// <returns>The created menu item.</returns>
        public static MenuItem AddSpellingAndGrammarMenu(this MenuItemCollection menuItems, string label = "Spelling and Grammar")
        {
            var menu = menuItems.AddLabelItem(label);

            menu.MenuItems.AddShowSpellingAndGrammarItem();
            menu.MenuItems.AddCheckDocumentNowItem();
            menu.MenuItems.AddSeparatorItem();
            menu.MenuItems.AddCheckSpellingWhileTypingItem();
            menu.MenuItems.AddCheckGrammarWithSpellingItem();
            menu.MenuItems.AddCorrectSpellingAutomaticallyItem();

            return(menu);
        }
        /// <summary>
        /// Adds a menu for the various find actions.
        /// </summary>
        /// <param name="menuItems">The menu item collection to add this menu item to.</param>
        /// <param name="label">The label for the menu item.</param>
        /// <returns>The created menu item.</returns>
        public static MenuItem AddFindMenu(this MenuItemCollection menuItems, string label = "Find")
        {
            var menu = menuItems.AddLabelItem(label);

            menu.MenuItems.AddFindItem();
            menu.MenuItems.AddFindAndReplaceItem();
            menu.MenuItems.AddFindNextItem();
            menu.MenuItems.AddFindPreviousItem();
            menu.MenuItems.AddUseSelectionForFindItem();
            menu.MenuItems.AddJumpToSelectionItem();

            return(menu);
        }
示例#8
0
 public EditQuickItems(MenuItemCollection mainMenu, AccelGroup accelGroup)
 {
     this.mainMenu   = mainMenu;
     this.accelGroup = accelGroup;
     itemShortcuts   = new BindList <ItemShortcut> ();
     changedMenus    = new List <string> ();
     AccelMap.Foreach(IntPtr.Zero, AddItemShortcut);
     if (itemShortcuts.Count == 0)
     {
         itemShortcuts.Add(new ItemShortcut());
     }
     Initialize();
 }
示例#9
0
        /// <summary>
        /// Adds the "Delete Form" action to the menu.
        /// </summary>
        /// <param name="menu">
        /// The menu items to add the action to.
        /// </param>
        public void AddDeleteFormAction(MenuItemCollection menu)
        {
            var path     = "/App_Plugins/formulate/menu-actions/deleteForm.html";
            var menuItem = new MenuItem()
            {
                Alias = "deleteForm",
                Icon  = "folder",
                Name  = "Delete Form"
            };

            menuItem.LaunchDialogView(path, "Delete Form");
            menu.Items.Add(menuItem);
        }
示例#10
0
    protected void ASPxScheduler1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
    {
        ASPxSchedulerPopupMenu menu = e.Menu;

        if (menu.MenuId.Equals(SchedulerMenuItemId.DefaultMenu))
        {
            menu.ClientSideEvents.ItemClick = String.Format("function(s, e) {{ DefaultViewMenuHandler({0}, s, e); }}", ASPxScheduler1.ClientInstanceName);
            MenuItemCollection menuItems   = menu.Items;
            MenuItem           defaultItem = menuItems.FindByName("NewAppointment");
            defaultItem.Name = "MyNewAppointment";
            defaultItem.Text = "Instant Appointment";
        }
    }
示例#11
0
        private static LabelMenuItem AddDefaultHandlerMenuItem(
            MenuItemCollection menuItems,
            string label,
            string command,
            ModifierKey modifier,
            Key key,
            long tag = 0)
        {
            var item = AddDefaultHandlerMenuItem(menuItems, label, command, tag);

            item.SetShortcut(modifier, key);
            return(item);
        }
示例#12
0
 private void CreateMenuRecursively(DataTable table, MenuItemCollection items, string parentID)
 {
     for (int i = 0; i < table.Rows.Count; i++)
     {
         if (table.Rows[i]["ParentID"].ToString() == parentID)
         {
             MenuItem item = new MenuItem(table.Rows[i]["Title"].ToString(),
                                          table.Rows[i]["ID"].ToString());
             items.Add(item);
             CreateMenuRecursively(table, item.Items, item.Name);
         }
     }
 }
        public ContextMenuMultiInstance()
        {
            InitializeComponent();
            DataContext = this;

            Postits = new PostitCollection();

            MenuItems = new MenuItemCollection();
            MenuItems.Add(new UbiMenuItem() { Caption = "Add Yellow Postit", Command = Postits.CreatePostitCommand, Converter = new HoldConverter() { VisualReference = this, Color = Brushes.LemonChiffon } });
            MenuItems.Add(new UbiMenuItem() { Caption = "Add Pink Postit", Command = Postits.CreatePostitCommand, Converter = new HoldConverter() { VisualReference = this, Color = Brushes.LightPink } });
            MenuItems.Add(new UbiMenuItem() { Caption = "Add Green Postit", Command = Postits.CreatePostitCommand, Converter = new HoldConverter() { VisualReference = this, Color = Brushes.GreenYellow } });

        }
示例#14
0
        /// <summary>
        /// Adds the "Create Folder" action to the folder's menu.
        /// </summary>
        /// <param name="menu">
        /// The menu items.
        /// </param>
        public void AddCreateFolderAction(MenuItemCollection menu)
        {
            var path     = "/App_Plugins/formulate/menu-actions/createFolder.html";
            var menuItem = new MenuItem()
            {
                Alias = "createFolder",
                Icon  = "formulate-create-folder",
                Name  = LocalizationHelper.GetMenuItemName("Create Folder")
            };

            menuItem.LaunchDialogView(path, "Create Folder");
            menu.Items.Add(menuItem);
        }
        protected virtual MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //set the default to create
            menu.DefaultMenuAlias = ActionNew.ActionAlias;
            //create action
            menu.Items.Add <ActionNew>(Services.TextService, opensDialog: true);
            //refresh action
            menu.Items.Add(new RefreshNode(Services.TextService, true));

            return(menu);
        }
        /// <summary>
        /// Get menu/s for nodes in tree
        /// </summary>
        /// <param name="id"></param>
        /// <param name="queryStrings"></param>
        /// <returns></returns>
        protected override MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //If the node is the root node (top of tree)
            if (id == Constants.System.Root.ToInvariantString())
            {
                //Add in refresh action
                menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), false);
            }

            return(menu);
        }
示例#17
0
        /// <summary>
        /// Adds the "Delete Configured Form" action to the configured form node.
        /// </summary>
        /// <param name="menu">
        /// The menu to add the action to.
        /// </param>
        public void AddDeleteAction(MenuItemCollection menu)
        {
            var path     = "/App_Plugins/formulate/menu-actions/deleteConfiguredForm.html";
            var menuItem = new MenuItem()
            {
                Alias = "deleteConfiguredForm",
                Icon  = "formulate-delete",
                Name  = LocalizationHelper.GetMenuItemName("Delete Configuration")
            };

            menuItem.LaunchDialogView(path, "Delete Configuration");
            menu.Items.Add(menuItem);
        }
示例#18
0
        //设置菜单
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();
            int contentId;

            if (int.TryParse(id, out contentId))
            {
                menu.Items.Add(new MenuItem("Approved", "通过退款审核"));
            }
            menu.Items.Add <RefreshNode, ActionRefresh>("刷新节点");
            menu.Items.Add <ActionDelete>("Delete");
            return(menu);
        }
		private static void ClearMenuItems(MenuItemCollection menuItemCollection)
		{
			if (menuItemCollection == null || menuItemCollection.Count == 0)
				return;

			// it's possible that menuItem.Dispose() removes menuItem from MenuItem, therefore
			// we better work with a copy.
			var menuItems = new MenuItem[menuItemCollection.Count];
			menuItemCollection.CopyTo(menuItems, 0);
			foreach (var menuItem in menuItems)
				menuItem.Dispose();
			menuItemCollection.Clear();
		}
        protected virtual MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //set the default to create
            menu.DefaultMenuAlias = ActionNew.Instance.Alias;
            //create action
            menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
            //refresh action
            menu.Items.Add <RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);

            return(menu);
        }
示例#21
0
        protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == "-1")
            {
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;
                menu.Items.Add <ActionNew>("Create");
                menu.Items.Add <ActionRefresh>("Refresh nodes");
            }
            menu.Items.Add <ActionDelete>("Delete");
            return(menu);
        }
示例#22
0
        /// <summary>
        /// Adds the edit sub menu.
        /// </summary>
        /// <param name="menuItems">The menu item collection to add this menu item to.</param>
        /// <returns>The created menu.</returns>
        public MenuItem AddApp(MenuItemCollection menuItems)
        {
            var app = menuItems.AddLabelItem(string.Empty);

            AddAbout(app.MenuItems);
            app.MenuItems.AddSeparatorItem();
            AddHide(app.MenuItems);
            AddHideOtherApplications(app.MenuItems);
            AddUnhideAllApplications(app.MenuItems);
            app.MenuItems.AddSeparatorItem();
            AddQuit(app.MenuItems);
            return(app);
        }
示例#23
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == Constants.System.Root.ToInvariantString())
            {
                //set the default to create
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;

                // root actions
                menu.Items.Add <ActionNew>(Services.TextService.Localize($"actions/{ActionNew.Instance.Alias}"));
                menu.Items.Add <RefreshNode, ActionRefresh>(Services.TextService.Localize($"actions/{ActionRefresh.Instance.Alias}"), hasSeparator: true);
                return(menu);
            }

            var container = Services.EntityService.Get(int.Parse(id), UmbracoObjectTypes.DataTypeContainer);

            if (container != null)
            {
                //set the default to create
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;

                menu.Items.Add <ActionNew>(Services.TextService.Localize($"actions/{ActionNew.Instance.Alias}"));

                menu.Items.Add(new MenuItem("rename", Services.TextService.Localize("actions/rename"))
                {
                    Icon = "icon icon-edit"
                });

                if (container.HasChildren() == false)
                {
                    //can delete data type
                    menu.Items.Add <ActionDelete>(Services.TextService.Localize($"actions/{ActionDelete.Instance.Alias}"));
                }

                menu.Items.Add <RefreshNode, ActionRefresh>(Services.TextService.Localize($"actions/{ActionRefresh.Instance.Alias}"), hasSeparator: true);
            }
            else
            {
                var nonDeletableSystemDataTypeIds = GetNonDeletableSystemDataTypeIds();

                if (nonDeletableSystemDataTypeIds.Contains(int.Parse(id)) == false)
                {
                    menu.Items.Add <ActionDelete>(Services.TextService.Localize($"actions/{ActionDelete.Instance.Alias}"));
                }

                menu.Items.Add <ActionMove>(Services.TextService.Localize($"actions/{ActionMove.Instance.Alias}"), hasSeparator: true);
            }

            return(menu);
        }
        protected override void CreateContextMenu()
        {
            base.CreateContextMenu();

            if (!IsContextMenuEnable)
            {
                return;
            }
            if (ContextMenu == null)
            {
                ContextMenu = new MenuItemCollection {
                    ParentName = "MenuItemCRUDContextMenu"
                }
            }
            ;

            // CRUD items
            var commands = new[] { _miDelete.Clone(), _miEdit.Clone(), _history.Clone(), _miShowInNewWindow.Clone() };

            foreach (var mi in commands)
            {
                if (mi != null)
                {
                    mi.GlyphSize = GlyphSizeType.Small;
                    ContextMenu.Add(mi);
                }
            }
            ContextMenu.Add(new SeparatorMenuItem());

            // Print item
            if (Print != null)
            {
                var miPrint = Print.Clone();
                miPrint.GlyphSize = GlyphSizeType.Small;
                ContextMenu.Add(miPrint);
                ContextMenu.Add(new SeparatorMenuItem());
            }

            var entityQuickItems = GetEntityLinkMenuItems();

            foreach (var mi in entityQuickItems)
            {
                var cmi = (mi as CommonMenuItemBase);
                if (cmi != null)
                {
                    cmi.GlyphSize = GlyphSizeType.Small;
                }
                ContextMenu.Add(mi);
            }
            ContextMenu.Add(new SeparatorMenuItem());
        }
        /// <summary>
        /// Gets the menu item collection from a legacy tree node
        /// </summary>
        /// <param name="xmlTreeNode"></param>
        /// <param name="currentSection"></param>
        /// <returns></returns>
        internal static MenuItemCollection ConvertFromLegacyMenu(XmlTreeNode xmlTreeNode, string currentSection)
        {
            var collection = new MenuItemCollection();

            var menuItems  = xmlTreeNode.Menu.ToArray();
            var numAdded   = 0;
            var seperators = new List <int>();

            foreach (var t in menuItems)
            {
                if (t is ContextMenuSeperator && numAdded > 0)
                {
                    //store the index for which the seperator should be placed
                    seperators.Add(collection.Items.Count());
                }
                else
                {
                    var menuItem = collection.Items.Add(t, ui.Text("actions", t.Alias));

                    var currentAction = t;

                    //First try to get a URL/title from the legacy action,
                    // if that doesn't work, try to get the legacy confirm view
                    // if that doesn't work and there's no jsAction in there already then add the legacy js method call
                    Attempt
                    .Try(GetUrlAndTitleFromLegacyAction(currentAction, xmlTreeNode.NodeID, xmlTreeNode.NodeType, xmlTreeNode.Text, currentSection),
                         action => menuItem.LaunchDialogUrl(action.Url, action.DialogTitle))
                    .OnFailure(() => GetLegacyConfirmView(currentAction, currentSection),
                               view => menuItem.LaunchDialogView(
                                   view,
                                   ui.GetText("defaultdialogs", "confirmdelete") + " '" + xmlTreeNode.Text + "' ?"))
                    .OnFailure(() => menuItem.AdditionalData.ContainsKey(MenuItem.JsActionKey)
                                             ? Attempt.Fail(false)
                                             : Attempt.Succeed(true),
                               b => menuItem.ExecuteLegacyJs(menuItem.Action.JsFunctionName));

                    numAdded++;
                }
            }
            var length = collection.Items.Count();

            foreach (var s in seperators)
            {
                if (length >= s)
                {
                    collection.Items.ElementAt(s).SeperatorBefore = true;
                }
            }

            return(collection);
        }
示例#26
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //if root node no need to visit the filesystem so lets just create the menu and return it
            if (id == Constants.System.Root.ToInvariantString())
            {
                //set the default to create
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;
                //create action
                menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
                //refresh action
                menu.Items.Add <RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);

                return(menu);
            }

            var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
                ? HttpUtility.UrlDecode(id).TrimStart("/")
                : "";

            var isFile      = FileSystem.FileExists(path);
            var isDirectory = FileSystem.DirectoryExists(path);

            if (isDirectory)
            {
                //set the default to create
                menu.DefaultMenuAlias = ActionNew.Instance.Alias;
                //create action
                menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));

                var hasChildren = FileSystem.GetFiles(path).Any() || FileSystem.GetDirectories(path).Any();

                //We can only delete folders if it doesn't have any children (folders or files)
                if (hasChildren == false)
                {
                    //delete action
                    menu.Items.Add <ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)), true);
                }

                //refresh action
                menu.Items.Add <RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
            }
            else if (isFile)
            {
                //if it's not a directory then we only allow to delete the item
                menu.Items.Add <ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
            }

            return(menu);
        }
示例#27
0
        private void CargarMenuItems()
        {
            Control            menuMaster = this.FindControl("Menu_master");
            MenuItemCollection menuItems  = ((Menu)menuMaster).Items;

            MenuItem envio = new MenuItem("Envio");

            menuItems.Add(envio);

            MenuItem crearEnvio = new MenuItem("Crear");

            envio.ChildItems.Add(crearEnvio);
            crearEnvio.NavigateUrl = "~/Admin_crearEnvio.aspx";

            MenuItem actualizar = new MenuItem("Actualizar");

            envio.ChildItems.Add(actualizar);
            actualizar.NavigateUrl = "~/Admin_ActualizarEnvio.aspx";

            MenuItem simular = new MenuItem("Simular");

            envio.ChildItems.Add(simular);
            simular.NavigateUrl = "~/Ambos_SimularEnvio.aspx";

            MenuItem rastrear = new MenuItem("Rastrear");

            envio.ChildItems.Add(rastrear);
            rastrear.NavigateUrl = "~/Ambos_RastrearEnvio.aspx";

            MenuItem ttlFact = new MenuItem("Total Facturado");

            envio.ChildItems.Add(ttlFact);
            ttlFact.NavigateUrl = "~/Ambos_TotalFacturado.aspx";

            MenuItem listadoEnvios = new MenuItem("Listado de envios");

            envio.ChildItems.Add(listadoEnvios);
            listadoEnvios.NavigateUrl = "~/Ambos_ListarEnvios.aspx";

            MenuItem crearAdmin = new MenuItem("Crear administrador");

            menuItems.Add(crearAdmin);
            crearAdmin.NavigateUrl = "~/Admin_CrearAdmin.aspx";

            if ((bool)Session["esAdmin"] == false && (bool)Session["esCliente"] == true)
            {
                menuItems.Remove(crearAdmin);
                envio.ChildItems.Remove(crearEnvio);
                envio.ChildItems.Remove(actualizar);
            }
        }
        /// <summary>
        /// Adds a menu item for the quit applications action.
        /// </summary>
        /// <param name="menuItems">The menu item collection to add this menu item to.</param>
        /// <param name="label">The label for the menu item.</param>
        /// <returns>The created menu item.</returns>
        public static MenuItem AddQuitItem(this MenuItemCollection menuItems, string label = "Quit")
        {
            if (label == null)
            {
                throw new ArgumentNullException(nameof(label));
            }

            var item = menuItems.AddLabelItem(label);

            item.SetShortcut(ModifierKey.Super, Key.Q);
            item.Click += (s, e) => Application.Exit();

            return(item);
        }
示例#29
0
        public MenuItemCollection GetContextMenu(string contextMenuName)
        {
            MenuItemCollection result = null;

            if (!string.IsNullOrWhiteSpace(contextMenuName))
            {
                result =
                    MainMenu.SelectMany(
                        e => e.MenuItems.Where(s => s.ContextMenuName != null && s.ContextMenuName.ToUpper().Equals(contextMenuName.ToUpper()))).
                    ToMenuItemCollection();
            }

            return(result ?? (result = new MenuItemCollection()));
        }
示例#30
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == Constants.System.Root.ToString())
            {
                menu.Items.Add <CreateChildEntity, ActionNew>(GetLocalizedText("actions", ActionNew.Instance.Alias));
                menu.Items.Add <RefreshNode, ActionRefresh>(GetLocalizedText("actions", ActionRefresh.Instance.Alias), true);
                return(menu);
            }

            menu.Items.Add <ActionDelete>(GetLocalizedText("actions", ActionDelete.Instance.Alias));
            return(menu);
        }
    protected void ASPxScheduler1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
    {
        ASPxSchedulerPopupMenu menu = e.Menu;

        if (menu.MenuId.Equals(SchedulerMenuItemId.AppointmentMenu))
        {
            MenuItemCollection menuItems = menu.Items;
            MenuItem           defaultItemOpentAppointment = menuItems.FindByText("Open");
            MenuHelper.RemoveMenuItem(menu, "OpenAppointment");
            MenuHelper.AddMenuItem(menu, 0, "MyOpenAppoinment", defaultItemOpentAppointment.Name);
            MenuItem defaultItemLabelAsImportant = menuItems.FindByText("Important");
            MenuHelper.AddMenuItem(menu, 1, "Make Important", defaultItemLabelAsImportant.Name);
        }
    }
示例#32
0
        private void Build(CefMenuModel model, MenuItemCollection menu)
        {
            CefColor color = default;
            int      count = model.Count;

            for (int i = 0; i < count; i++)
            {
                MenuItem menuItem;
                switch (model.GetTypeAt(i))
                {
                case CefMenuItemType.Separator:
                    menu.Add(new MenuSeparatorItem());
                    continue;

                case CefMenuItemType.Check:
                    menuItem = new MenuItem();
                    //menuItem.CheckOnClick = true;
                    //menuItem.Checked = model.IsCheckedAt(i);
                    break;

                case CefMenuItemType.Radio:
                    menuItem = new MenuItem();
                    //menuItem.Checked = model.IsCheckedAt(i);
                    break;

                case CefMenuItemType.Command:
                    menuItem = new MenuItem();
                    break;

                case CefMenuItemType.Submenu:
                    menuItem = new MenuItem();
                    if (model.IsEnabledAt(i))
                    {
                        //menuItem.DropDownItemClicked += Menu_ItemClicked;
                        Build(model.GetSubMenuAt(i), menuItem.Items);
                    }
                    break;

                default:
                    continue;
                }
                menuItem.Text    = model.GetLabelAt(i).Replace("&", "");
                menuItem.Click  += Menu_ItemClicked;
                menuItem.Enabled = model.IsEnabledAt(i);
                //menuItem.Tag = model.GetCommandIdAt(i);
                MenuItemsTags.Add(menuItem, model.GetCommandIdAt(i));
                //menuItem.ForeColor = model.GetColorAt(i, CefMenuColorType.Text, ref color) ? Color.FromArgb(color.ToArgb()) : SystemColors.ControlText;
                menu.Add(menuItem);
            }
        }
        protected override MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            //set the default to create
            menu.DefaultMenuAlias = ActionNew.Instance.Alias;

            // root actions
            menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)))
            .ConvertLegacyMenuItem(null, Constants.Trees.Xslt, queryStrings.GetValue <string>("application"));

            menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
            return(menu);
        }
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id.Equals("-1"))
            {
                MenuItem menuItem = new MenuItem("create", "Create");
                menuItem.Icon = "icon icon-add";
                menuItem.NavigateToRoute("/optional/optional/edit/-1");
                menu.Items.Add(menuItem);
                menu.Items.Add <ActionRefresh>("Refresh");
            }
            return(menu);
        }
示例#35
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == Constants.System.Root.ToInvariantString())
            {
                // root actions
                menu.Items.Add <CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias));
                menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
                //menu.Items.Add<RefreshNode, ActionSort>(ui.Text("actions", ActionSort.Instance.Alias), true);
                return(menu);
            }
            return(menu);
        }
示例#36
0
        private void PrepareRDSMenu(MenuItemCollection rdsItems)
        {
            rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null));

            if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User))
            {
                rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
            }

            if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
            {
                rdsItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
            }
        }
示例#37
0
        public void ViewState_LoadSaveTrack_ReturnsTheSetValue()
        {
            // Arrange:
            //Create the control, start tracking viewstate, then set a new Text value.
            var menu              = new Menu();
            var item1             = new MenuItem(MenuItemId1);
            var item2             = new MenuItem(MenuItemId2);
            var controlCollection = new ControlCollection(menu);
            var itemCollection    = new MenuItemCollection(controlCollection)
            {
                item1,
                item2
            };

            var privateObject = new PrivateObject(menu);

            privateObject.SetFieldOrProperty(MenuItemProperyName, itemCollection);

            privateObject.Invoke(MethodTrackViewState);
            itemCollection.RemoveAt(0);
            privateObject.SetFieldOrProperty(MenuItemProperyName, itemCollection);

            //Save the control's state
            var viewState = privateObject.Invoke(MethodSaveViewState);

            //Create a new control instance and load the state
            //back into it, overriding any existing values
            var menuNew = new Menu();
            var controlCollectionNew = new ControlCollection(menuNew);

            itemCollection = new MenuItemCollection(controlCollectionNew)
            {
                item1,
                item2
            };

            var menuNewPrivateObject = new PrivateObject(menuNew);

            menuNewPrivateObject.SetFieldOrProperty(MenuItemProperyName, itemCollection);

            // Act:
            menuNewPrivateObject.Invoke(MethodLoadViewState, viewState);

            // Assert:
            var propertyValue = menuNewPrivateObject.GetFieldOrProperty(MenuItemProperyName) as MenuItemCollection;

            propertyValue.ShouldNotBeNull();
            propertyValue.Count.ShouldBe(1);
        }
示例#38
0
文件: Ui.cs 项目: kevins1022/Altman
		private ButtonMenuItem GetSubmenu(MenuItemCollection items, string submenuText, bool create = true)
		{
			var submenu = items.OfType<ButtonMenuItem>().FirstOrDefault(r => r.ID == submenuText);
			if (submenu == null && create)
			{
				submenu = new ButtonMenuItem
				{
					ID = submenuText,
					Text = submenuText, 
					Order = 10
				};
				items.Add(submenu);
			}
			return submenu;
		}
    protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
    {
        var menu = new MenuItemCollection();

        if (id == Constants.System.Root.ToInvariantString())
        {
            // root actions              
            menu.Items.Add<CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias));
            menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
            return menu;
        }
                    

        menu.Items.Add<ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias));   

        return menu;
    }
      public MenuItemsEditorForm(PopupMenu oMenu)
    {
      InitializeComponent();
      this._firstActivate = true;
      _navBar = oMenu;
      Items = oMenu.Items;

      // add pre-existing nodes
      foreach (ChinaCustoms.Framework.DeluxeWorks.Web.WebControls.MenuItem oRoot in Items)
      {
        TreeNode oRootNode = new TreeNode(oRoot.Text);
        LoadNodes(oRoot, oRootNode);
        _treeView.Nodes.Add(oRootNode);
      }
      this.propertyGrid1.Site = new FormPropertyGridSite(oMenu.Site, this.propertyGrid1);
      _treeView.HideSelection = false;
    }
		public void Generate(MenuItemCollection menu)
		{
			var list = new List<IActionItem>(this);
			list.Sort(Compare);
			var lastSeparator = false;
			for (int i = 0; i < list.Count; i++)
			{
				var ai = list[i];
				var isSeparator = (ai is ActionItemSeparator);
				
				if ((lastSeparator && isSeparator) || (isSeparator && (i == 0 || i == list.Count - 1)))
					continue;
				var mi = ai.Generate(menu.parent.Generator);
				if (mi != null)
					menu.Add(mi);
				lastSeparator = isSeparator;	
			}
		}
示例#42
0
	// Constructor.
	protected Menu(MenuItem[] items)
			{
				format = new StringFormat();
				format.FormatFlags |= StringFormatFlags.NoWrap;
				format.HotkeyPrefix = HotkeyPrefix.Show;
				if(items != null)
				{
					this.numItems = items.Length;
					this.itemList = new MenuItem [numItems];
					Array.Copy(items, 0, this.itemList, 0, numItems);
					this.items = null;
					this.suppressUpdates = 0;
				}
				else
				{
					this.numItems = 0;
					this.itemList = new MenuItem [0];
					this.items = null;
					this.suppressUpdates = 0;
				}
			}
示例#43
0
		/// <summary>
		/// Event handler for the DataBinding event.
		/// </summary>
		/// <remarks>This method runs when the DataBind() method is called.  Essentially, it clears out the
		/// current state and builds up the menu from the specified <see cref="DataSource"/>.
		/// </remarks>
		protected override void OnDataBinding(EventArgs e)
		{
			// Start by resetting the Control's state
			this.Controls.Clear();
			if (HasChildViewState)
				ClearChildViewState();

			// load the datasource either as a string or XmlDocuemnt
			XmlDocument xmlDoc = new XmlDocument();

			if (this.DataSource is String)
				// Load the XML document specified by DataSource as a filepath
				xmlDoc.Load((string) this.DataSource);
			else if (this.DataSource is XmlDocument)
				xmlDoc = (XmlDocument) DataSource;
			else
				return; // exit - nothing to databind

			// Clear out the MenuItems and build them according to the XmlDocument
			this.items.Clear();
			this.items = GatherMenuItems(xmlDoc.SelectSingleNode(strMenuTag), this.ClientID);
			BuildMenu();

			this.ChildControlsCreated = true;

			if (!IsTrackingViewState)
				TrackViewState();
		}
示例#44
0
		protected ButtonMenuItem(Generator generator, Type type, bool initialize = true)
			: base(generator, type, initialize)
		{
			Items = new MenuItemCollection(Handler);
		}
 protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
 {
     var menu = new MenuItemCollection();
     return menu;
 }
示例#46
0
		public void CreateStandardMenu(MenuItemCollection menuItems, IEnumerable<Command> commands = null)
		{
			var menuBar = menuItems.parentItem as MenuBar;
			if (menuBar != null)
			{
				menuBar.CreateLegacySystemMenu();
			}
		}
示例#47
0
文件: Menu.cs 项目: JianwenSun/cc
            /// <include file='doc\Menu.uex' path='docs/doc[@for="Menu.MenuItemCollection.FindInternal"]/*' />
            /// <devdoc>
            ///     <para>Searches for Controls by their Name property, builds up an array list
            ///           of all the controls that match. 
            ///     </para>
            /// </devdoc>
            /// <internalonly/>
            private ArrayList FindInternal(string key, bool searchAllChildren, MenuItemCollection menuItemsToLookIn, ArrayList foundMenuItems) {
                if ((menuItemsToLookIn == null) || (foundMenuItems == null)) {
                    return null;  // 
                }

                // Perform breadth first search - as it's likely people will want controls belonging
                // to the same parent close to each other.
                
                for (int i = 0; i < menuItemsToLookIn.Count; i++) {
                      if (menuItemsToLookIn[i] == null){
                          continue;
                      }
                      
                      if (WindowsFormsUtils.SafeCompareStrings(menuItemsToLookIn[i].Name, key, /* ignoreCase = */ true)) {
                           foundMenuItems.Add(menuItemsToLookIn[i]);
                      }
                }

                // Optional recurive search for controls in child collections.
                
                if (searchAllChildren){
                    for (int i = 0; i < menuItemsToLookIn.Count; i++) {    
                      if (menuItemsToLookIn[i] == null){
                          continue;
                      }
                        if ((menuItemsToLookIn[i].MenuItems != null) && menuItemsToLookIn[i].MenuItems.Count > 0){
                            // if it has a valid child collecion, append those results to our collection
                            foundMenuItems = FindInternal(key, searchAllChildren, menuItemsToLookIn[i].MenuItems, foundMenuItems);
                        }
                     }
                }
                return foundMenuItems;
            }
示例#48
0
		/// <summary>
		/// This method is used from the OnDataBinding method; it traverses the XML document,
		/// building up the object model.
		/// </summary>
		/// <param name="itemsNode">The current menuItem XmlNode</param>
		/// <param name="parentID">The ID of the parent menuItem XmlNode</param>
		/// <returns>A set of MenuItems for this menu.</returns>
		protected virtual MenuItemCollection GatherMenuItems(XmlNode itemsNode, string parentID)
		{
			// Make sure we have an XmlNode instance - it should never be null, else the
			// XML document does not have the expected structure
			if (itemsNode == null)
				throw new ArgumentException("The XML data for the Menu control is in an invalid format.");

			MenuItemCollection mymic = new MenuItemCollection();
			if (IsTrackingViewState)
				((IStateManager) mymic).TrackViewState();

			// iterate through each MenuItem
			XmlNodeList mynl = itemsNode.ChildNodes;
			for (int i = 0; i < mynl.Count; i++)
			{
				XmlNode node = mynl[i];

				// Create the menuitem
				if (node.Name == "menuItem")
					mymic.Add(BuildMenuItem(node, parentID, i));
				if (node.Name == "menuSpacer")
					mymic.Add(BuildMenuSpacer(node, parentID, i));
			}

			return mymic;
		}
示例#49
0
文件: Menu.cs 项目: adbre/mono
		protected void CloneMenu (Menu menuSrc)
		{
			Dispose (true);

			menu_items = new MenuItemCollection (this);

			for (int i = 0; i < menuSrc.MenuItems.Count ; i++)
				menu_items.Add (menuSrc.MenuItems [i].CloneMenu ());
		}
示例#50
0
文件: Menu.cs 项目: garuma/xwt
 public Menu()
 {
     items = new MenuItemCollection (this);
 }
示例#51
0
		/// <summary>
		/// AddMenu is called recusively, doing a depth-first traversal of the menu hierarchy and building
		/// up the HTML elements from the object model.
		/// </summary>
		/// <param name="menuID">The ID of the parent menu.</param>
		/// <param name="myItems">The collection of menuitems.</param>
		protected virtual void AddMenu(string menuID, MenuItemCollection myItems)
		{
			string image = string.Empty;
			string mouseoverimage = string.Empty;
			string mousedownimage = string.Empty;
			string mouseupimage = string.Empty;
			
			// iterate through the Items
			Table menu = new Table();

			menu.Attributes.Add("id", menuID);
			menu.Attributes.Add("style", "display: none;");
			// The style is overwritten by anthing specifically set in menuitem
			if (this.BackColor != Color.Empty)
				menu.BackColor = this.BackColor;
			if (this.Font != null)
				menu.Font.CopyFrom(this.Font);
			if (this.ForeColor != Color.Empty)
				menu.ForeColor = this.ForeColor;
			if (this.SubMenuCssClass != String.Empty) 
				menu.CssClass = this.SubMenuCssClass;
			else if (this.CssClass != String.Empty) // Use if SubMenuCssClass was blank
				menu.CssClass = this.CssClass;
			if (this.BorderColor != Color.Empty)
				menu.BorderColor = this.BorderColor;
			if (this.BorderStyle != BorderStyle.NotSet)
				menu.BorderStyle = this.BorderStyle;
			if (this.BorderWidth != Unit.Empty)
				menu.BorderWidth = this.BorderWidth;
			menu.CellPadding = ItemPadding;
			menu.CellSpacing = ItemSpacing;
			menu.GridLines = GridLines;
			menu.Style.Add("z-index", curzindex.ToString());
			curzindex += 2;

			BuildOpacity(menu);

			// Iterate through the menuItem's subMenu...
			for (int i = 0; i < myItems.Count; i++)
			{
				MenuItem mi = myItems[i];

				// only render this MenuItem if it is visible and the user has permissions
				if (mi.Visible && UserHasPermission(mi)) 
				{
					TableRow tr = new TableRow();		
					
					TableCell td = new TableCell();
					td.ApplyStyle(this.unselectedMenuItemStyle);
					// The style is overwritten by anything specifically set in menuitem
					if (mi.BackColor != Color.Empty) 
						td.BackColor = mi.BackColor;
					if (mi.Font != null)
						td.Font.CopyFrom(mi.Font);
					if (mi.ForeColor != Color.Empty)
						td.ForeColor = mi.ForeColor;
					if (mi.Height != Unit.Empty)
						td.Height = mi.Height;
					if (mi.Width != Unit.Empty)
						td.Width = mi.Width;
					if (mi.CssClass != String.Empty)
						td.CssClass = mi.CssClass;
					else if	(this.DefaultCssClass != String.Empty)
						td.CssClass = this.DefaultCssClass;
					if (mi.BorderColor != Color.Empty)
						td.BorderColor = mi.BorderColor;
					if (mi.BorderStyle != BorderStyle.NotSet)
						td.BorderStyle = mi.BorderStyle;
					if (mi.BorderWidth != Unit.Empty)
						td.BorderWidth = mi.BorderWidth;
					if (mi.HorizontalAlign != System.Web.UI.WebControls.HorizontalAlign.NotSet)
						td.HorizontalAlign = mi.HorizontalAlign;
					if (mi.VerticalAlign != System.Web.UI.WebControls.VerticalAlign.NotSet)
						td.VerticalAlign = mi.VerticalAlign;
					BuildOpacity(td);
					if (mi.Text != string.Empty)
					{
						//add by johnny start
						if (this.MarginLeftWidth != 0) 
						{
							StringBuilder sb = new StringBuilder();							
							sb.Append("<span style='margin-left:");
							sb.Append(this.MarginLeftWidth);
							sb.Append(";'>");
							sb.Append(mi.Text);
							sb.Append("</span>");
							td.Text = sb.ToString();
						}
						else
						{
							td.Text = mi.Text;
						}
						//end
					}
						
					else if (mi.Image != string.Empty) // Show Image
					{
						System.Web.UI.WebControls.Image cellimage = new System.Web.UI.WebControls.Image();

						cellimage.ImageUrl = mi.Image;
						cellimage.AlternateText = mi.ImageAltText;
						td.Controls.Add(cellimage);

						image = mi.Image;
						mouseoverimage = mi.MouseOverImage;
						mousedownimage = mi.MouseDownImage;
						mouseupimage = mi.MouseUpImage;
					}
					td.Attributes.Add("id", mi.MenuID);

					// Add in the left or right image as needed
					if (mi.LeftImage != String.Empty) 
					{
						System.Web.UI.WebControls.Image leftimage = new System.Web.UI.WebControls.Image();
						System.Web.UI.WebControls.Literal leftliteral = new System.Web.UI.WebControls.Literal();

						leftimage.ImageAlign = mi.LeftImageAlign;
						if (mi.LeftImageRightPadding != Unit.Empty)
							leftimage.Style.Add("margin-right",mi.LeftImageRightPadding.Value.ToString());
						leftimage.ImageUrl = mi.LeftImage;
						td.Controls.Add(leftimage);

						leftliteral.Text = td.Text;
						td.Controls.Add(leftliteral);
					} 
					else if (mi.RightImage != String.Empty) 
					{
						System.Web.UI.WebControls.Image rightimage = new System.Web.UI.WebControls.Image();
						System.Web.UI.WebControls.Literal rightliteral = new System.Web.UI.WebControls.Literal();
						
						rightliteral.Text = td.Text;
						td.Controls.Add(rightliteral);

						rightimage.ImageAlign = mi.RightImageAlign;
						if (mi.RightImageLeftPadding != Unit.Empty)
							rightimage.Style.Add("margin-left",mi.RightImageLeftPadding.Value.ToString());
						rightimage.ImageUrl = mi.RightImage;
						td.Controls.Add(rightimage);
					}

					// Prepare MouseOverCssClass
					string mouseover = String.Empty;

					if (this.DefaultMouseOverCssClass != string.Empty || mi.MouseOverCssClass != string.Empty || this.selectedMenuItemStyle.CssClass != String.Empty)
						mouseover = "this.className='" + GetClass(this.DefaultMouseOverCssClass, mi.MouseOverCssClass, this.selectedMenuItemStyle.CssClass) + "';";

					if (mi.Enabled) // If enabled...
					{
						// Generate OnClick handler
						if (mi.JavascriptCommand != String.Empty) // javascript command
							td.Attributes.Add("onclick", mi.JavascriptCommand + "skm_closeSubMenus(document.getElementById('" + this.ClientID + "'));");
						else if (mi.Url != String.Empty) 
						{
							if (mi.Target != String.Empty)
								td.Attributes.Add("onclick", "javascript:skm_closeSubMenus(document.getElementById('" + this.ClientID + "'));window.open('" + GetURL(mi.ResolveURL, mi.Url) + "','" + mi.Target + "');");
							else if (this.DefaultTarget != String.Empty)
								td.Attributes.Add("onclick", "javascript:skm_closeSubMenus(document.getElementById('" + this.ClientID + "'));window.open('" + GetURL(mi.ResolveURL, mi.Url) + "','" + this.DefaultTarget + "');");
							else
								td.Attributes.Add("onclick", "javascript:skm_closeSubMenus(document.getElementById('" + this.ClientID + "'));location.href='" + GetURL(mi.ResolveURL, mi.Url) + "';");	
						}
						else if (mi.CommandName != String.Empty)  // Must be postback action
							td.Attributes.Add("onclick", Page.GetPostBackClientHyperlink(this, mi.CommandName));
						else if (this.ClickToOpen) // Open submenu on click
							td.Attributes.Add("onclick", "javascript:skm_mousedOverMenu('" + this.ClientID + "',this, document.getElementById('" + menuID + "'), true, '" + mouseoverimage + "');" + GenerateShimCall("true", mi.MenuID + "-subMenu"));
					}

					if (mi.Enabled)
					{
						// Output Tooltip
						if (mi.ToolTip != String.Empty) 
							td.ToolTip = mi.ToolTip;
					}

					// Is this a enabled menuitem?  (as opposed to a Separator or Header)
					if (mi.MenuType == MenuItemType.MenuItem && mi.Enabled) 
					{
						// Output MouseDownCssClass or MouseDownImage
						string mousedown = String.Empty;

						if (this.DefaultMouseDownCssClass != string.Empty || mi.MouseDownCssClass != string.Empty)
							mousedown = "this.className='" + GetClass(this.DefaultMouseDownCssClass, mi.MouseDownCssClass) + "';";

						if (mousedownimage != String.Empty)
							mousedown += "setimage(this, '" + mousedownimage + "');";

						if (mousedown != string.Empty)
							td.Attributes.Add("onmousedown", mousedown);

						// Output MouseUpCssClass or MouseUpImage
						string mouseup = String.Empty;

						if (this.DefaultMouseUpCssClass != string.Empty || mi.MouseUpCssClass != string.Empty)
							mouseup = "this.className='" + GetClass(this.DefaultMouseUpCssClass, mi.MouseUpCssClass) + "';";

						if (mouseupimage != String.Empty)
							mouseup += "setimage(this, '" + mouseupimage + "');";

						if (mouseup != string.Empty)
							td.Attributes.Add("onmouseup", mouseup);

						if (this.ClickToOpen == false) 
						{ 
							td.Attributes.Add("onmouseover", "javascript:skm_mousedOverMenu('" + this.ClientID + "',this, document.getElementById('" + menuID + "'), true, '" + mouseoverimage + "');" + GenerateShimCall("true", mi.MenuID + "-subMenu") + mouseover);
						} 
						else
							td.Attributes.Add("onmouseover", "javascript:skm_mousedOverClickToOpen('" + this.ClientID + "', this, document.getElementById('" + menuID + "'), '" + mouseoverimage + "');"+ mouseover);

						td.Attributes.Add("onmouseout", "javascript:skm_mousedOutMenu('" + this.ClientID + "', this,'" + image + "');" + "this.className='" + GetClass(this.DefaultCssClass, mi.CssClass, this.unselectedMenuItemStyle.CssClass) + "';");
					} 
					else 
					{  // If only a spacer, header or disabled, don't make any style change on mouseover
						td.Attributes.Add("onmouseover", "javascript:skm_mousedOverSpacer('" + this.ClientID + "', this, document.getElementById('" + menuID + "'));");
						td.Attributes.Add("onmouseout", "javascript:skm_mousedOutSpacer('" + this.ClientID + "', this);");
					}

					if (mi.Url != String.Empty || mi.CommandName != String.Empty)
						if (this.Cursor != MouseCursor.Default) 
						{
							if (this.Page.Request.Browser.Browser == "IE")
								td.Style.Add("cursor","hand"); 
							else
								td.Style.Add("cursor","pointer"); 
						}

					tr.Cells.Add(td);
					menu.Rows.Add(tr);

					// (Recursively) Add the subitems for this menu, if needed
					if (mi.SubItems.Count > 0)
					{
						// Create an IFrame (IE5.5 or better) to windowed form elements that might
						// interfere with display of the menu
						if (this.Page.Request.Browser.Browser == "IE" && Convert.ToDouble(this.Page.Request.Browser.Version, enUSCulture) >= 5.5) 
						{
							System.Web.UI.HtmlControls.HtmlGenericControl iframe = new System.Web.UI.HtmlControls.HtmlGenericControl();
							iframe.TagName = "iframe";
							iframe.Attributes.Add("id", "shim" + mi.MenuID + "-subMenu");
							iframe.Attributes.Add("src", IFrameSrc);
							iframe.Attributes.Add("scrolling", "no");
							iframe.Attributes.Add("frameborder", "no");
							iframe.Style.Add("position", "absolute");
							iframe.Style.Add("top", "0px");
							iframe.Style.Add("left", "0px");
							iframe.Style.Add("display", "none");
							BuildOpacity(iframe);
							Controls.Add(iframe);			
						}

						this.subItemsIds.Add(mi.MenuID + "-subMenu");
						AddMenu(mi.MenuID + "-subMenu", mi.SubItems); 
					}
				}
			}

			Controls.Add(menu);
		}
示例#52
0
文件: ContextMenu.cs 项目: M1C/Eto
 public ContextMenu(Generator g)
     : base(g, typeof(IContextMenu))
 {
     inner = (IContextMenu)this.Handler;
     menuItems = new MenuItemCollection (this, inner);
 }
示例#53
0
 public static void GetNodes(MenuItemCollection menus, string parentID, MenuItem item)
 {
     if (menus == null)
     {
         return;
     }
     foreach (MenuItem myitem in menus)
     {
         if (myitem.Name == parentID)
         {
             myitem.Items.Add(item);
         }
         GetNodes(myitem.Items, parentID, item);
     }
 }
示例#54
0
文件: MenuBar.cs 项目: hultqvist/Eto
		protected MenuBar (Generator generator, Type type, bool initialize = true)
			: base (generator, type, initialize)
		{
			handler = (IMenuBar)base.Handler;
			menuItems = new MenuItemCollection (this, handler);
		}
示例#55
0
文件: PageTools.cs 项目: solo123/AGMV
    private static void AddMenuItems(DS_Menu.MenuItemDataTable menuTable, MenuItemCollection pnode, int nodeId)
    {
        if(menuTable==null || pnode==null || menuItemCount>500) return;

        DataRow[] rows = menuTable.Select("status=1 and parentId=" + nodeId.ToString(), "parentID, menuOrder");
        foreach (DS_Menu.MenuItemRow row in rows)
        {
            MenuItem item = new MenuItem();
            item.Text = row.title;
            item.Value = row.menuID.ToString();
            item.NavigateUrl = row.navigateUrl;
            pnode.Add(item);
            menuItemCount++;
            AddMenuItems(menuTable, item.ChildItems, row.menuID);
        }
    }
示例#56
0
文件: ImageMenuItem.cs 项目: M1C/Eto
 public ImageMenuItem(Generator g)
     : base(g, typeof(IImageMenuItem))
 {
     inner = (IImageMenuItem)base.Handler;
     menuItems = new MenuItemCollection (this, inner);
 }
示例#57
0
 public void CreateActions(MenuItemCollection menu)
 {
     var channel = menu.GetSubmenu("&Channel", 800);
     
     channel.Items.Add(new Actions.NextChannel(this), 500);
     channel.Items.Add(new Actions.NextUnreadChannel(this), 500);
     channel.Items.Add(new Actions.PrevChannel(this), 500);
     channel.Items.Add(new Actions.PrevUnreadChannel(this), 500);
     channel.Items.AddSeparator(500);
     
     channel.Items.Add(new Actions.LeaveChannel(this), 500);
 }
示例#58
0
		protected ImageMenuItem (Generator generator, Type type, bool initialize = true)
			: base (generator, type, initialize)
		{
			menuItems = new MenuItemCollection (this, Handler);
		}
示例#59
-1
		public ButtonMenuItem(Command command, Generator generator = null)
			: base(command, generator, typeof(IButtonMenuItem))
		{
			Items = new MenuItemCollection(Handler);
			Image = command.Image;
		}