public MenuBase(string menuName) { MenuDropList = new DropDownMenu(menuName.ToUpper(), Direction.Down, pointSize: 10); MenuDropList.MenuItemsPadding = new BorderDouble(0); MenuDropList.Margin = new BorderDouble(0); MenuDropList.Padding = new BorderDouble(0); MenuDropList.DrawDirectionalArrow = false; MenuDropList.MenuAsWideAsItems = false; menuItems = GetMenuItems(); BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 6, 8, 6) * TextWidget.GlobalPointSizeScaleRatio; MenuDropList.AddItem(item.Item1, pointSize: 11); } MenuDropList.Padding = padding; AddChild(MenuDropList); this.Width = GetChildrenBoundsIncludingMargins().Width; this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); this.MenuDropList.OpenOffset = new Vector2(0, 0); }
void SetMenuItems() { menuItems = new TupleList <string, Func <bool> > { { LocalizedString.Get("Add File"), importFile_Click }, { LocalizedString.Get("Exit"), exit_Click }, }; BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4); MenuDropList.AddItem(item.Item1, pointSize: 10); } MenuDropList.Padding = padding; }
public SplitButton Generate(TupleList <string, Func <bool> > buttonList, Direction direction = Direction.Down, string imageName = null) { this.imageName = imageName; DynamicDropDownMenu menu = CreateMenu(direction); menu.Margin = new BorderDouble(); Button button = CreateButton(buttonList [0]); for (int index = 1; index < buttonList.Count; index++) { menu.addItem(buttonList[index].Item1, buttonList[index].Item2); } SplitButton splitButton = new SplitButton(button, menu); return(splitButton); }
void SetMenuItems() { menuItems = new TupleList <string, Func <bool> > { { LocalizedString.Get("Getting Started"), gettingStarted_Click }, { LocalizedString.Get("View Help"), help_Click }, { LocalizedString.Get("About"), about_Click }, }; BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4); MenuDropList.AddItem(item.Item1, pointSize: 10); } MenuDropList.Padding = padding; }
void SetMenuItems() { menuItems = new TupleList <string, Func <bool> > { { LocalizedString.Get("Layout 1"), layout1_Click }, { LocalizedString.Get("Layout 2"), layout2_Click }, //{LocalizedString.Get("Layout 3"), layout3_Click}, }; BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4) * TextWidget.GlobalPointSizeScaleRatio; MenuDropList.AddItem(item.Item1, pointSize: 10); } MenuDropList.Padding = padding; }
void SetMenuItems() { string importTxt = new LocalizedString("Import").Translated; string importTxtFull = string.Format("{0}", importTxt); string exportTxt = new LocalizedString("Export").Translated; string exportTxtFull = string.Format("{0}", exportTxt); //Set the name and callback function of the menu items slicerOptionsMenuItems = new TupleList <string, Func <bool> > { { importTxtFull, ImportQueueMenu_Click }, { exportTxtFull, ExportQueueMenu_Click }, }; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in slicerOptionsMenuItems) { SliceOptionsMenuDropList.AddItem(item.Item1); } }
void SetMenuItems() { menuItems = new TupleList <string, Func <bool> > { { LocalizedString.Get("Getting Started"), gettingStarted_Click }, { LocalizedString.Get("View Help"), help_Click }, { LocalizedString.Get("Report a Bug"), bug_Click }, { LocalizedString.Get("Release Notes"), notes_Click }, { LocalizedString.Get("About MatterControl"), about_Click }, }; BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4) * TextWidget.GlobalPointSizeScaleRatio; MenuDropList.AddItem(item.Item1, pointSize: 10); } MenuDropList.Padding = padding; }
public DynamicDropDownMenu Generate(string label = "", TupleList <string, Func <bool> > optionList = null, Direction direction = Direction.Down) { DynamicDropDownMenu menu = new DynamicDropDownMenu(label, CreateButtonViewStates(label), direction); menu.VAnchor = VAnchor.ParentCenter; menu.HAnchor = HAnchor.FitToChildren; menu.MenuAsWideAsItems = false; menu.AlignToRightEdge = true; menu.NormalColor = normalFillColor; menu.HoverColor = hoverFillColor; menu.BorderColor = normalBorderColor; menu.BackgroundColor = menu.NormalColor; if (optionList != null) { foreach (Tuple <string, Func <bool> > option in optionList) { menu.addItem(option.Item1, option.Item2); } } return(menu); }