Exemplo n.º 1
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(); };
        }
Exemplo n.º 2
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();
                }
            }
            };
        }
Exemplo n.º 4
0
        // ================== 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();
                        }
                    }
                }
            };
        }