public ContextMenuItem(ContextMenuItemEntry entry) { CanCloseWithRightClick = false; _entry = entry; _label = new Label(entry.Text, true, 1150, 0, style: FontStyle.BlackBorder) { X = 10, }; Add(_label); if (entry.CanBeSelected) { _selectedPic = new GumpPic(0, 0, 0x838, 0); _selectedPic.IsVisible = entry.IsSelected; Add(_selectedPic); } Height = 25; _label.Y = (Height >> 1) - (_label.Height >> 1); if (_selectedPic != null) { _label.X = _selectedPic.X + _selectedPic.Width + 6; _selectedPic.Y = (Height >> 1) - (_selectedPic.Height >> 1); } Width = _label.X + _label.Width + 3; WantUpdateSize = false; }
public ContextMenuItem(ContextMenuShowMenu parent, ContextMenuItemEntry entry) { CanCloseWithRightClick = false; _entry = entry; _label = new Label(entry.Text, true, 1150, 0, style: FontStyle.BlackBorder) { X = 25 }; Add(_label); if (entry.CanBeSelected) { _selectedPic = new GumpPic(3, 0, 0x838, 0) { IsVisible = entry.IsSelected, IsEnabled = false }; Add(_selectedPic); } Height = 25; _label.Y = (Height >> 1) - (_label.Height >> 1); if (_selectedPic != null) { //_label.X = _selectedPic.X + _selectedPic.Width + 6; _selectedPic.Y = (Height >> 1) - (_selectedPic.Height >> 1); } Width = _label.X + _label.Width + 20; if (Width < 100) { Width = 100; } // it is a bit tricky, but works :D if (_entry.Items != null && _entry.Items.Count != 0) { _subMenu = new ContextMenuShowMenu(_entry.Items); parent.Add(_subMenu); if (parent._subMenus == null) { parent._subMenus = new List <ContextMenuShowMenu>(); } parent._subMenus.Add(_subMenu); } WantUpdateSize = false; }
public void Add(ContextMenuItemEntry entry) { _items.Add(entry); }
public void Add(ContextMenuItemEntry subEntry) { Items.Add(subEntry); }