GetEventParameter() private method

private GetEventParameter ( IntPtr inEvent, EventParamName inName, EventParamType inDesiredType, IntPtr outActualType, uint inBufferSize, IntPtr outActualSize, IntPtr outData ) : OSStatus
inEvent System.IntPtr
inName EventParamName
inDesiredType EventParamType
outActualType System.IntPtr
inBufferSize uint
outActualSize System.IntPtr
outData System.IntPtr
return OSStatus
Exemplo n.º 1
0
        internal static unsafe OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt)
        {
            HIPoint  hiPoint;
            HIPoint *hiPointPtr     = &hiPoint;
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.MouseLocation, EventParamType.typeHIPoint, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero, (IntPtr)((void *)hiPointPtr));

            pt = hiPoint;
            return(eventParameter);
        }
Exemplo n.º 2
0
        internal static unsafe OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef)
        {
            IntPtr   num;
            IntPtr * numPtr         = #
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero, (uint)sizeof(IntPtr), IntPtr.Zero, (IntPtr)((void *)numPtr));

            windowRef = num;
            return(eventParameter);
        }
Exemplo n.º 3
0
        public unsafe static OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt)
        {
            HIPoint  point;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.MouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
                                                    Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero, (IntPtr)(void *)&point);

            pt = point;
            return(result);
        }
Exemplo n.º 4
0
        public unsafe static OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef)
        {
            IntPtr   retval;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero,
                                                    sizeof(IntPtr), IntPtr.Zero, (IntPtr)(void *)&retval);

            windowRef = retval;
            return(result);
        }
Exemplo n.º 5
0
        public unsafe static int GetEventMouseWheelDelta(IntPtr inEvent)
        {
            int      delta;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.MouseWheelDelta, EventParamType.typeSInt32,
                                                    IntPtr.Zero, sizeof(int), IntPtr.Zero, (IntPtr)(void *)&delta);

            if (result != OSStatus.NoError)
            {
                throw new MacOSException(result);
            }
            return(delta);
        }
Exemplo n.º 6
0
        public unsafe static MacOSMouseButton GetEventMouseButton(IntPtr inEvent)
        {
            int      button;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.MouseButton, EventParamType.typeMouseButton, IntPtr.Zero,
                                                    sizeof(short), IntPtr.Zero, (IntPtr)(void *)&button);

            if (result != OSStatus.NoError)
            {
                throw new MacOSException(result);
            }
            return((MacOSMouseButton)button);
        }
Exemplo n.º 7
0
        public unsafe static char GetEventKeyboardChar(IntPtr inEvent)
        {
            char     code;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero,
                                                    Marshal.SizeOf(typeof(char)), IntPtr.Zero, (IntPtr)(void *)&code);

            if (result != OSStatus.NoError)
            {
                throw new MacOSException(result);
            }
            return(code);
        }
Exemplo n.º 8
0
        public unsafe static MacOSKeyModifiers GetEventKeyModifiers(IntPtr inEvent)
        {
            uint     code;
            OSStatus result = API.GetEventParameter(inEvent,
                                                    EventParamName.KeyModifiers, EventParamType.typeUInt32, IntPtr.Zero,
                                                    sizeof(uint), IntPtr.Zero, (IntPtr)(void *)&code);

            if (result != OSStatus.NoError)
            {
                throw new MacOSException(result);
            }
            return((MacOSKeyModifiers)code);
        }
Exemplo n.º 9
0
        static internal OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef)
        {
            IntPtr retval;

            unsafe
            {
                IntPtr * parm   = &retval;
                OSStatus result = API.GetEventParameter(inEvent,
                                                        EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero,
                                                        (uint)sizeof(IntPtr), IntPtr.Zero, (IntPtr)parm);
                windowRef = retval;
                return(result);
            }
        }
Exemplo n.º 10
0
        static internal ScrollDelta GetEventWheelScroll(IntPtr inEvent)
        {
            ScrollDelta scrolldelta = new ScrollDelta();
            Int32       delta;

            unsafe
            {
                Int32 *  d = δ
                OSStatus result;

                // vertical scroll Delta in pixels
                result = API.GetEventParameter(inEvent,
                                               EventParamName.MouseWheelSmoothVerticalDelta, EventParamType.typeSInt32,
                                               IntPtr.Zero, (uint)sizeof(int), IntPtr.Zero, (IntPtr)d);

                if (result == OSStatus.EventParameterNotFound)
                {
                    // it's okay for it to be simply missing...
                }
                else if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
                else
                {
                    scrolldelta.deltaY = delta / 20.0f;
                }

                // horizontal scroll Delta in pixels
                result = API.GetEventParameter(inEvent,
                                               EventParamName.MouseWheelSmoothHorizontalDelta, EventParamType.typeSInt32,
                                               IntPtr.Zero, (uint)sizeof(int), IntPtr.Zero, (IntPtr)d);

                if (result == OSStatus.EventParameterNotFound)
                {
                    // it's okay for it to be simply missing...
                }
                else if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
                else
                {
                    scrolldelta.deltaY = delta / 20.0f;
                }
            }

            return(scrolldelta);
        }
Exemplo n.º 11
0
        static internal OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt)
        {
            HIPoint point;

            unsafe
            {
                HIPoint *parm   = &point;
                OSStatus result = API.GetEventParameter(inEvent,
                                                        EventParamName.MouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
                                                        (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero,
                                                        (IntPtr)parm);
                pt = point;
                return(result);
            }
        }
Exemplo n.º 12
0
        internal static unsafe char GetEventKeyboardChar(IntPtr inEvent)
        {
            char     ch;
            char *   chPtr          = &ch;
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(char)), IntPtr.Zero, (IntPtr)((void *)chPtr));

            if (eventParameter != OSStatus.NoError)
            {
                throw new MacOSException(eventParameter);
            }
            else
            {
                return(ch);
            }
        }
Exemplo n.º 13
0
        internal static unsafe int GetEventMouseWheelDelta(IntPtr inEvent)
        {
            int      num;
            int *    numPtr         = #
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.MouseWheelDelta, EventParamType.typeSInt32, IntPtr.Zero, 4U, IntPtr.Zero, (IntPtr)((void *)numPtr));

            if (eventParameter != OSStatus.NoError)
            {
                throw new MacOSException(eventParameter);
            }
            else
            {
                return(num);
            }
        }
Exemplo n.º 14
0
        internal static unsafe MacOSKeyModifiers GetEventKeyModifiers(IntPtr inEvent)
        {
            uint     num;
            uint *   numPtr         = #
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.KeyModifiers, EventParamType.typeUInt32, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(uint)), IntPtr.Zero, (IntPtr)((void *)numPtr));

            if (eventParameter != OSStatus.NoError)
            {
                throw new MacOSException(eventParameter);
            }
            else
            {
                return((MacOSKeyModifiers)num);
            }
        }
Exemplo n.º 15
0
        internal static unsafe MouseButton GetEventMouseButton(IntPtr inEvent)
        {
            int      num;
            int *    numPtr         = #
            OSStatus eventParameter = API.GetEventParameter(inEvent, EventParamName.MouseButton, EventParamType.typeMouseButton, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(short)), IntPtr.Zero, (IntPtr)((void *)numPtr));

            if (eventParameter != OSStatus.NoError)
            {
                throw new MacOSException(eventParameter);
            }
            else
            {
                return((MouseButton)num);
            }
        }
Exemplo n.º 16
0
        static internal MacOSKeyModifiers GetEventKeyModifiers(IntPtr inEvent)
        {
            uint code;

            unsafe
            {
                uint *   codeAddr = &code;
                OSStatus result   = API.GetEventParameter(inEvent,
                                                          EventParamName.KeyModifiers, EventParamType.typeUInt32, IntPtr.Zero,
                                                          (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(uint)), IntPtr.Zero,
                                                          (IntPtr)codeAddr);
                if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
            }

            return((MacOSKeyModifiers)code);
        }
Exemplo n.º 17
0
        static internal MouseButton GetEventMouseButton(IntPtr inEvent)
        {
            int button;

            unsafe
            {
                int *    btn    = &button;
                OSStatus result = API.GetEventParameter(inEvent,
                                                        EventParamName.MouseButton, EventParamType.typeMouseButton, IntPtr.Zero,
                                                        (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(short)), IntPtr.Zero,
                                                        (IntPtr)btn);
                if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
            }

            return((MouseButton)button);
        }
Exemplo n.º 18
0
        internal static char GetEventKeyboardChar(IntPtr inEvent)
        {
            char code;

            unsafe
            {
                char *   codeAddr = &code;
                OSStatus result   = API.GetEventParameter(inEvent,
                                                          EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero,
                                                          (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(char)), IntPtr.Zero,
                                                          (IntPtr)codeAddr);
                if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
            }

            return(code);
        }
Exemplo n.º 19
0
        internal static char GetEventKeyboardChar(IntPtr inEvent)
        {
            char code;

            unsafe
            {
                char *codeAddr = &code;

                OSStatus result = API.GetEventParameter(inEvent,
                                                        EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero,
                                                        (uint)BlittableValueType <char> .Stride, IntPtr.Zero,
                                                        (IntPtr)codeAddr);

                if (result != OSStatus.NoError)
                {
                    throw new MacOSException(result);
                }
            }

            return(code);
        }