/** <summary> Constructs the default hotkey. </summary> */ public HotKey() { this.KeyCode = Keys.None; this.Ctrl = false; this.Shift = false; this.Alt = false; }
/** <summary> Constructs a hotkey with the specified modifiers. </summary> */ public HotKey(Keys keyCode, bool ctrl = false, bool shift = false, bool alt = false) { this.KeyCode = keyCode; this.Ctrl = ctrl; this.Shift = shift; this.Alt = alt; }
//========= CONSTRUCTORS ========= #region Constructors /** <summary> Constructs the default hotkey. </summary> */ public HotKey() { this.KeyCode = Keys.None; this.Ctrl = false; this.Shift = false; this.Alt = false; }
public Key(Keys keyCode) { this.KeyCode = keyCode; }
/** <summary> Updates the debug menu with keyboard controls. </summary> */ private void UpdateKeyboardControls() { Keys keyNextItem = Keys.Down; Keys keyPrevItem = Keys.Up; Keys keyStepInto = Keys.Right; Keys keyStepOut = Keys.Left; if (currentItem.Root.Root == null) { keyNextItem = Keys.Right; keyPrevItem = Keys.Left; keyStepInto = Keys.Down; keyStepOut = Keys.Up; } // Select next root menu item. if (Keyboard.IsKeyPressed(Keys.Right) && currentItem.Items.Count == 0 && CurrentMenu != menu) { int index = currentPath[0]; currentItem = menu.Items[index]; currentPath.Clear(); currentPath.Add(index); SelectNextItem(); StepIntoSubMenu(); } // Step into a sub-menu. else if (Keyboard.IsKeyPressed(keyStepInto)) { StepIntoSubMenu(); } // Select previous root menu item. if (Keyboard.IsKeyPressed(Keys.Left) && CurrentMenu.Root == menu) { currentItem = CurrentMenu; currentPath.RemoveAt(currentPath.Count - 1); SelectPreviousItem(); StepIntoSubMenu(); } // Step out of a sub-menu. else if (Keyboard.IsKeyPressed(keyStepOut)) { StepOutOfSubMenu(); } // Select next item. if (Keyboard.IsKeyPressed(keyNextItem)) { SelectNextItem(); } // Select previous item. if (Keyboard.IsKeyPressed(keyPrevItem)) { SelectPreviousItem(); } // Step out of a sub-menu. if (Keyboard.IsKeyPressed(Keys.X) || Keyboard.IsKeyPressed(Keys.Escape)) { StepOutOfSubMenu(); } // Press item. if (Keyboard.IsKeyPressed(Keys.Enter) || Keyboard.IsKeyPressed(Keys.Z) || Keyboard.IsKeyPressed(Keys.Space)) { if (currentItem.Items.Count == 0) { currentItem.Press(); if (!Keyboard.IsKeyPressed(Keys.Space)) { Close(); } } else { StepIntoSubMenu(); } } }