コード例 #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(); };
        }
コード例 #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(); };
        }
コード例 #3
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();
                }
            }
            };
        }
コード例 #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();
                        }
                    }
                }
            };
        }