diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs index 5bac1ff279..9a0a69b78d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/Command.cs @@ -95,10 +95,39 @@ namespace MonoDevelop.Components.Commands KeyBindingChanged (this, new KeyBindingChangedEventArgs (this, oldKeyBinding)); } } - + + string[] alternateAccelKeys; + KeyBinding[] alternateKeyBindings; + static readonly KeyBinding[] emptyBindings = new KeyBinding[0]; + + public string[] AlternateAccelKeys { + get { return alternateAccelKeys; } + set { + var oldKeybindings = alternateKeyBindings; + if (value == null || value.Length == 0) { + alternateKeyBindings = null; + } else { + alternateKeyBindings = new KeyBinding[value.Length]; + for (int i = 0; i < value.Length; i++) { + KeyBinding b; + KeyBinding.TryParse (value[i], out b); + alternateKeyBindings [i] = b; + } + } + alternateAccelKeys = value; + if (AlternateKeyBindingChanged != null) + AlternateKeyBindingChanged (this, new AlternateKeyBindingChangedEventArgs (this, oldKeybindings)); + } + } + public KeyBinding KeyBinding { get { return binding; } } + + public KeyBinding[] AlternateKeyBindings { + get { return alternateKeyBindings ?? emptyBindings; } + } + public bool DisabledVisible { get { return disabledVisible; } @@ -116,26 +145,49 @@ namespace MonoDevelop.Components.Commands } public event KeyBindingChangedEventHandler KeyBindingChanged; + public event EventHandler<AlternateKeyBindingChangedEventArgs> AlternateKeyBindingChanged; } - public class KeyBindingChangedEventArgs { + public class KeyBindingChangedEventArgs : EventArgs + { public KeyBindingChangedEventArgs (Command command, KeyBinding oldKeyBinding) { OldKeyBinding = oldKeyBinding; Command = command; } - + public Command Command { get; private set; } - + public KeyBinding OldKeyBinding { get; private set; } - + public KeyBinding NewKeyBinding { get { return Command.KeyBinding; } } } + + public class AlternateKeyBindingChangedEventArgs : EventArgs + { + public AlternateKeyBindingChangedEventArgs (Command command, KeyBinding[] oldKeyBinding) + { + OldKeyBinding = oldKeyBinding; + Command = command; + } + + public Command Command { + get; private set; + } + + public KeyBinding[] OldKeyBinding { + get; private set; + } + + public KeyBinding[] NewKeyBinding { + get { return Command.AlternateKeyBindings; } + } + } } |