Example #1
0
        /// <summary>
        /// Add an object to this dropdown menu
        /// </summary>
        /// <param name="obj">GI_Obj to open upon clicking</param>
        /// <param name="title">Button title</param>
        public virtual void AddObject(GI_Obj obj, string title)
        {
            int width = _gameInterface.DropdownButtonWidth;
            int height = _gameInterface.DropdownButtonHeight;
            int x = _objs.Count * width;
            int y = Top;

            GI_DropdownButton button = new GI_DropdownButton(_gameInterface, _texture, width, height, x, y, title);
            _objs.Add(button);

            button.Clicked += obj.Open;
        }
Example #2
0
        /// <summary>
        /// Add a submenu to this dropdown menu
        /// </summary>
        /// <param name="submenu">Submenu to add</param>
        /// <param name="title">Button title</param>
        public void AddSubMenu(GI_DropdownSubmenu submenu, string title)
        {
            int width = _gameInterface.DropdownButtonWidth;
            int height = _gameInterface.DropdownButtonHeight;
            int x = _objs.Count * width;
            int y = Top;

            GI_DropdownButton button = new GI_DropdownButton(_gameInterface, _texture, width, height, x, y, title);
            _objs.Add(button);

            submenu.Visible = false;

            button.Clicked += delegate()
            {
                if (submenu.Visible)
                    submenu.Close();
                else
                {
                    if (_openSubmenu != null)
                        _openSubmenu.Close();

                    submenu.Open();
                    _openSubmenu = submenu;
                }
            };

            submenu.Position = new Vector2(
                button.Left,
                Bottom);
        }
Example #3
0
        public void AddButton(EventHandler clickEvent, string title)
        {
            int width = _gameInterface.DropdownButtonWidth;
            int height = _gameInterface.DropdownButtonHeight;
            int x = Left;
            int y = _objs.Count * height;

            GI_DropdownButton button = new GI_DropdownButton(_gameInterface, _texture, width, height, x, y, title);
            _objs.Add(button);

            button.Clicked += clickEvent;

            Size = new Vector2(
                Size.X,
                _objs.Count * height);
        }