示例#1
0
 private void checkKeyAction(Keyboard.Key key, Action action)
 {
     if (Keyboard.IsKeyPressed(key))
     {
         action();
     }
 }
示例#2
0
        public void Window_KeyPressedTest(Keyboard.Key key)
        {
            var game = new PrivateObject(_game, new PrivateType(typeof(Game)));

            var isPausedOld = (bool)game.GetField("isPaused");

            game.Invoke(
                "Window_KeyPressed",
                new object(),
                new KeyEventArgs(new KeyEvent
            {
                Code = key
            })
                );

            var isPausedNew = (bool)game.GetField("isPaused");

            if (key == Keyboard.Key.Escape)
            {
                Assert.IsTrue(isPausedOld != isPausedNew);
            }
            else
            {
                Assert.IsTrue(isPausedOld == isPausedNew);
            }
        }
示例#3
0
 private void checkToggleAction(Keyboard.Key key, Action action)
 {
     if (checkToggle(key))
     {
         action();
     }
 }
示例#4
0
 /// <summary>
 /// Allows keys to be passed to the view that the mouse is over.
 /// </summary>
 /// <param name="k"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public static void InjectKey(Keyboard.Key k, int x, int y)
 {
     if (Tabs.Count == 0)
     {
         return;
     }
     foreach (BrowserTab t in Tabs)
     {
         if (t.MouseOver(x, y) && t.KeyEvents)
         {
             Console.WriteLine("Sending " + k.ToString() + " to " + t.ID);
             WebCore.QueueWork(t.MyTab, () =>
             {
                 if (k != Keyboard.Key.F5)
                 {
                     WebKeyboardEvent keyboardEvent = new WebKeyboardEvent();
                     keyboardEvent.Text             = k.ToString();
                     keyboardEvent.Type             = WebKeyboardEventType.Char;
                     t.MyTab.InjectKeyboardEvent(keyboardEvent);
                 }
                 else
                 {
                     Console.WriteLine("Refreshing tab...");
                     t.MyTab.Source = new Uri(t.url);
                 }
             });
             return;
         }
     }
 }
示例#5
0
            private void EmitKeyEvent(Keyboard.Key key, InputAction action, KeyModifiers mods, int scanCode)
            {
                var shift   = (mods & KeyModifiers.Shift) != 0;
                var alt     = (mods & KeyModifiers.Alt) != 0;
                var control = (mods & KeyModifiers.Control) != 0;
                var system  = (mods & KeyModifiers.Super) != 0;

                var ev = new KeyEventArgs(
                    key,
                    action == InputAction.Repeat,
                    alt, control, shift, system,
                    scanCode);

                switch (action)
                {
                case InputAction.Release:
                    _clyde.SendKeyUp(ev);
                    break;

                case InputAction.Press:
                case InputAction.Repeat:
                    _clyde.SendKeyDown(ev);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(action), action, null);
                }
            }
示例#6
0
 void KeyPressedEvent(Keyboard.Key Code, bool Ctrl, bool Shift, bool Alt, bool System, bool Down)
 {
     if (Down && Code == Keyboard.Key.F1)
     {
         Con.Focused = true;
     }
 }
示例#7
0
 public PlayerKeySetting(Keyboard.Key left, Keyboard.Key right, Keyboard.Key jump, Keyboard.Key start)
 {
     this.left  = left;
     this.right = right;
     this.jump  = jump;
     this.start = start;
 }
示例#8
0
 public void Move(Keyboard.Key key)
 {
     if (_gameHandler.RoundObject.GameWin == true)
     {
     }
     else
     {
         if (key == Keyboard.Key.Q)
         {
             GameOverList[selectedItemIndex].Color = Color.White;
             selectedItemIndex--;
             if (selectedItemIndex < 0)
             {
                 selectedItemIndex = 0;
             }
             GameOverList[selectedItemIndex].Color = Color.Yellow;
         }
         else if (key == Keyboard.Key.D)
         {
             GameOverList[selectedItemIndex].Color = Color.White;
             selectedItemIndex++;
             if (selectedItemIndex > 1)
             {
                 selectedItemIndex = 1;
             }
             GameOverList[selectedItemIndex].Color = Color.Yellow;
         }
     }
 }
示例#9
0
 public Player(Texture tex, Keyboard.Key left, Keyboard.Key right)
 {
     sprite        = new Sprite(tex);
     sprite.Origin = new Vector2f(256f, 256f);
     this.left     = left;
     this.right    = right;
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of <see cref="KeyboardKeyEventArgs"/> class.
 /// </summary>
 /// <param name="keyCode">The <see cref="Keyboard.Key"/> corresponding to the key the user input.</param>
 public KeyboardKeyEventArgs(Keyboard.Key keyCode)
     : base()
 {
     KeyCode   = keyCode;
     _state    = OpenTK.Input.Keyboard.GetState();
     _isRepeat = false;
 }
示例#11
0
        /// <summary>
        /// Checks if a key is numeric
        /// </summary>
        /// <param name="key">Key to check</param>
        /// <returns>True if numeric, else false</returns>
        public static bool IsKeyNumeric(Keyboard.Key key)
        {
            switch (key)
            {
            case Keyboard.Key.Num0:
            case Keyboard.Key.Num1:
            case Keyboard.Key.Num2:
            case Keyboard.Key.Num3:
            case Keyboard.Key.Num4:
            case Keyboard.Key.Num5:
            case Keyboard.Key.Num6:
            case Keyboard.Key.Num7:
            case Keyboard.Key.Num8:
            case Keyboard.Key.Num9:
            case Keyboard.Key.Numpad0:
            case Keyboard.Key.Numpad1:
            case Keyboard.Key.Numpad2:
            case Keyboard.Key.Numpad3:
            case Keyboard.Key.Numpad4:
            case Keyboard.Key.Numpad5:
            case Keyboard.Key.Numpad6:
            case Keyboard.Key.Numpad7:
            case Keyboard.Key.Numpad8:
            case Keyboard.Key.Numpad9:
                return(true);

            default:
                return(false);
            }
        }
示例#12
0
 public GuiRawKeyEvent(Keyboard.Key key, int scanCode, RawKeyAction action, Vector2i mouseRelative)
 {
     Key           = key;
     ScanCode      = scanCode;
     Action        = action;
     MouseRelative = mouseRelative;
 }
示例#13
0
 private void SfmlWindow_KeyReleased(object sender, KeyEventArgs e)
 {
     if (e.Code == _lastKeyPressed)
     {
         _lastKeyPressed = Keyboard.Key.Unknown;
     }
 }
示例#14
0
        private void EmitKeyEvent(Keyboard.Key key, InputAction action, KeyModifiers mods)
        {
            var shift   = mods.HasFlag(KeyModifiers.Shift);
            var alt     = mods.HasFlag(KeyModifiers.Alt);
            var control = mods.HasFlag(KeyModifiers.Control);
            var system  = mods.HasFlag(KeyModifiers.Super);

            var ev = new KeyEventArgs(
                key,
                action == InputAction.Repeat,
                alt, control, shift, system);

            switch (action)
            {
            case InputAction.Release:
                _gameController.KeyUp(ev);
                break;

            case InputAction.Press:
            case InputAction.Repeat:
                _gameController.KeyDown(ev);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
示例#15
0
 public KeyInputArgs(Keyboard.Key key, bool pressed, bool control, bool shift)
 {
     Key     = key;
     Pressed = pressed;
     Control = control;
     Shift   = shift;
 }
示例#16
0
        public override void OnKeyPressed(Keyboard.Key key)
        {
            base.OnKeyPressed(key);

            if (Focused)
            {
                if (key == Keyboard.Key.Left && _currentIndex > 0)
                {
                    _currentIndex--;
                    _cursor.Position = _text.GetLetterPosition(_currentIndex) + (Vector2f)_text.GlobalPosition;
                }
                else if (key == Keyboard.Key.Right && _currentIndex < _realText.Length)
                {
                    _currentIndex++;
                    _cursor.Position = _text.GetLetterPosition(_currentIndex) + (Vector2f)_text.GlobalPosition;
                }
                else if (key == Keyboard.Key.Delete && _currentIndex < _realText.Length)
                {
                    _realText = _realText.Remove(_currentIndex, 1);
                    UpdateValue();
                }
                else if (key == Keyboard.Key.Home)
                {
                    _currentIndex = 0;
                }
                else if (key == Keyboard.Key.End)
                {
                    _currentIndex = _realText.Length;
                }
            }
        }
示例#17
0
        public Vector2i CalculateNewPosition(Keyboard.Key keyDir)
        {
            var newXPos = Position.X;
            var newYPos = Position.Y;

            switch (keyDir)
            {
            case Keyboard.Key.Up:
                newYPos -= m_playerEntitySpeed;
                break;

            case Keyboard.Key.Down:
                newYPos += m_playerEntitySpeed;
                break;

            case Keyboard.Key.Left:
                newXPos -= m_playerEntitySpeed;
                break;

            case Keyboard.Key.Right:
                newXPos += m_playerEntitySpeed;
                break;
            }

            return(new Vector2i(newXPos, newYPos));
        }
示例#18
0
文件: keyInput.cs 项目: KasenC/Test
 public keyInput(Keyboard.Key key, RenderWindow gameWindow, string name, bool requireFocused)
 {
     this.requireFocused = requireFocused;
     this.gameWindow     = gameWindow;
     this.key            = key;
     this.name           = name;
 }
示例#19
0
 public override void KeyReleased(Keyboard.Key key, Keyboard.Scancode scancode)
 {
     if (key == Keyboard.Key.Escape)
     {
         Event.Quit();
     }
 }
        public override void HandleKeyPress(Keyboard.Key Key)
        {
            switch (Key)
            {
            case Keyboard.Key.A: _Controller.AbandonUnit(); break;

            case Keyboard.Key.D: _Controller.Dismount(); break;

            case Keyboard.Key.E: _Controller.Evacuate(); break;

            case Keyboard.Key.F: _Controller.FortifyUnit(); break;

            case Keyboard.Key.I: _Controller.ClearMinefield(); break;

            case Keyboard.Key.L: _Controller.LoadUnit(true); break;

            case Keyboard.Key.M: _Controller.Mount(); break;

            case Keyboard.Key.P: _Controller.Emplace(); break;

            case Keyboard.Key.R: _Controller.Recon(); break;

            case Keyboard.Key.U: _Controller.UnloadUnit(); break;
            }
        }
示例#21
0
        public void Walk(Keyboard.Key Dir, double frame_time)
        {
            float d = (float)(PlayerSpeed * frame_time);

            switch (Dir)
            {
            case Keyboard.Key.W:
                if (!Map.isWall((int)(x + (d + 0.05F) * cos_a), (int)y))
                {
                    x = x + d * cos_a;
                }
                if (!Map.isWall((int)x, (int)(y + (d + 0.05F) * sin_a)))
                {
                    y = y + d * sin_a;
                }
                break;

            case Keyboard.Key.S:
                if (!Map.isWall((int)(x - (d + 0.05F) * cos_a), (int)y))
                {
                    x = x - d * cos_a;
                }
                if (!Map.isWall((int)x, (int)(y - (d + 0.05F) * sin_a)))
                {
                    y = y - d * sin_a;
                }
                break;

            case Keyboard.Key.A:
                if (!Map.isWall((int)(x + (d + 0.05F) * sin_a), (int)y))
                {
                    x = x + d * sin_a;
                }
                if (!Map.isWall((int)x, (int)(y - (d + 0.05F) * cos_a)))
                {
                    y = y - d * cos_a;
                }
                break;

            case Keyboard.Key.D:
                if (!Map.isWall((int)(x - (d + 0.05F) * sin_a), (int)y))
                {
                    x = x - d * sin_a;
                }
                if (!Map.isWall((int)x, (int)(y + (d + 0.05F) * cos_a)))
                {
                    y = y + d * cos_a;
                }
                break;
            }
            PlayerSpeed = Settings.BasePlayerSpeed;
            if (new System.Drawing.Point((int)x, (int)y) == mapActivator)
            {
                Map.isVisible = true;
            }
            if ((int)x == Map.Out.x && (int)y == Map.Out.y)
            {
                Program.menu.isWin = true; Program.menu.OnOpen();
            }
        }
示例#22
0
        public bool IsKeyDown(Keyboard.Key key)
        {
            bool returnValue;

            pressedKeys.TryGetValue(key, out returnValue);
            return(returnValue);
        }
示例#23
0
 public void AddKey(Keyboard.Key key)
 {
     if (!keys.Contains(key))
     {
         keys.Add(key);
     }
 }
示例#24
0
 public override void KeyPressed(Keyboard.Key key, Keyboard.Scancode scancode, bool isRepeat)
 {
     if (key == Keyboard.Key.F)
     {
         Window.SetFullscreen(!Window.GetFullscreen());
     }
 }
示例#25
0
文件: Form1.cs 项目: rincewound/VPAD
        private void HandleHidEvent(object aSender, Event aHidEvent)
        {
            if (!aHidEvent.IsRepeat)
            {
                this.Invoke(new Action(() => { this.Text = " "; }));
            }

            foreach (var button in mapping.buttonMapping)
            {
                if ((aHidEvent.InputReport[button.inputReportIndex] & button.inputReportMask) != 0 &&
                    !aHidEvent.IsRepeat && !aHidEvent.IsStray)
                {
                    System.Diagnostics.Trace.WriteLine(button.button);

                    // Find mapping for button:
                    var key = kpMapping.keymapping.FirstOrDefault(x => x.Key == button.button);
                    if (key.Key == null)
                    {
                        continue;
                    }

                    // We found a valid mapping -> emit keystrike!
                    Keyboard.Key k = new Keyboard.Key(key.Value);
                    k.PressForeground();

                    this.Invoke(new Action(() => { this.Text = " Key Active :" + key.Value.ToString(); }));
                }
            }
        }
示例#26
0
        private bool HandleInputTargeting(Keyboard.Key input)
        {
            var dir = EnumDirections.None;

            switch (input)
            {
            case Keyboard.Key.A:
                dir = EnumDirections.West;
                break;

            case Keyboard.Key.D:
                dir = EnumDirections.East;
                break;

            case Keyboard.Key.W:
                dir = EnumDirections.North;
                break;

            case Keyboard.Key.S:
                dir = EnumDirections.South;
                break;

            case Keyboard.Key.Q:
                dir = EnumDirections.NorthWest;
                break;

            case Keyboard.Key.E:
                dir = EnumDirections.NorthEast;
                break;

            case Keyboard.Key.Z:
                dir = EnumDirections.SouthWest;
                break;

            case Keyboard.Key.X:
                dir = EnumDirections.SouthEast;
                break;

            case _inputToggleTargetingSystem:
                BroadcastMessage(new RequestChangeGameStateEvent(EnumGameState.RegularGame));
                break;

            case _inputAttack:
                BroadcastMessage(new PlayerRequestAttackEvent());
                BroadcastMessage(new RequestChangeGameStateEvent(EnumGameState.RegularGame));
                break;

            case Keyboard.Key.Escape:
                BroadcastMessage(new RequestChangeGameStateEvent(EnumGameState.RegularGame));
                break;
            }

            if (dir != EnumDirections.None)
            {
                BroadcastMessage(new MoveTargetingCursorEvent(dir));
            }

            return(false);
        }
示例#27
0
 public KeyEventArgs(Keyboard.Key key, bool alt, bool control, bool shift, bool system)
 {
     Key     = key;
     Alt     = alt;
     Control = control;
     Shift   = shift;
     System  = system;
 }
示例#28
0
 public override void KeyPress(Keyboard.Key key, bool pressed)
 {
     if (Focus == null)
     {
         return;
     }
     focus.KeyPress(key, pressed);
 }
 public KeyboardMovementScript(Keyboard.Key up, Keyboard.Key down, Keyboard.Key left, Keyboard.Key right, Keyboard.Key roll)
 {
     _up    = up;
     _down  = down;
     _left  = left;
     _right = right;
     _roll  = roll;
 }
示例#30
0
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     Keyboard.Key k = ProcessKeys(e.KeyCode);
     if (k != null)
     {
         k.Value = true;
     }
 }
示例#31
0
        public KeyboardInput()
        {
            _moveUp = Keyboard.Key.Up;
            _moveDown = Keyboard.Key.Down;
            _moveLeft = Keyboard.Key.Left;
            _moveRight = Keyboard.Key.Right;

            _action = Keyboard.Key.Z;
            _cancel = Keyboard.Key.X;

            _dirUp = 2;
            _dirDown = 0;
            _dirLeft = 3;
            _dirRight = 1;
        }
示例#32
0
        public TitleScreenState()
        {
            var possibleKeys = new[]
                               {
                                   Keyboard.Key.Delete, Keyboard.Key.P, Keyboard.Key.BackSlash, Keyboard.Key.Escape,
                                   Keyboard.Key.Tab, Keyboard.Key.Period, Keyboard.Key.F5, Keyboard.Key.D
                               };

            startKey = possibleKeys[Content.Random.Next(possibleKeys.Length)];

            logo = new SpriteComponent { Sprite = new Sprite(Content.Logo) };
            prompt = new TextComponent { Text = new Text("Press " + startKey.ToString().ToUpper(), Content.Font, 16) };
            input = new InputComponent();
            input.KeyEvents[startKey] = (key, mod, time) => Program.TransitionToState<GameplayState>();
        }
示例#33
0
        public static void OnKeyPressed(object sender, KeyEventArgs e)
        {
            LocalWindow = (RenderWindow) sender;
            int i = 0;
            foreach(Keyboard.Key thiskey in GameKeys.AllKeys)
            {
                if (!Keyboard.IsKeyPressed(thiskey)) continue;
                _pressedKeys[i] = thiskey;//InputMap.HandleKey(thiskey);
                i++;
                if(_lastKey != thiskey)Console.WriteLine(thiskey.ToString());
                _lastKey = thiskey;
            }
            InputMap.HandleKeyPress(_pressedKeys);

            ResetPressedKeys();
        }
示例#34
0
        public LabeledWidget(String label = null, EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            if (label != null)
            {
                Mode = mode;
                Type = EType.Label;

                Label = new Button(label, Button.EMode.Label);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null); AddWidget(VBox); break;
                }

                ShortCutMode = shortCutMode;

                if (Label.Text.Length > 0)
                    ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
            }
        }
示例#35
0
文件: Button.cs 项目: MrPhil/LD24
 public void SetKeyShortcut(Keyboard.Key key)
 {
     keyShortcut = key;
 }
示例#36
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the key arguments from a key event
 /// </summary>
 /// <param name="e">Key event</param>
 ////////////////////////////////////////////////////////////
 public KeyEventArgs(KeyEvent e)
 {
     Code    = e.Code;
         Alt     = e.Alt != 0;
         Control = e.Control != 0;
         Shift   = e.Shift != 0;
         System  = e.System != 0;
 }
示例#37
0
        private void InitializeVariables()
        {
            SimpleFloor = Helper.INIParser.GetSetting("Rendering", "SimpleFloor") != "0";
            SimpleTrapdoor = Helper.INIParser.GetSetting("Rendering", "SimpleTrapdoor") != "0";
            SimpleBrokenWall = Helper.INIParser.GetSetting("Rendering", "SimpleBrokenWall") != "0";

            _kcExit = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcExit"));
            _kcNorth = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcNorth"));
            _kcSouth = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSouth"));
            _kcWest = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcWest"));
            _kcEast = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcEast"));
            _kcNorthwest = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcNorthwest"));
            _kcSouthwest = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSouthwest"));
            _kcNortheast = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcNortheast"));
            _kcSoutheast = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSoutheast"));
            _kcItem1 = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcItem1"));
            _kcItem2 = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcItem2"));
            _kcItem3 = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcItem3"));
            _kcRestart = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcRestart"));
            _kcSkip = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSkip"));
            _kcSwingCw = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSwingCw"));
            _kcSwingCcw = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcSwingCcw"));
            _kcWait = Helper.StringToKey(Helper.INIParser.GetSetting("Input", "kcWait"));

            InputDelayMax = int.Parse(Helper.INIParser.GetSetting("Game", "InputDelay"));
            TilesX = int.Parse(Helper.INIParser.GetSetting("Game", "TilesX"));
            TilesY = int.Parse(Helper.INIParser.GetSetting("Game", "TilesY"));

            RenderCells = new List<RenderCell>();
            Particles = new List<Particle>();
            CurrentTileset = Resources.GetRandomTileset();
            TileSize = 14;
            InputDelay = 0;
            LastKeyPress = Keyboard.Key.Escape;
            TextInventory = new List<Text>();
            SpriteInventory = new List<Sprite>();
            Game = new Game(this, TilesX, TilesY) { SFMLGame = this };
            Running = true;
        }
示例#38
0
 public PressListener(Keyboard.Key key)
 {
     _key = key;
 }
 /// <summary>
 /// Changes the referened key.
 /// </summary>
 /// <param name="newValue">The new <see cref="Keyboard.Key"/>.</param>
 public void ChangeKey(Keyboard.Key newValue)
 {
     _key = newValue;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticKeyCodeReference"/> class.
 /// </summary>
 /// <param name="key">The key.</param>
 public StaticKeyCodeReference(Keyboard.Key key)
 {
     _key = key;
 }
 public InputKey(Keyboard.Key keyboardKey)
 {
     kbKey = keyboardKey;
 }
示例#42
0
 private static Keyboard.Key[] InitializePressedKeys()
 {
     Keyboard.Key[] pressedKeys = new Keyboard.Key[GameKeys.AllKeys.Length];
     ResetPressedKeys(pressedKeys);
     return pressedKeys;
 }
示例#43
0
 /// <summary>
 /// Grabs the <see cref="Keyboard.Key"/> value from the <see cref="_settings"/>.
 /// </summary>
 void UpdateValue()
 {
     _key = (Keyboard.Key)_settings[KeySettingName];
 }
示例#44
0
 public KeyEvent(KeyStateChange type_, Keyboard.Key key_)
     : base(EventType.KeyEvent)
 {
     StateChange = type_;
     Key = key_;
 }
示例#45
0
        public KeyCombinationEvent(bool ctrl_,
								   bool shift_,
                                   Keyboard.Key key_)
            : base(EventType.KeyCombinationEvent)
        {
            Ctrl = ctrl_;
            Shift = shift_;
            Key = key_;
        }
示例#46
0
        public Button(String label, EMode mode = EMode.BackgroundLabel, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            Mode = mode;

            if (Mode == EMode.BackgroundLabel)
            {
                BackgroundTextures = new Dictionary<EState, Texture>()
                {
                    { EState.Normal, Create.Texture("ButtonBackgroundN") },
                    { EState.MouseOver, Create.Texture("ButtonBackgroundO") }
                };

                Background = new PictureBox(GetCurrentTexture());
            }

            else if (Mode == EMode.LabelEffect)
            {
                Mode = EMode.LabelEffect;
                ClickOffset = DEFAULT_LABEL_CLICKOFFSET;
            }

            Label = new Label(label);
            AddWidget(Label);

            State = EState.Normal;

            ShortCutMode = shortCutMode && label != null;

            if (label != null && Label.Text.Length > 0)
                ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
        }