internal MenuItem Add(SeparatorMenuItem item) { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } _itemList.Add(item); MenusAPI.AppendMenuSeparator(_menuId); _lists.Add(item, this); return(item); }
internal unsafe MenuItem Add(NormalMenuItem item) { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } _itemList.Add(item); MenusAPI.AppendMenuItem(_menuId, item.Name, (void *)item.UniqueId, 0); _lists.Add(item, this); return(item); }
internal MenuItem Add(NormalMenuItem item, CommandRef commandRef) { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } _itemList.Add(item); MenusAPI.AppendMenuItemWithCommand(_menuId, item.Name, commandRef); _lists.Add(item, this); return(item); }
internal void RemoveAt(int index) { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } var item = _itemList[index]; item.Dispose(); _lists.Remove(item); MenusAPI.RemoveMenuItem(_menuId, index); _itemList.RemoveAt(index); }
internal void Clear() { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } foreach (var item in _itemList) { item.Dispose(); _lists.Remove(item); } _itemList.Clear(); MenusAPI.ClearAllMenuItems(_menuId); }