/// <summary> /// Adds a new menu item. /// </summary> /// <param name="text">Item text.</param> /// <param name="iconName">Icon texture name.</param> /// <param name="accelerator">Accelerator for this item.</param> /// <returns>Newly created control.</returns> public virtual MenuItem AddItem(String text, String iconName, String accelerator = "") { MenuItem item = new MenuItem(this); item.Padding = Padding.Four; item.SetText(text); item.SetImage(iconName); item.SetAccelerator(accelerator); OnAddItem(item); return(item); }
public MenuItem AddItemPath(string text, string iconName, string accelerator = null) { var item = new MenuItem(this); item.Text = text; item.Padding = Padding.Three; if (!String.IsNullOrWhiteSpace(iconName)) { item.SetImage(iconName, ImageAlign.Left | ImageAlign.CenterV); } if (!String.IsNullOrWhiteSpace(accelerator)) { item.SetAccelerator(accelerator); } AddItemPath(item); return(item); }
/// <summary> /// Adds a new menu item. /// </summary> /// <param name="text">Item text.</param> /// <param name="iconName">Icon texture name.</param> /// <param name="accelerator">Accelerator for this item.</param> /// <returns>Newly created control.</returns> public virtual MenuItem AddItem(string text, string iconName, string accelerator = "") { MenuItem item = new MenuItem(this); item.Padding = Padding.Four; item.SetText(text); item.SetImage(iconName); item.SetAccelerator(accelerator); OnAddItem(item); return item; }