Menu item.
상속: Button
예제 #1
0
파일: MenuBar.cs 프로젝트: tritao/flood
        private void BuildSubmenu(SubmenuNode menu, MenuItem menuControl)
        {
            foreach (var menuChild in menu.ChildNodes)
            {
                var menuItem = menuChild as MenuItemNode;
                if(menuItem != null)
                {
                    menuControl.Menu.AddItem(menuItem.Label);
                    continue;
                }

                var submenu = menuChild as SubmenuNode;
                if (submenu != null)
                {
                    //menuControl.
                    //BuildSubmenu(submenu);
                    continue;
                }

                if (menuChild is MenuSeparatorNode)
                {
                     menuControl.Menu.AddDivider();
                    continue;
                }

                throw new NotImplementedException();
            }
        }
예제 #2
0
파일: MenuStrip.cs 프로젝트: tritao/flood
 /// <summary>
 /// Add item handler.
 /// </summary>
 /// <param name="item">Item added.</param>
 protected override void OnAddItem(MenuItem item)
 {
     item.Dock = Pos.Left;
     item.TextPadding = new Padding(5, 0, 5, 0);
     item.Padding = new Padding(10, 0, 10, 0);
     item.SizeToContents();
     item.IsOnStrip = true;
     item.HoverEnter += OnHoverItem;
 }
예제 #3
0
파일: ComboBox.cs 프로젝트: chartly/flood
        /// <summary>
        /// Internal handler for item selected event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnItemSelected(Control control)
        {
            //Convert selected to a menu item
            MenuItem item = control as MenuItem;
            if (null == item) return;

            m_SelectedItem = item;
            Text = m_SelectedItem.Text;
            m_Menu.IsHidden = true;

            if (ItemSelected != null)
                ItemSelected.Invoke(this);

            Focus();
            Invalidate();
        }
예제 #4
0
파일: Menu.cs 프로젝트: tritao/flood
        /// <summary>
        /// Adds a new menu item.
        /// </summary>
        /// <param name="text">Item text.</param>
        /// <param name="iconName">Icon texture name.</param>
        /// <param name="accelerator">Accelerator for this item.</param>
        /// <returns>Newly created control.</returns>
        public virtual MenuItem AddItem(String text, String iconName, String accelerator = "")
        {
            MenuItem item = new MenuItem(this);
            item.Padding = Padding.Four;
            item.SetText(text);
            item.SetImage(iconName);
            item.SetAccelerator(accelerator);

            OnAddItem(item);

            return item;
        }
예제 #5
0
파일: Menu.cs 프로젝트: tritao/flood
        /// <summary>
        /// Add item handler.
        /// </summary>
        /// <param name="item">Item added.</param>
        protected virtual void OnAddItem(MenuItem item)
        {
            item.TextPadding = new Padding(IconMarginDisabled ? 0 : 24, 0, 16, 0);
            item.Dock = Pos.Top;
            item.SizeToContents();
            item.Alignment = Pos.CenterV | Pos.Left;
            item.HoverEnter += OnHoverItem;

            // Do this here - after Top Docking these values mean nothing in layout
            int w = item.Width + 10 + 32;
            if (w < Width) w = Width;
            SetSize(w, Height);
        }