예제 #1
0
        public virtual IntPtr WindowProcedure(IntPtr hwnd, WmConstants msg, IntPtr wparam, IntPtr lparam)
        // Routine called by Windows whenever a new message is received for the current window.
        {
            switch (msg)
            {
            case WmConstants.Wm_erasebkgnd:
                return(IntPtr.Zero + 1);

            case WmConstants.Wm_paint:
                PaintDc l_dc = new PaintDc(this);
                l_dc.Get();
                ExposeActions?.Invoke(this, l_dc, l_dc.PaintRect());
                l_dc.Release();
                return(IntPtr.Zero);

            case WmConstants.Wm_lbuttondown:
                PointerButtonPressActions?.Invoke(this, (short)lparam.ToInt64(), (short)(lparam.ToInt64() >> 16), 1);
                return(IntPtr.Zero);

            case WmConstants.Wm_keydown:
                KeyDownActions?.Invoke(this, (int)wparam.ToInt64(), (int)lparam.ToInt64());
                return(IntPtr.Zero);

            case WmConstants.Wm_keyup:
                KeyUpActions?.Invoke(this, (int)wparam.ToInt64(), (int)lparam.ToInt64());
                return(IntPtr.Zero);

            case WmConstants.Wm_char:
                CharActions?.Invoke(this, (char)wparam.ToInt64(), (int)lparam.ToInt64());
                return(IntPtr.Zero);

            case WmConstants.Wm_close:
                // Temporary handling to close the application as soon as we close a window.
                CloseActions?.Invoke(this);
                return(IntPtr.Zero);

            default:
                return(Win32.DefWindowProc(hwnd, msg, wparam, lparam));
            }
        }
예제 #2
0
        /// <summary>
        /// Process events for the current window
        /// </summary>
        public virtual void ProcessEvent(SDL.SDL_Event e)
        {
            switch (e.type)
            {
            case SDL.SDL_EventType.SDL_QUIT:
                // When SDL sends a SDL_QUIT message, we have actually clicked on the close button.
                CloseActions?.Invoke();
                break;

            case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN:
                PointerButtonPressActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEBUTTONUP:
                PointerButtonReleaseActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEMOTION:
                MouseMoveActions?.Invoke(e.motion);
                break;

            case SDL.SDL_EventType.SDL_MOUSEWHEEL:
                MouseWheelActions?.Invoke(e.wheel);
                break;

            case SDL.SDL_EventType.SDL_KEYDOWN:
                KeyDownActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_KEYUP:
                KeyUpActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_TEXTEDITING:
                TextEditingActions?.Invoke(e.edit);
                break;

            case SDL.SDL_EventType.SDL_TEXTINPUT:
                TextInputActions?.Invoke(e.text);
                break;

            case SDL.SDL_EventType.SDL_JOYDEVICEADDED:
                JoystickDeviceAdded?.Invoke(e.jdevice.which);
                break;

            case SDL.SDL_EventType.SDL_JOYDEVICEREMOVED:
                JoystickDeviceRemoved?.Invoke(e.jdevice.which);
                break;

            case SDL.SDL_EventType.SDL_FINGERMOTION:
                FingerMoveActions?.Invoke(e.tfinger);
                break;

            case SDL.SDL_EventType.SDL_FINGERDOWN:
                FingerPressActions?.Invoke(e.tfinger);
                break;

            case SDL.SDL_EventType.SDL_FINGERUP:
                FingerReleaseActions?.Invoke(e.tfinger);
                break;

            case SDL.SDL_EventType.SDL_WINDOWEVENT:
            {
                switch (e.window.windowEvent)
                {
                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED:
                    ResizeBeginActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED:
                    ResizeEndActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
                    CloseActions?.Invoke();
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN:
                    ActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_HIDDEN:
                    DeActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MINIMIZED:
                    MinimizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MAXIMIZED:
                    MaximizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESTORED:
                    RestoredActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_ENTER:
                    MouseEnterActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_LEAVE:
                    MouseLeaveActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
                    FocusGainedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
                    FocusLostActions?.Invoke(e.window);
                    break;
                }
                break;
            }
            }
        }
예제 #3
0
        /// <summary>
        /// Process events for the current window
        /// </summary>
        public virtual void ProcessEvent(SDL.SDL_Event e)
        {
            switch (e.type)
            {
            case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN:
                PointerButtonPressActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEBUTTONUP:
                PointerButtonReleaseActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEMOTION:
                MouseMoveActions?.Invoke(e.motion);
                break;

            case SDL.SDL_EventType.SDL_MOUSEWHEEL:
                MouseWheelActions?.Invoke(e.wheel);
                break;

            case SDL.SDL_EventType.SDL_KEYDOWN:
                KeyDownActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_KEYUP:
                KeyUpActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_TEXTEDITING:
                TextEditingActions?.Invoke(e.edit);
                break;

            case SDL.SDL_EventType.SDL_TEXTINPUT:
                TextInputActions?.Invoke(e.text);
                break;

            case SDL.SDL_EventType.SDL_WINDOWEVENT:
            {
                switch (e.window.windowEvent)
                {
                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED:
                    ResizeBeginActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED:
                    ResizeEndActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
                    CloseActions?.Invoke();
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN:
                    ActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_HIDDEN:
                    DeActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MINIMIZED:
                    MinimizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MAXIMIZED:
                    MaximizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESTORED:
                    RestoredActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_ENTER:
                    MouseEnterActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_LEAVE:
                    MouseLeaveActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
                    FocusGainedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
                    FocusLostActions?.Invoke(e.window);
                    break;
                }
                break;
            }
            }
        }
예제 #4
0
파일: Window.cs 프로젝트: Alan-love/xenko
        /// <summary>
        /// Process events for the current window
        /// </summary>
        public virtual void ProcessEvent(Event e)
        {
            switch ((EventType)e.Type)
            {
            case EventType.Quit:
                // When SDL sends a SDL_QUIT message, we have actually clicked on the close button.
                CloseActions?.Invoke();
                break;

            case EventType.Mousebuttondown:
                PointerButtonPressActions?.Invoke(e.Button);
                break;

            case EventType.Mousebuttonup:
                PointerButtonReleaseActions?.Invoke(e.Button);
                break;

            case EventType.Mousemotion:
                MouseMoveActions?.Invoke(e.Motion);
                break;

            case EventType.Mousewheel:
                MouseWheelActions?.Invoke(e.Wheel);
                break;

            case EventType.Keydown:
                KeyDownActions?.Invoke(e.Key);
                break;

            case EventType.Keyup:
                KeyUpActions?.Invoke(e.Key);
                break;

            case EventType.Textediting:
                TextEditingActions?.Invoke(e.Edit);
                break;

            case EventType.Textinput:
                TextInputActions?.Invoke(e.Text);
                break;

            case EventType.Joydeviceadded:
                JoystickDeviceAdded?.Invoke(e.Jdevice.Which);
                break;

            case EventType.Joydeviceremoved:
                JoystickDeviceRemoved?.Invoke(e.Jdevice.Which);
                break;

            case EventType.Fingermotion:
                FingerMoveActions?.Invoke(e.Tfinger);
                break;

            case EventType.Fingerdown:
                FingerPressActions?.Invoke(e.Tfinger);
                break;

            case EventType.Fingerup:
                FingerReleaseActions?.Invoke(e.Tfinger);
                break;

            case EventType.Dropfile:
                DropFileActions?.Invoke(Silk.NET.Core.Native.SilkMarshal.PtrToString((IntPtr)e.Drop.File, Silk.NET.Core.Native.NativeStringEncoding.UTF8));
                break;

            case EventType.Windowevent:
            {
                switch ((WindowEventID)e.Window.Event)
                {
                case WindowEventID.WindoweventSizeChanged:
                    ResizeBeginActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventResized:
                    ResizeEndActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventClose:
                    CloseActions?.Invoke();
                    break;

                case WindowEventID.WindoweventShown:
                    ActivateActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventHidden:
                    DeActivateActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventMinimized:
                    MinimizedActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventMaximized:
                    MaximizedActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventRestored:
                    RestoredActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventEnter:
                    MouseEnterActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventLeave:
                    MouseLeaveActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventFocusGained:
                    FocusGainedActions?.Invoke(e.Window);
                    break;

                case WindowEventID.WindoweventFocusLost:
                    FocusLostActions?.Invoke(e.Window);
                    break;
                }
                break;
            }
            }
        }
예제 #5
0
        /// <summary>
        /// Process events for the current window
        /// </summary>
        public virtual void ProcessEvent(SDL.SDL_Event e)
        {
            switch (e.type)
            {
            case SDL.SDL_EventType.SDL_QUIT:
                // When SDL sends a SDL_QUIT message, we have actually clicked on the close button.
                CloseActions?.Invoke();
                break;

            case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN:
                PointerButtonPressActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEBUTTONUP:
                PointerButtonReleaseActions?.Invoke(e.button);
                break;

            case SDL.SDL_EventType.SDL_MOUSEMOTION:
                MouseMoveActions?.Invoke(e.motion);
                break;

            case SDL.SDL_EventType.SDL_MOUSEWHEEL:
                // To match the Windows behavior we multiply the value by 120
                e.wheel.x *= 120;
                e.wheel.y *= 120;
                MouseWheelActions?.Invoke(e.wheel);
                break;

            case SDL.SDL_EventType.SDL_KEYDOWN:
                KeyDownActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_KEYUP:
                KeyUpActions?.Invoke(e.key);
                break;

            case SDL.SDL_EventType.SDL_TEXTEDITING:
                TextEditingActions?.Invoke(e.edit);
                break;

            case SDL.SDL_EventType.SDL_TEXTINPUT:
                TextInputActions?.Invoke(e.text);
                break;

            case SDL.SDL_EventType.SDL_WINDOWEVENT:
            {
                switch (e.window.windowEvent)
                {
                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED:
                    ResizeBeginActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED:
                    ResizeEndActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
                    CloseActions?.Invoke();
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN:
                    ActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_HIDDEN:
                    DeActivateActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MINIMIZED:
                    MinimizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MAXIMIZED:
                    MaximizedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESTORED:
                    RestoredActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_ENTER:
                    MouseEnterActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_LEAVE:
                    MouseLeaveActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
                    FocusGainedActions?.Invoke(e.window);
                    break;

                case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
                    FocusLostActions?.Invoke(e.window);
                    break;
                }
                break;
            }
            }
        }
예제 #6
0
 /// コンストラクタ
 public ProfileClosingEventArgs(CloseActions action, string profileName)
 {
     this.Action = action;
     this.ProfileName = profileName;
 }
예제 #7
0
 /// コンストラクタ
 public ProfileClosingEventArgs(CloseActions action, string profileName)
 {
     this.Action      = action;
     this.ProfileName = profileName;
 }