Ejemplo n.º 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));
            }
        }
Ejemplo n.º 2
0
 public static extern bool PostMessage(IntPtr hWnd, WmConstants msg, IntPtr wParam, IntPtr lParam);
Ejemplo n.º 3
0
 public static extern IntPtr DefWindowProc(IntPtr hWnd, WmConstants msg, IntPtr wParam, IntPtr lParam);
Ejemplo n.º 4
0
 public static extern bool PostMessage(IntPtr hWnd, WmConstants msg, IntPtr wParam, IntPtr lParam);
Ejemplo n.º 5
0
 public static extern IntPtr DefWindowProc(IntPtr hWnd, WmConstants msg, IntPtr wParam, IntPtr lParam);
Ejemplo n.º 6
0
        // Routine called by Windows whenever a new message is received for the current window.
        public virtual IntPtr WindowProcedure(IntPtr hwnd, WmConstants msg, IntPtr wparam, IntPtr lparam)
        {
            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);
            }
        }