예제 #1
0
        public void Attach(IPointerInput pointer = null, IKeyboard keyboard = null)
        {
            if (pointer != null)
            {
                var previousPointerHandler = pointerHandler;

                if (pointer is IRelativePositionPointerInput)
                {
                    crossDrawable  = false;
                    status         = Status.NotGrabbed;
                    pointerHandler = new RelativePointerHandler((IRelativePositionPointerInput)pointer);
                }
                else if (pointer is IAbsolutePositionPointerInput)
                {
                    crossDrawable  = true;
                    status         = Status.NotGrabbable;
                    pointerHandler = new AbsolutePointerHandler((IAbsolutePositionPointerInput)pointer, widget);
                }

                var pia = PointerInputAttached;
                if (pia != null)
                {
                    pia(pointerHandler, previousPointerHandler);
                }
            }

            if (keyboard != null)
            {
                keyboardHandler = keyboard;
            }
        }
예제 #2
0
파일: IOHandler.cs 프로젝트: rte-se/emul8
        public void Attach(IPointerInput pointer = null, IKeyboard keyboard = null)
        {
            if(pointer != null)
            {
                var previousPointerHandler = pointerHandler;

                if(pointer is IRelativePositionPointerInput)
                {
                    status = Status.NotGrabbed;
                    pointerHandler = new RelativePointerHandler((IRelativePositionPointerInput)pointer);
                }
                else if(pointer is IAbsolutePositionPointerInput)
                {
                    status = Status.NotGrabbable;
                    pointerHandler = new AbsolutePointerHandler((IAbsolutePositionPointerInput)pointer, widget);
                }

                var pia = PointerInputAttached;
                if(pia != null)
                {
                    pia(pointerHandler, previousPointerHandler);
                }
            }

            if(keyboard != null)
            {
                keyboardHandler = keyboard;
            }
        }