Exemple #1
0
        static SpecialKey ConvertKey(Xwt.Key key)
        {
            switch (key)
            {
            case Xwt.Key.BackSpace:
                return(SpecialKey.BackSpace);

            case Xwt.Key.Tab:
            case Xwt.Key.NumPadTab:
                return(SpecialKey.Tab);

            case Xwt.Key.Return:
            case Xwt.Key.NumPadEnter:
                return(SpecialKey.Return);

            case Xwt.Key.Escape:
                return(SpecialKey.Escape);

            case Xwt.Key.Space:
            case Xwt.Key.NumPadSpace:
                return(SpecialKey.Space);

            case Xwt.Key.PageUp:
                return(SpecialKey.PageUp);

            case Xwt.Key.PageDown:
                return(SpecialKey.PageDown);

            case Xwt.Key.End:
            case Xwt.Key.NumPadEnd:
                return(SpecialKey.End);

            case Xwt.Key.Home:
            case Xwt.Key.NumPadHome:
                return(SpecialKey.Home);

            case Xwt.Key.Left:
            case Xwt.Key.NumPadLeft:
                return(SpecialKey.Left);

            case Xwt.Key.Up:
            case Xwt.Key.NumPadUp:
                return(SpecialKey.Up);

            case Xwt.Key.Right:
            case Xwt.Key.NumPadRight:
                return(SpecialKey.Right);

            case Xwt.Key.Down:
            case Xwt.Key.NumPadDown:
                return(SpecialKey.Down);

            case Xwt.Key.Delete:
            case Xwt.Key.NumPadDelete:
                return(SpecialKey.Delete);
            }
            return(SpecialKey.None);
        }
Exemple #2
0
        bool SendKeyPressed(Xwt.Key key, Xwt.ModifierKeys mask)
        {
            var kargs = new Xwt.KeyEventArgs(key, mask, false, 0);

            if (KeyPressed != null)
            {
                KeyPressed(this, kargs);
            }

            return(kargs.Handled);
        }
        internal bool ProcessKey(Xwt.Key key, Xwt.ModifierKeys state)
        {
            switch (key)
            {
            case Xwt.Key.Up:
                if (state.HasFlag(Xwt.ModifierKeys.Command))
                {
                    goto case Xwt.Key.PageUp;
                }
                if (state.HasFlag(Xwt.ModifierKeys.Control))
                {
                    goto case Xwt.Key.Home;
                }
                SelectItemUp();
                return(true);

            case Xwt.Key.Down:
                if (state.HasFlag(Xwt.ModifierKeys.Command))
                {
                    goto case Xwt.Key.PageDown;
                }
                if (state.HasFlag(Xwt.ModifierKeys.Control))
                {
                    goto case Xwt.Key.End;
                }
                SelectItemDown();
                return(true);

            case (Xwt.Key)Gdk.Key.KP_Page_Down:
            case Xwt.Key.PageDown:
                SelectNextCategory();
                return(true);

            case (Xwt.Key)Gdk.Key.KP_Page_Up:
            case Xwt.Key.PageUp:
                SelectPrevCategory();
                return(true);

            case Xwt.Key.Home:
                SelectFirstCategory();
                return(true);

            case Xwt.Key.End:
                SelectLastCatgory();
                return(true);

            case Xwt.Key.Return:
                OnItemActivated(EventArgs.Empty);
                return(true);
            }
            return(false);
        }
Exemple #4
0
 public static KeyDescriptor FromXwt(Xwt.Key key, char c, Xwt.ModifierKeys modifiers)
 {
     return(new KeyDescriptor(ConvertKey(key), c, ConvertModifiers(modifiers), Tuple.Create(key, modifiers)));
 }