Beispiel #1
0
        protected override void OnKeyDown(UIKeyEventArgs e)
        {
            //handle special keydown
            if (e.Ctrl)
            {
                //control
                switch (e.KeyCode)
                {
                case UIKeys.V:
                {
                    this.DesignBoardModule.PasteClipboardData();
                } break;

                case UIKeys.Z:
                {
                    //undo
                    this.DesignBoardModule.UndoLastAction();
                } break;

                case UIKeys.Y:
                {
                    //redo
                } break;
                }
            }
            base.OnKeyDown(e);
        }
Beispiel #2
0
        void simpleBox_KeyDown(object sender, UIKeyEventArgs e)
        {
            if (selectedItem != null && ListItemKeyboardEvent != null)
            {
                e.UIEventName = UIEventName.KeyDown;
                ListItemKeyboardEvent(this, e);
            }
            //switch (e.KeyCode)
            //{
            //    case UIKeys.Down:
            //        {
            //            e.CancelBubbling = true;
            //            SelectedIndex++;
            //        } break;
            //    case UIKeys.Up:
            //        {
            //            e.CancelBubbling = true;
            //            SelectedIndex--;
            //        } break;
            //    case UIKeys.Enter:
            //        {
            //            //accept selected item?

            //            if (selectedItem != null && ListItemKeyboardEvent != null)
            //            {
            //                ListItemKeyboardEvent(this, e);
            //            }
            //        }
            //        break;
            //    case UIKeys.Escape:
            //        //
            //        break;
            //}
        }
Beispiel #3
0
        protected override bool OnProcessDialogKey(UIKeyEventArgs e)
        {
            if (_gridSelectionSession != null && _gridSelectionSession.Started)
            {
                switch (e.KeyCode)
                {
                case UIKeys.Left:
                    _gridSelectionSession.MoveLeft();
                    break;

                case UIKeys.Right:
                    _gridSelectionSession.MoveRight();
                    break;

                case UIKeys.Up:
                    _gridSelectionSession.MoveUp();
                    break;

                case UIKeys.Down:
                    _gridSelectionSession.MoveDown();
                    break;
                }
            }
            return(false);
        }
Beispiel #4
0
 internal static void NofitySplitNewLine(TextSurfaceEventListener listener, UIKeyEventArgs e)
 {
     if (listener.SplitedNewLine != null)
     {
         listener.SplitedNewLine(listener, e);
     }
 }
Beispiel #5
0
        void sgBox_ListItemKeyboardEvent(object sender, UIKeyEventArgs e)
        {
            //keyboard event occurs on list item in suggestion box
            //
            switch (e.UIEventName)
            {
            case UIEventName.KeyDown:
            {
                switch (e.KeyCode)
                {
                case UIKeys.Down:
                    _sgBox.SelectedIndex++;
                    e.CancelBubbling = true;
                    break;

                case UIKeys.Up:
                    _sgBox.SelectedIndex--;
                    e.CancelBubbling = true;
                    break;

                case UIKeys.Enter:
                    //use select some item
                    sgBox_UserConfirmSelectedItem(null, EventArgs.Empty);
                    e.CancelBubbling = true;
                    break;

                default:
                    _textbox.Focus();
                    break;
                }
            }
            break;
            }
        }
 void listView_ListItemKeyboardEvent(object sender, UIKeyEventArgs e)
 {
     if (ListItemKeyboardEvent != null)
     {
         ListItemKeyboardEvent(this, e);
     }
 }
Beispiel #7
0
        bool ITopWindowEventRoot.RootProcessDialogKey(int keyData)
        {
            UI.UIKeys k = (UIKeys)keyData;

            if (_currentKbFocusElem == null)
            {
                //set
                _lastKeydownWithShift   = ((k & UIKeys.Shift) == UIKeys.Shift);
                _lastKeydownWithAlt     = ((k & UIKeys.Alt) == UIKeys.Alt);
                _lastKeydownWithControl = ((k & UIKeys.Control) == UIKeys.Control);

                return(false);
            }


            StopCaretBlink();

            UIKeyEventArgs e = GetFreeKeyEvent();

            e.KeyData = (int)keyData;
            e.SetEventInfo(
                (int)keyData,
                _lastKeydownWithShift   = ((k & UIKeys.Shift) == UIKeys.Shift),
                _lastKeydownWithAlt     = ((k & UIKeys.Alt) == UIKeys.Alt),
                _lastKeydownWithControl = ((k & UIKeys.Control) == UIKeys.Control));
            bool result = false;

            e.ExactHitObject = e.SourceHitElement = _currentKbFocusElem;
            result           = _currentKbFocusElem.ListenProcessDialogKey(e);
            ReleaseKeyEvent(e);
            return(result);
        }
Beispiel #8
0
        bool IEventPortal.PortalProcessDialogKey(UIKeyEventArgs e)
        {
            e.CurrentContextElement = this;
            var result = GetInputEventAdapter().ProcessDialogKey(e, htmlRenderBox.CssBox);

            return(result);
        }
Beispiel #9
0
 public static void SetEventInfo(this UIKeyEventArgs e, bool shift, bool alt, bool control, UIEventName eventName)
 {
     e.Shift      = shift;
     e.Alt        = alt;
     e.Ctrl       = control;
     e._eventName = eventName;
 }
Beispiel #10
0
        protected override void OnKeyDown(UIKeyEventArgs e)
        {
            if (_gridSelectionSession != null && _gridSelectionSession.Started)
            {
                switch (e.KeyCode)
                {
                case UIKeys.Home:
                    _gridSelectionSession.MoveHome();
                    break;

                case UIKeys.End:
                    _gridSelectionSession.MoveEnd();
                    break;

                case UIKeys.A:
                    if (e.Ctrl)
                    {
                        //ctrl+a
                        _gridSelectionSession.SelectAll();
                    }
                    break;
                }
            }
            base.OnKeyDown(e);
        }
Beispiel #11
0
 public override void HandleKeyUp(UIKeyEventArgs e)
 {
     this.SetCaretVisible(true);
     if (_textSurfaceEventListener != null)
     {
         TextSurfaceEventListener.NotifyKeyDown(_textSurfaceEventListener, e);;
     }
 }
Beispiel #12
0
 protected override void OnKeyDown(UIKeyEventArgs e)
 {
     if (_selectedItem != null && ListItemKeyboardEvent != null)
     {
         ListItemKeyboardEvent(this, e);
     }
     base.OnKeyDown(e);
 }
Beispiel #13
0
 void simpleBox_KeyDown(object sender, UIKeyEventArgs e)
 {
     if (selectedItem != null && ListItemKeyboardEvent != null)
     {
         e.UIEventName = UIEventName.KeyDown;
         ListItemKeyboardEvent(this, e);
     }
 }
Beispiel #14
0
 protected override bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     if (textEditRenderElement.OnProcessDialogKey(e))
     {
         e.CancelBubbling = true;
         return(true);
     }
     return(false);
 }
Beispiel #15
0
        public override void HandleKeyPress(UIKeyEventArgs e)
        {
            this.SetCaretVisible(true);
            //------------------------
            if (e.IsControlCharacter)
            {
                HandleKeyDown(e);
                return;
            }



            e.CancelBubbling = true;

            InvalidateGraphicOfCurrentSelectionArea();

            bool preventDefault = false;

            if (_textSurfaceEventListener != null &&
                !(preventDefault = TextSurfaceEventListener.NotifyPreviewKeyPress(_textSurfaceEventListener, e)))
            {
                _editSession.UpdateSelectionRange();
            }
            if (preventDefault)
            {
                return;
            }

            if (_isEditable)
            {
                int insertAt = _editSession.CurrentLineCharIndex;

                _editSession.AddCharToCurrentLine(e.KeyChar);

                if (_textSurfaceEventListener != null)
                {
                    //TODO: review this again ***
                    if (_editSession.SelectionRange != null)
                    {
                        TextSurfaceEventListener.NotifyCharacterReplaced(_textSurfaceEventListener, e.KeyChar);
                    }
                    else
                    {
                        TextSurfaceEventListener.NotifyCharacterAdded(_textSurfaceEventListener, insertAt, e.KeyChar);
                    }
                }
            }


            EnsureCaretVisible();

            if (_textSurfaceEventListener != null)
            {
                TextSurfaceEventListener.NotifyKeyDown(_textSurfaceEventListener, e);;
            }
        }
        public void OnKeyPress(UIKeyEventArgs e)
        {
            this.SetCaretState(true);
            //------------------------
            if (e.IsControlCharacter)
            {
                OnKeyDown(e);
                return;
            }

            char c = e.KeyChar;

            e.CancelBubbling = true;
            if (internalTextLayerController.SelectionRange != null &&
                internalTextLayerController.SelectionRange.IsValid)
            {
                InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
            }
            bool preventDefault = false;

            if (textSurfaceEventListener != null &&
                !(preventDefault = TextSurfaceEventListener.NotifyPreviewKeydown(textSurfaceEventListener, c)))
            {
                internalTextLayerController.UpdateSelectionRange();
            }
            if (preventDefault)
            {
                return;
            }
            if (internalTextLayerController.SelectionRange != null)
            {
                internalTextLayerController.AddCharToCurrentLine(c);
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyCharactersReplaced(textSurfaceEventListener, e.KeyChar);
                }
            }
            else
            {
                internalTextLayerController.AddCharToCurrentLine(c);
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyCharacterAdded(textSurfaceEventListener, e.KeyChar);
                }
            }

            EnsureCaretVisible();
            if (textSurfaceEventListener != null)
            {
                TextSurfaceEventListener.NotifyKeyDown(textSurfaceEventListener, e.KeyCode);
            }
        }
Beispiel #17
0
        void ITopWindowEventRoot.RootKeyPress(char c)
        {
            if (_currentKbFocusElem == null)
            {
                return;
            }

            StopCaretBlink();
            UIKeyEventArgs e = GetFreeKeyEvent();

            e.SetKeyChar(c);
            e.ExactHitObject = e.SourceHitElement = _currentKbFocusElem;
            _currentKbFocusElem.ListenKeyPress(e);
            _iTopBoxEventPortal.PortalKeyPress(e);
            ReleaseKeyEvent(e);
        }
Beispiel #18
0
 //-------------------
 protected override bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     if (KeyDown != null)
     {
         KeyDown(this, e);
     }
     //return true if you want to stop event bubble to other
     if (e.CancelBubbling)
     {
         return(true);
     }
     else
     {
         return(base.OnProcessDialogKey(e));
     }
 }
Beispiel #19
0
        void ITopWindowEventRoot.RootKeyDown(int keydata)
        {
            if (_currentKbFocusElem == null)
            {
                return;
            }

            UIKeyEventArgs e = GetFreeKeyEvent();

            SetKeyData(e, keydata);
            StopCaretBlink();
            e.ExactHitObject = e.SourceHitElement = _currentKbFocusElem;
            _currentKbFocusElem.ListenKeyDown(e);
            _iTopBoxEventPortal.PortalKeyDown(e);
            ReleaseKeyEvent(e);
        }
Beispiel #20
0
        public virtual void HandleKeyPress(UIKeyEventArgs e)
        {
            //------------------------
            if (e.IsControlCharacter)
            {
                HandleKeyDown(e);
                return;
            }

#if DEBUG
            char c = e.KeyChar;
#endif
            e.CancelBubbling = true;
            InvalidateGraphicOfCurrentSelectionArea();

            _editSession.UpdateSelectionRange();
            EnsureCaretVisible();
        }
Beispiel #21
0
        protected override void OnKeyUp(UIKeyEventArgs e)
        {
            if (e.Ctrl)
            {
                switch (e.KeyCode)
                {
                case UIKeys.C:
                {
                    //ctrl+ c => copy to clipboard
                    StringBuilder stbuilder = new StringBuilder();
                    this.myHtmlCont.CopySelection(stbuilder);
                    LayoutFarm.UI.Clipboard.SetText(stbuilder.ToString());
                }
                break;
                }
            }

            e.CurrentContextElement = this;
        }
        void ITopWindowEventRoot.RootKeyUp(int keydata)
        {
            if (currentKbFocusElem == null)
            {
                return;
            }

            StopCaretBlink();
            UIKeyEventArgs e = GetFreeKeyEvent();

            SetKeyData(e, keydata);
            //----------------------------------------------------

            e.ExactHitObject = e.SourceHitElement = currentKbFocusElem;
            currentKbFocusElem.ListenKeyUp(e);
            iTopBoxEventPortal.PortalKeyUp(e);
            //----------------------------------------------------
            ReleaseKeyEvent(e);
            StartCaretBlink();
        }
Beispiel #23
0
 protected override void OnKeyDown(UIKeyEventArgs e)
 {
     if (e.Ctrl)
     {
         switch (e.KeyCode)
         {
         case UIKeys.C:
         {
             //copy this box to a clipboard***
             //copy this content to clipboard
             this.DesignBoardModule.CopyToClipBoard(this.TargetBox as IDesignBox);
         }
         break;
         }
     }
     else
     {
         switch (e.KeyCode)
         {
         case UIKeys.Delete:
         {
             //-------------------------------------
             //add action history to design board?
             //-------------------------------------
             //remove the target and its controller
             var masterCollectionSet = this.MasterSelectionSet;
             this.RelaseTargetAndRemoveSelf();
             if (masterCollectionSet != null)
             {
                 //remove other from selection set too!
                 masterCollectionSet.NotifyRemoveUIElement(this);
             }
         }
         break;
         }
     }
     base.OnKeyDown(e);
 }
Beispiel #24
0
        void ITopWindowEventRoot.RootKeyUp(int keydata)
        {
            if (_currentKbFocusElem == null)
            {
                _lastKeydownWithShift = _lastKeydownWithAlt = _lastKeydownWithControl = false;

                return;
            }

            StopCaretBlink();
            UIKeyEventArgs e = GetFreeKeyEvent();

            SetKeyData(e, keydata);
            //----------------------------------------------------

            e.ExactHitObject = e.SourceHitElement = _currentKbFocusElem;
            _currentKbFocusElem.ListenKeyUp(e);
            _iTopBoxEventPortal.PortalKeyUp(e);
            //----------------------------------------------------
            ReleaseKeyEvent(e);
            StartCaretBlink();

            _lastKeydownWithShift = _lastKeydownWithControl = _lastKeydownWithAlt = false;
        }
Beispiel #25
0
 //------------------------------------------------------------
 protected virtual void OnKeyDown(UIKeyEventArgs e)
 {
 }
Beispiel #26
0
 protected virtual bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     return(false);
 }
Beispiel #27
0
 protected virtual void OnKeyPress(UIKeyEventArgs e)
 {
 }
Beispiel #28
0
 protected virtual void OnKeyUp(UIKeyEventArgs e)
 {
 }
 void IEventListener.ListenKeyPress(UIKeyEventArgs e)
 {
     OnKeyPress(e);
 }
 bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
 {
     return(OnProcessDialogKey(e));
 }
Beispiel #31
0
 //------------------------------------------------------------
 protected virtual void OnKeyDown(UIKeyEventArgs e)
 {
 }
Beispiel #32
0
 protected virtual void OnKeyUp(UIKeyEventArgs e)
 {
 }
Beispiel #33
0
 protected virtual void OnKeyPress(UIKeyEventArgs e)
 {
 }
Beispiel #34
0
 protected virtual bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     return false;
 }
 void IEventListener.ListenKeyDown(UIKeyEventArgs e)
 {
     OnKeyDown(e);
 }
 void IEventListener.ListenKeyUp(UIKeyEventArgs e)
 {
     OnKeyUp(e);
 }
 bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
 {
     return OnProcessDialogKey(e);
 }
 void IEventListener.ListenKeyPress(UIKeyEventArgs e)
 {
     OnKeyPress(e);
 }