Пример #1
0
        // ------------------------------
        // protected
        // ------------------------------
        protected virtual void OnFigureShortcutKeyProcess(ShortcutKeyProcessEventArgs e)
        {
            var keyData = e.KeyData;

            if (keyData == Keys.ProcessKey && !Host.Site.EditorCanvas.IsInImeComposition)
            {
                keyData = Host.Site.EditorCanvas._ImmVirtualKey;
            }

            if (_keyMap != null && _keyMap.IsDefined(keyData))
            {
                var action = _keyMap.GetAction(keyData);
                if (action != null)
                {
                    if (action(Host))
                    {
                        e.Handled = true;
                    }
                }
            }

            var handler = ShortcutKeyProcess;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #2
0
 public static bool ProcessKeyMap <T>(IKeyMap <T> keyMap, T target, Keys keyData) where T : System.Windows.Forms.Control
 {
     if (keyMap.IsDefined(keyData))
     {
         var action = keyMap.GetAction(keyData);
         if (action != null)
         {
             if (action(target))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #3
0
        // ------------------------------
        // private
        // ------------------------------
        private void BindKillLine(Keys shortcutKey, IKeyMap <IFocus> keyMap)
        {
            var killLinePrefix = keyMap.SetPrefix(
                shortcutKey,
                (key, focus) => ((StyledTextFocus)focus).KillLineFirst(),
                (key, focus) => {
                if (keyMap.IsDefined(key))
                {
                    var action = keyMap.GetAction(key);
                    if (action != null)
                    {
                        action(focus);
                    }
                }
            },
                (key, focus) => key != shortcutKey,
                false
                );

            killLinePrefix.SetAction(shortcutKey, (focus) => ((StyledTextFocus)focus).KillLine());
        }