Beispiel #1
0
        char CharFromKey(Xwt.Key xwtKey)
        {
            if (xwtKey >= Key.Exclamation && xwtKey <= Key.Tilde)
            {
                return((char)xwtKey);
            }

            return('\0');
        }
        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))
                {
                    SelectFirstCategory();
                }
                else
                {
                    SelectItemUp();
                }
                return(true);

            case Xwt.Key.Down:
                if (state.HasFlag(Xwt.ModifierKeys.Command))
                {
                    goto case Xwt.Key.PageDown;
                }
                if (state.HasFlag(Xwt.ModifierKeys.Control))
                {
                    SelectLastCatgory();
                }
                else
                {
                    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.Return:
                OnItemActivated(EventArgs.Empty);
                return(true);
            }
            return(false);
        }