Пример #1
0
        // Override the key press event from Xsharp.
        protected override bool OnKeyPress(KeyName key,
                                           ModifierMask modifiers, String str)
        {
            bool processed = false;

            if (sink != null)
            {
                // Emit the "KeyDown" event.
                ToolkitKeys keyData = MapKey(key, modifiers);
                if (sink.ToolkitKeyDown(keyData))
                {
                    processed = true;
                }

                // Emit the "KeyChar" event if necessary.
                if (str != null)
                {
                    foreach (char ch in str)
                    {
                        // Clean old ASCII DEL (0x7F)
                        if (ch != (char)0x7F)
                        {
                            if (sink != null)                                         // window might be closed by sink.ToolkitKeyDown
                            {
                                if (sink.ToolkitKeyChar(ch))
                                {
                                    processed = true;
                                }
                            }
                        }
                    }
                }
            }
            return(processed);
        }
Пример #2
0
        // Override the key press event from Xsharp.
        protected override bool OnKeyPress(KeyName key,
                                           ModifierMask modifiers, String str)
        {
            bool processed = false;

            if (sink != null)
            {
                // Emit the "KeyDown" event.
                ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers);
                if (sink.ToolkitKeyDown(keyData))
                {
                    processed = true;
                }

                // Emit the "KeyChar" event if necessary.
                if (str != null)
                {
                    foreach (char ch in str)
                    {
                        if (sink.ToolkitKeyChar(ch))
                        {
                            processed = true;
                        }
                    }
                }
            }
            return(processed);
        }
Пример #3
0
        public bool ToolkitKeyDown(ToolkitKeys key)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                return(co.ToolkitKeyDown(key));
            }
            return(false);
        }
Пример #4
0
 internal bool KeyDown(int wParam, int lParam)
 {
     //Console.WriteLine("DrawingWindow.KeyDown " + sink +", " + (MapKeyToToolkitKeys( wParam)).ToString() + " " + wParam);
     return(sink.ToolkitKeyDown(MapKeyToToolkitKeys(wParam)));
 }