예제 #1
0
        /** <summary> Constructs a menu item with the specified text, action, and hotkey. </summary> */
        public DebugMenuItem(string text, HotKey hotkey, MenuItemAction action)
        {
            this.root			= null;

            this.text			= text;
            this.index			= 0;
            this.hotkey			= hotkey ?? new HotKey();
            this.action			= action;
            this.items			= new List<DebugMenuItem>();
        }
예제 #2
0
        /** <summary> Constructs a menu item with the specified text. </summary> */
        public DebugMenuItem(string text)
        {
            this.root			= null;

            this.text			= text;
            this.index			= 0;
            this.hotkey			= new HotKey();
            this.action			= null;
            this.items			= new List<DebugMenuItem>();
        }
예제 #3
0
        // ================== CONSTRUCTORS ================== //
        public ToggleMenuItem(string text, HotKey hotkey, bool startsEnabled, MenuItemToggleAction toggleAction,
			MenuItemAction enableAction, MenuItemAction disableAction)
            : base(text, hotkey, null)
        {
            this.isEnabled     = startsEnabled;
            this.toggleAction  = toggleAction;
            this.enableAction  = enableAction;
            this.disableAction = disableAction;

            Action = delegate() { Toggle(); };
        }
        // ================== CONSTRUCTORS ================== //
        public RadioButtonMenuItem(string text, HotKey hotkey, RadioButtonGroup group, bool startsEnabled, MenuItemToggleAction toggleAction,
		MenuItemAction enableAction, MenuItemAction disableAction)
            : base(text, hotkey, startsEnabled, toggleAction, enableAction, disableAction)
        {
            this.group = group;
            group.Items.Add(this);

            Action = delegate() {
            if (!IsEnabled) {
                Enable();

                for (int i = 0; i < group.Items.Count; ++i) {
                    if (group.Items[i] != this && group.Items[i].IsEnabled)
                        group.Items[i].Disable();
                }
            }
            };
        }
예제 #5
0
 /** <summary> Adds the specified menu item to the list of menu items. </summary> */
 public DebugMenuItem AddItem(string text, HotKey hotkey, MenuItemAction action)
 {
     return AddItem(new DebugMenuItem(text, hotkey, action));
 }