Example #1
0
 //***************************************************************************
 // Class Constructors
 //
 protected DynamicMenuChildControl(DynamicMenuItem item, Style itemStyle, Style activeStyle, Style hoverStyle)
 {
     this._menuItem       = item;
     this._itemStyle      = itemStyle;
     this._aciveItemStyle = activeStyle;
     this._hoverItemStyle = hoverStyle;
 }
Example #2
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            for (int i = 0; i < this._menuItems.Count; i++)
            {
                DynamicMenuItem item = this._menuItems[i];

                DynamicMenuPopoutItem ctrl = new DynamicMenuPopoutItem(item, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                ctrl.SelectorMode       = this._selectorMode;
                ctrl.ParentGroup        = this;
                ctrl.MenuItemClicked   += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                this.Controls.Add(ctrl);

                if (item.MenuItems.Count > 0)
                {
                    DynamicMenuPopoutGroup ctrlGrp = new DynamicMenuPopoutGroup(item.MenuItems, this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                    ctrlGrp.SelectorMode       = this._selectorMode;
                    ctrlGrp._isSubMenu         = true;
                    ctrlGrp.MenuItemClicked   += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                    ctrlGrp.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                    this.Controls.Add(ctrlGrp);
                    this._assocDivs.Add(ctrlGrp.ClientID, item.MenuItemProviderKey.ToString());
                }

                this.Controls.Add(ctrl);
            }
        }
Example #3
0
        protected override void CreateChildControls()
        {
            DynamicMenuItem item = this._menuItem;

            Control lnk     = null;
            string  ctrlID  = "lnkMenuItem_" + item.MenuItemProviderKey.ToString();
            string  cmdName = (this.SelectorMode) ? "Select" : item.CommandName;

            if (string.IsNullOrEmpty(cmdName) || !string.IsNullOrEmpty(item.Target))
            {
                HyperLink lnkHref = new HyperLink();
                lnkHref.ID          = ctrlID;
                lnkHref.NavigateUrl = item.NavigationUrl;
                if (!string.IsNullOrEmpty(item.Target))
                {
                    lnkHref.Target = item.Target;
                }
                lnk = lnkHref;
            }
            else if (!string.IsNullOrEmpty(item.CommandName))
            {
                if (!string.IsNullOrEmpty(item.Target))
                {
                    throw new Exception("Cannot specify a DynamicMenuItem.Target value when using a command name or argument.");
                }

                LinkButton lnkBtn = new LinkButton();
                lnkBtn.ID          = ctrlID;
                lnkBtn.CommandName = item.CommandName;
                if (item.MenuItemProviderKey != null)
                {
                    lnkBtn.CommandArgument = item.MenuItemProviderKey.ToString();
                }
                lnkBtn.Command += new CommandEventHandler(lnkBtn_Command);
                lnk             = lnkBtn;
            }

            if (!string.IsNullOrEmpty(item.ImageUrl))
            {
                Image img = new Image();
                img.ID       = "imgIcon";
                img.ImageUrl = item.ImageUrl;
                img.GenerateEmptyAlternateText = true;
                lnk.Controls.Add(img);
            }

            LiteralControl txt = new LiteralControl();

            txt.Text = "<br/>" + item.Text;
            lnk.Controls.Add(txt);

            this._lnkBtn = lnk;
            this.Controls.Add(lnk);

            base.CreateChildControls();
        }
Example #4
0
        protected override void CreateChildControls()
        {
            DynamicMenuItem item = this._menuItem;

            for (int i = 0; i < item.MenuItems.Count; i++)
            {
                DynamicMenuIcon ctrl = new DynamicMenuIcon(item.MenuItems[i], this._itemStyle, this._aciveItemStyle, this._hoverItemStyle);
                ctrl.SelectorMode       = this._selectorMode;
                ctrl.MenuItemClicked   += new DynamicMenuEventHandler(ctrl_MenuItemClicked);
                ctrl.MenuItemRendering += new DynamicMenuItemRenderingEventHandler(ctrl_MenuItemRendering);
                this.Controls.Add(ctrl);
            }
            base.CreateChildControls();
        }
Example #5
0
        //***************************************************************************
        // Event Handlers
        //
        private void lnk_Command(object sender, CommandEventArgs e)
        {
            if (this._menuItem.MenuItems.Count > 0 && this._autoActivate)
            {
                DynamicMenuItem item = this._menuItem;
                item.Activated = !item.Activated;
                this.ParentGroup.MenuItems[item.MenuItemProviderKey.ToString()] = item;
                this.ParentGroup.ShowSubMenu(item.MenuItemProviderKey);
            }

            else
            {
                this.OnMenuItemClicked(new DynamicMenuEventArgs(this._menuItem, e, DynamicMenuItemControlType.DynamicMenuPopoutItem));
            }
        }
Example #6
0
 public DynamicMenuItemRenderingEventArgs(DynamicMenuItem item, CommandEventArgs args, DynamicMenuItemControlType type)
     : base(item, args, type)
 {
 }
Example #7
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicMenuItemRenderingEventArgs(DynamicMenuItem item, DynamicMenuItemControlType type)
     : base(item, type)
 {
 }
Example #8
0
 public DynamicMenuEventArgs(DynamicMenuItem item, CommandEventArgs args, DynamicMenuItemControlType type)
     : this(item, type)
 {
     this.CommandArgs = args;
 }
Example #9
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicMenuEventArgs(DynamicMenuItem item, DynamicMenuItemControlType type)
 {
     this.Item        = item;
     this.ControlType = type;
 }
Example #10
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            DynamicMenuItem item = this._menuItem;

            Control lnkItem = null;
            string  lnkID   = "lnkMenuItem_" + item.MenuItemProviderKey.ToString();

            string cmdName = (this._selectorMode && item.MenuItems.Count == 0) ? "Select" : item.CommandName;

            if (!this._selectorMode && (item.MenuItems.Count > 0 || string.IsNullOrEmpty(cmdName)))
            {
                if (item.MenuItems.Count > 0 && (!string.IsNullOrEmpty(item.NavigationUrl) || !string.IsNullOrEmpty(cmdName)))
                {
                    throw new Exception("You cannot specify a navigation URL or command name for a popout menu item that has children.");
                }

                HyperLink lnk = new HyperLink();
                if (item.MenuItems.Count == 0)
                {
                    if (!string.IsNullOrEmpty(item.Target))
                    {
                        lnk.Target = item.Target;
                    }
                    lnk.NavigateUrl = item.NavigationUrl;
                }
                if (string.IsNullOrEmpty(item.ImageUrl))
                {
                    lnk.Text = item.Text;
                }
                lnkItem = lnk;
            }
            else
            {
                if (!string.IsNullOrEmpty(item.Target) && !this._selectorMode)
                {
                    throw new Exception("You cannot specify a target and a command name for a menu item.");
                }

                LinkButton lnk = new LinkButton();
                lnk.CommandName     = item.CommandName;
                lnk.CommandArgument = item.MenuItemProviderKey.ToString();
                lnk.Command        += new CommandEventHandler(lnk_Command);
                if (string.IsNullOrEmpty(item.ImageUrl))
                {
                    lnk.Text = item.Text;
                }
                lnkItem = lnk;
            }

            lnkItem.ID = lnkID;
            if (!string.IsNullOrEmpty(item.ImageUrl))
            {
                Image img = new Image();
                img.ID         = "menuItemImg_" + item.MenuItemProviderKey.ToString();
                img.ImageUrl   = item.ImageUrl;
                img.ImageAlign = ImageAlign.Middle;
                lnkItem.Controls.Add(img);
                LiteralControl txt = new LiteralControl(item.Text);
                lnkItem.Controls.Add(txt);
            }

            this.Controls.Add(lnkItem);
            this._btn = lnkItem;
        }
Example #11
0
 public DynamicMenuPopoutItem(DynamicMenuItem item, Style itemStyle, Style activeStyle, Style hoverStyle, bool autoActivate)
     : this(item, itemStyle, activeStyle, hoverStyle)
 {
     this._autoActivate = autoActivate;
 }
Example #12
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicMenuPopoutItem(DynamicMenuItem item, Style itemStyle, Style activeStyle, Style hoverStyle)
     : base(item, itemStyle, activeStyle, hoverStyle)
 {
 }
Example #13
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicMenuIconGroup(DynamicMenuItem item, Style itemStyle, Style activeStyle, Style hoverStyle)
     : base(item, itemStyle, activeStyle, hoverStyle)
 {
 }
Example #14
0
 //***************************************************************************
 // Class Constructors
 //
 public DynamicMenuIcon(DynamicMenuItem item, Style itemStyle, Style activeItemStyle, Style hoverItemStyle)
     : base(item, itemStyle, activeItemStyle, hoverItemStyle)
 {
 }