/// <summary> /// Adds a Menu item to the <see cref="T:Habanero.Faces.Base.IMenuItemCollection" />. /// </summary> /// <param name="menuItem"></param> public void Add(IMenuItem menuItem) { _list.Add(menuItem); ICollapsiblePanelGroupControl cpGroupMenuItem = _ownerMenuItem as ICollapsiblePanelGroupControl; if (cpGroupMenuItem != null && menuItem is CollapsibleSubMenuItemWin) { CollapsibleSubMenuItemWin outlookStyleSubMenuItem = (CollapsibleSubMenuItemWin)menuItem; cpGroupMenuItem.AddControl(outlookStyleSubMenuItem); return; } ICollapsiblePanel cpMenuItem = _ownerMenuItem as ICollapsiblePanel; if (cpMenuItem != null && menuItem is CollapsibleMenuItemWin) { if (cpMenuItem.ContentControl == null) { cpMenuItem.ContentControl = this.ControlFactory.CreatePanel(); _columnLayoutManager = new ColumnLayoutManager(cpMenuItem.ContentControl, this.ControlFactory); // this.ControlFactory.CreateBorderLayoutManager(cpMenuItem); _columnLayoutManager.HorizontalGapSize = 0; _columnLayoutManager.VerticalGapSize = 0; _columnLayoutManager.BorderSize = 0; } _columnLayoutManager.AddControl((CollapsibleMenuItemWin)menuItem); cpMenuItem.Height += ((CollapsibleMenuItemWin)menuItem).Height; cpMenuItem.ExpandedHeight = cpMenuItem.Height; } }
/// <summary> /// Builds a Menu for Win. /// </summary> /// <param name="habaneroMenu"></param> /// <returns></returns> protected virtual IMenuItem BuildMenu(HabaneroMenu habaneroMenu) { IMenuItem subMenuItem = new CollapsibleSubMenuItemWin(this.ControlFactory, habaneroMenu.Name); BuildSubMenu(habaneroMenu, subMenuItem.MenuItems); CreateLeafMenuItems(habaneroMenu, subMenuItem); return(subMenuItem); }