Convert FlowLayouts to new PopupMenu, consolidate MenuItem helpers

This commit is contained in:
John Lewin 2017-11-09 18:26:32 -08:00
parent 29024281e9
commit 3944d37ad5
8 changed files with 156 additions and 110 deletions

View file

@ -823,7 +823,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
// Defer creating menu items until plugins have loaded
CreateMenuActions();
var popupContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
var popupMenu = new PopupMenu();
// Create menu items in the DropList for each element in this.menuActions
foreach (var menuAction in menuActions)
@ -832,11 +832,11 @@ namespace MatterHackers.MatterControl.PrintLibrary
if (menuAction is MenuSeparator)
{
menuItem = OverflowMenu.CreateHorizontalLine();
menuItem = popupMenu.CreateHorizontalLine();
}
else
{
menuItem = OverflowMenu.CreateMenuItem((string)menuAction.Title);
menuItem = popupMenu.CreateMenuItem((string)menuAction.Title);
menuItem.Name = $"{menuAction.Title} Menu Item";
}
@ -849,13 +849,11 @@ namespace MatterHackers.MatterControl.PrintLibrary
// Store a reference to the newly created MenuItem back on the MenuAction definition
menuAction.MenuItem = menuItem;
popupContainer.AddChild(menuItem);
}
EnableMenus();
overflowMenu.PopupContent = popupContainer;
overflowMenu.PopupContent = popupMenu;
base.OnLoad(args);
}