예제 #1
0
        internal MenuItem Add(SeparatorMenuItem item)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(nameof(Menu));
            }

            _itemList.Add(item);
            MenusAPI.AppendMenuSeparator(_menuId);
            _lists.Add(item, this);
            return(item);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }