// ================== 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(); } } }; }
// ================== 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(); } } } }; }