示例#1
0
        /// <summary>
        ///   This method updates the indexes of the menu's children
        /// </summary>
        /// <param name = "drillDown">-
        ///   tells us if we need to perform the same for all sub menus, or only for the entries in the
        ///   current level
        /// </param>
        public void setIndexes(bool drillDown)
        {
            int         Idx       = 0;
            IEnumerator iInnerMnt = iterator();

            while (iInnerMnt.MoveNext())
            {
                MenuEntry innerMnt = (MenuEntry)iInnerMnt.Current;
#if  !PocketPC
                innerMnt.setIndex(++Idx);
#else
                if (innerMnt.getVisible())
                {
                    innerMnt.setIndex(++Idx);
                }
                else
                {
                    innerMnt.setIndex(-1);
                }
#endif

                if (drillDown && innerMnt.menuType() == MenuType.MENU)
                {
                    ((MenuEntryMenu)innerMnt).setIndexes(drillDown);
                }
            }
        }
示例#2
0
        /// <param name = "drillDown">- tells us if we need to perform the same for all sub menus, or only
        ///   for the entries in the current level
        /// </param>
        public void setIndexes(bool drillDown)
        {
            int         Idx        = 0;
            IEnumerator iMenuEntry = iterator();

            while (iMenuEntry.MoveNext())
            {
                MenuEntry menuEntry = (MenuEntry)iMenuEntry.Current;
#if  !PocketPC
                menuEntry.setIndex(++Idx);
#else
                if (menuEntry.getVisible())
                {
                    menuEntry.setIndex(++Idx);
                }
                else
                {
                    menuEntry.setIndex(-1);
                }
#endif

                if (drillDown && menuEntry.menuType() == GuiMenuEntry.MenuType.MENU)
                {
                    ((MenuEntryMenu)menuEntry).setIndexes(drillDown);
                }
            }
        }
示例#3
0
文件: MenuEntry.cs 项目: rinavin/RCJS
        /// <summary>
        ///   Create/Delete menu item on visibility = true/false
        /// </summary>
        /// <param name = "visible">
        /// </param>
        /// <param name = "setPropOnly">-
        ///   only initialize the property - do not try to create\deleet the matching objects This should be
        ///   true when we initialize the menu entry object data through the
        /// </param>
        public void setVisible(bool visible, bool setPropOnly, bool pullDownMenu, TaskBase topMostTask,
                               MgFormBase sendForm)
        {
            bool prevState = _menuState.Visible;

            _menuState.Visible = visible;
            if (!pullDownMenu)
            {
                return;
            }

            if (!setPropOnly)
            {
                if (topMostTask == null || topMostTask.isMainProg())
                {
                    //eventTask can be null, if we are here from TP/TS of MP. In that case, topMostTask should MP.
                    TaskBase eventTask = (TaskBase)Events.GetCurrentTask();
                    if (eventTask != null)
                    {
                        topMostTask = eventTask;
                    }
                }

                MgFormBase formOrg = null;
                MgFormBase form    = null;
                if (sendForm == null)
                {
                    formOrg = topMostTask.getTopMostForm();
                    form    = topMostTask.getTopMostForm().getTopMostFrameForm();
                    // fixed bug#:773382, when there is no SDI\MDI need to get the corg form (for the context menu)
                    form = (form != null
                          ? form
                          : formOrg);
                }
                else
                {
                    formOrg = form = sendForm;
                }

                if (menuType() == MenuType.MENU)
                {
                    for (int i = 0;
                         i < ((MenuEntryMenu)this).subMenus.Count;
                         i++)
                    {
                        MenuEntry subMenuEntry = (((MenuEntryMenu)this).subMenus[i]);
                        // Refresh the submenu-entries, in order to show/hide the toolbar icons of submenus when Parent Menu is shown/hidden,
                        // call setVisible() for submenus.
                        subMenuEntry.setVisible(subMenuEntry.getVisible(), setPropOnly, pullDownMenu, topMostTask, sendForm);
                    }
                }

                if (visible)
                {
                    visible = CheckIfParentItemVisible(this);
                }

                ICollection mnuRefs = getInstantiatedMenus(form, true, true, true);
                addAllRefsToCmdQueue(mnuRefs, CommandType.PROP_SET_VISIBLE, visible);

                if (pullDownMenu)
                {
                    Commands.addAsync(CommandType.UPDATE_MENU_VISIBILITY, form);
                }
            }
        }