Esempio n. 1
0
 void textView_KeyDown(object sender, Crow.KeyboardKeyEventArgs e)
 {
     if (e.Control)
     {
         if (e.Key == Key.W)
         {
             if (e.Shift)
             {
                 CMDRedo.Execute();
             }
             else
             {
                 CMDUndo.Execute();
             }
         }
     }
 }
Esempio n. 2
0
 public virtual void onKeyUp(object sender, KeyboardKeyEventArgs e)
 {
     KeyUp.Raise (sender, e);
 }
Esempio n. 3
0
        public override void onKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            base.onKeyDown (sender, e);

            Key key = e.Key;

            switch (key)
            {
            case Key.Back:
                if (CurrentPosition == 0)
                    return;
                this.DeleteChar();
                break;
            case Key.Clear:
                break;
            case Key.Delete:
                if (selectionIsEmpty) {
                    if (!MoveRight ())
                        return;
                }else if (e.Shift)
                    CurrentInterface.Clipboard = this.SelectedText;
                this.DeleteChar ();
                break;
            case Key.Enter:
            case Key.KeypadEnter:
                if (!selectionIsEmpty)
                    this.DeleteChar ();
                if (Multiline)
                    this.InsertLineBreak ();
                else
                    OnTextChanged(this,new TextChangeEventArgs(Text));
                break;
            case Key.Escape:
                Text = "";
                CurrentColumn = 0;
                SelRelease = -1;
                break;
            case Key.Home:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = new Point (CurrentColumn, CurrentLine);
                    if (e.Control)
                        CurrentLine = 0;
                    CurrentColumn = 0;
                    SelRelease = new Point (CurrentColumn, CurrentLine);
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                    CurrentLine = 0;
                CurrentColumn = 0;
                break;
            case Key.End:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = CurrentPosition;
                    if (e.Control)
                        CurrentLine = int.MaxValue;
                    CurrentColumn = int.MaxValue;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                    CurrentLine = int.MaxValue;
                CurrentColumn = int.MaxValue;
                break;
            case Key.Insert:
                if (e.Shift)
                    this.Insert (CurrentInterface.Clipboard);
                else if (e.Control && !selectionIsEmpty)
                    CurrentInterface.Clipboard = this.SelectedText;
                break;
            case Key.Left:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = new Point(CurrentColumn, CurrentLine);
                    if (e.Control)
                        GotoWordStart ();
                    else if (!MoveLeft ())
                        return;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                    GotoWordStart ();
                else
                    MoveLeft();
                break;
            case Key.Right:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = CurrentPosition;
                    if (e.Control)
                        GotoWordEnd ();
                    else if (!MoveRight ())
                        return;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                    GotoWordEnd ();
                else
                    MoveRight ();
                break;
            case Key.Up:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = CurrentPosition;
                    CurrentLine--;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                CurrentLine--;
                break;
            case Key.Down:
                if (e.Shift) {
                    if (selectionIsEmpty)
                        SelBegin = CurrentPosition;
                    CurrentLine++;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                CurrentLine++;
                break;
            case Key.Menu:
                break;
            case Key.NumLock:
                break;
            case Key.PageDown:
                break;
            case Key.PageUp:
                break;
            case Key.RWin:
                break;
            case Key.Tab:
                this.Insert ("\t");
                break;
            default:
                break;
            }
            RegisterForGraphicUpdate();
        }
Esempio n. 4
0
 /// <summary>
 /// Constructs a new KeyboardEventArgs instance.
 /// </summary>
 /// <param name="args">An existing KeyboardEventArgs instance to clone.</param>
 public KeyboardKeyEventArgs(KeyboardKeyEventArgs args)
 {
     Key = args.Key;
 }
Esempio n. 5
0
        public override void onKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            base.onKeyDown(sender, e);

            Key key = e.Key;

            switch (key)
            {
            case Key.Back:
                if (CurrentPosition == 0)
                {
                    return;
                }
                this.DeleteChar();
                break;

            case Key.Clear:
                break;

            case Key.Delete:
                if (selectionIsEmpty)
                {
                    if (!MoveRight())
                    {
                        return;
                    }
                }
                else if (e.Shift)
                {
                    CurrentInterface.Clipboard = this.SelectedText;
                }
                this.DeleteChar();
                break;

            case Key.Enter:
            case Key.KeypadEnter:
                if (!selectionIsEmpty)
                {
                    this.DeleteChar();
                }
                if (Multiline)
                {
                    this.InsertLineBreak();
                }
                else
                {
                    OnTextChanged(this, new TextChangeEventArgs(Text));
                }
                break;

            case Key.Escape:
                Text          = "";
                CurrentColumn = 0;
                SelRelease    = -1;
                break;

            case Key.Home:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = new Point(CurrentColumn, CurrentLine);
                    }
                    if (e.Control)
                    {
                        CurrentLine = 0;
                    }
                    CurrentColumn = 0;
                    SelRelease    = new Point(CurrentColumn, CurrentLine);
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                {
                    CurrentLine = 0;
                }
                CurrentColumn = 0;
                break;

            case Key.End:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = CurrentPosition;
                    }
                    if (e.Control)
                    {
                        CurrentLine = int.MaxValue;
                    }
                    CurrentColumn = int.MaxValue;
                    SelRelease    = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                {
                    CurrentLine = int.MaxValue;
                }
                CurrentColumn = int.MaxValue;
                break;

            case Key.Insert:
                if (e.Shift)
                {
                    this.Insert(CurrentInterface.Clipboard);
                }
                else if (e.Control && !selectionIsEmpty)
                {
                    CurrentInterface.Clipboard = this.SelectedText;
                }
                break;

            case Key.Left:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = new Point(CurrentColumn, CurrentLine);
                    }
                    if (e.Control)
                    {
                        GotoWordStart();
                    }
                    else if (!MoveLeft())
                    {
                        return;
                    }
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                {
                    GotoWordStart();
                }
                else
                {
                    MoveLeft();
                }
                break;

            case Key.Right:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = CurrentPosition;
                    }
                    if (e.Control)
                    {
                        GotoWordEnd();
                    }
                    else if (!MoveRight())
                    {
                        return;
                    }
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                if (e.Control)
                {
                    GotoWordEnd();
                }
                else
                {
                    MoveRight();
                }
                break;

            case Key.Up:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = CurrentPosition;
                    }
                    CurrentLine--;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                CurrentLine--;
                break;

            case Key.Down:
                if (e.Shift)
                {
                    if (selectionIsEmpty)
                    {
                        SelBegin = CurrentPosition;
                    }
                    CurrentLine++;
                    SelRelease = CurrentPosition;
                    break;
                }
                SelRelease = -1;
                CurrentLine++;
                break;

            case Key.Menu:
                break;

            case Key.NumLock:
                break;

            case Key.PageDown:
                break;

            case Key.PageUp:
                break;

            case Key.RWin:
                break;

            case Key.Tab:
                this.Insert("\t");
                break;

            default:
                break;
            }
            RegisterForGraphicUpdate();
        }
Esempio n. 6
0
 /// <summary>
 /// Constructs a new KeyboardEventArgs instance.
 /// </summary>
 /// <param name="args">An existing KeyboardEventArgs instance to clone.</param>
 public KeyboardKeyEventArgs(KeyboardKeyEventArgs args)
 {
     Key = args.Key;
 }