internal MenuEnableData(MenuItem menuItemToChange, bool multipleItems, bool protectedItems, bool collectionItems, bool shareItems = false) { this.menuItemToChange = menuItemToChange; this.multipleItems = multipleItems; this.protectedItems = protectedItems; this.collectionItems = collectionItems; this.shareItems = shareItems; }
private void AddMenu(Menu listMenuToAddTo, string name) { GuiWidget normal = new TextWidget(name); normal.BackgroundColor = RGBA_Bytes.White; GuiWidget hover = new TextWidget(name); hover.BackgroundColor = RGBA_Bytes.LightGray; MenuItem menuItem = new MenuItem(new MenuItemStatesView(normal, hover)); menuItem.Selected += (sender, e) => { lastAction.Text = name; }; listMenuToAddTo.MenuItems.Add(menuItem); }
public MenuItem AddItem(string name, string value = null) { if (value == null) { value = name; } mainControlText.Margin = MenuItemsPadding; GuiWidget normalTextWithMargin = new GuiWidget(); normalTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren; normalTextWithMargin.VAnchor = UI.VAnchor.FitToChildren; normalTextWithMargin.BackgroundColor = MenuItemsBackgroundColor; TextWidget normal = new TextWidget(name); normal.Margin = MenuItemsPadding; normal.TextColor = MenuItemsTextColor; normalTextWithMargin.AddChild(normal); GuiWidget hoverTextWithMargin = new GuiWidget(); hoverTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren; hoverTextWithMargin.VAnchor = UI.VAnchor.FitToChildren; hoverTextWithMargin.BackgroundColor = MenuItemsBackgroundHoverColor; TextWidget hover = new TextWidget(name); hover.Margin = MenuItemsPadding; hover.TextColor = MenuItemsTextHoverColor; hoverTextWithMargin.AddChild(hover); MenuItem menuItem = new MenuItem(new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), value); menuItem.Text = name; MenuItems.Add(menuItem); return menuItem; }
public void AddItem(string name, string value = null, double pointSize = 12) { if (value == null) { value = name; } if (mainControlText.Text != "") { mainControlText.Margin = MenuItemsPadding; } GuiWidget normalTextWithMargin = new GuiWidget(); normalTextWithMargin.HAnchor = HAnchor.FitToChildren; normalTextWithMargin.BackgroundColor = MenuItemsBackgroundColor; TextWidget normal = new TextWidget(name, pointSize: pointSize); normal.Margin = MenuItemsPadding; normal.TextColor = MenuItemsTextColor; normalTextWithMargin.AddChild(normal); normalTextWithMargin.VAnchor = VAnchor.FitToChildren; GuiWidget hoverTextWithMargin = new GuiWidget(); hoverTextWithMargin.HAnchor = HAnchor.FitToChildren; hoverTextWithMargin.BackgroundColor = MenuItemsBackgroundHoverColor; TextWidget hover = new TextWidget(name, pointSize: pointSize); hover.Margin = MenuItemsPadding; hover.TextColor = mainControlText.TextColor; hoverTextWithMargin.AddChild(hover); hoverTextWithMargin.VAnchor = VAnchor.FitToChildren; MenuItem menuItem = new MenuItem(new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), value); menuItem.Text = name; menuItem.Name = name + " Menu Item"; MenuItems.Add(menuItem); }
public MenuItem AddItem(string itemName, string itemValue = null) { mainControlText.Margin = MenuItemsPadding; GuiWidget normalTextWithMargin = new GuiWidget(); normalTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren; normalTextWithMargin.VAnchor = UI.VAnchor.FitToChildren; normalTextWithMargin.BackgroundColor = MenuItemsBackgroundColor; TextWidget normal = new TextWidget(itemName); normal.Margin = MenuItemsPadding; normal.TextColor = MenuItemsTextColor; normalTextWithMargin.AddChild(normal); GuiWidget hoverTextWithMargin = new GuiWidget(); hoverTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren; hoverTextWithMargin.VAnchor = UI.VAnchor.FitToChildren; hoverTextWithMargin.BackgroundColor = MenuItemsBackgroundHoverColor; TextWidget hover = new TextWidget(itemName); hover.Margin = MenuItemsPadding; hover.TextColor = MenuItemsTextHoverColor; hoverTextWithMargin.AddChild(hover); MenuItem menuItem = new MenuItem( new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), // If no itemValue is supplied, itemName will be used as the item value itemValue ?? itemName); menuItem.Name = itemName + " Menu Item"; menuItem.Text = itemName; MenuItems.Add(menuItem); return menuItem; }
private void AddMenu(Menu listMenuToAddTo, string name) { GuiWidget normal = new TextWidget("-" + name); normal.HAnchor = Agg.UI.HAnchor.ParentLeftRight; normal.BackgroundColor = RGBA_Bytes.White; GuiWidget hover = new TextWidget("-" + name); hover.HAnchor = Agg.UI.HAnchor.ParentLeftRight; hover.BackgroundColor = RGBA_Bytes.LightGray; MenuItem menuItem = new MenuItem(new MenuItemStatesView(normal, hover)); menuItem.HAnchor = Agg.UI.HAnchor.ParentLeftRight; listMenuToAddTo.MenuItems.Add(menuItem); }
public MenuItem AddItem(string name, string value = null, double pointSize = 12) { if (value == null) { value = name; } if (mainControlWidget.Text != "") { mainControlWidget.Margin = MenuItemsPadding; } //MenuItem menuItem = new MenuItem(new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), value); MenuItem menuItem = new MenuItem(new MenuItemColorStatesView(name) { NormalBackgroundColor = MenuItemsBackgroundColor, OverBackgroundColor = MenuItemsBackgroundHoverColor, NormalTextColor = MenuItemsTextColor, OverTextColor = MenuItemsTextHoverColor, DisabledTextColor = RGBA_Bytes.Gray, PointSize = pointSize, Padding = MenuItemsPadding, }, value); menuItem.Text = name; menuItem.Name = name + " Menu Item"; MenuItems.Add(menuItem); return menuItem; }