Esempio n. 1
0
        public void Run(string[] args)
        {
            swf.Application.EnableVisualStyles();
            if (!EtoEnvironment.Platform.IsMono)
            {
                swf.Application.DoEvents();
            }

            Application app = ((Application)Widget);

            app.OnInitialized(EventArgs.Empty);

            if (EnableScrollingUnderMouse)
            {
                swf.Application.AddMessageFilter(new ScrollMessageFilter());
            }

            if (BubbleMouseEvents)
            {
                var bubble = new BubbleEventFilter();
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseWheel(e), null, (int)Win32.WM.MOUSEWHEEL);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseMove(e), null, (int)Win32.WM.MOUSEMOVE);
                bubble.AddBubbleMouseEvents((c, e) => c.OnMouseDown(e), true, (int)Win32.WM.LBUTTONDOWN, (int)Win32.WM.RBUTTONDOWN, (int)Win32.WM.MBUTTONDOWN);
                bubble.AddBubbleMouseEvents((c, e) => c.OnMouseDoubleClick(e), null, (int)Win32.WM.LBUTTONDBLCLK, (int)Win32.WM.RBUTTONDBLCLK, (int)Win32.WM.MBUTTONDBLCLK);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, (int)Win32.WM.LBUTTONUP, b => MouseButtons.Primary);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, (int)Win32.WM.RBUTTONUP, b => MouseButtons.Alternate);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, (int)Win32.WM.MBUTTONUP, b => MouseButtons.Middle);
                swf.Application.AddMessageFilter(bubble);
            }

            if (app.MainForm != null && app.MainForm.Loaded)
            {
                swf.Application.Run((swf.Form)app.MainForm.ControlObject);
            }
            else
            {
                swf.Application.Run();
            }
        }
Esempio n. 2
0
        static void SetOptions()
        {
            if (EnableScrollingUnderMouse)
            {
                swf.Application.AddMessageFilter(new ScrollMessageFilter());
            }

            if (BubbleMouseEvents)
            {
                var bubble = new BubbleEventFilter();
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseWheel(e), null, Win32.WM.MOUSEWHEEL);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseMove(e), null, Win32.WM.MOUSEMOVE);
                bubble.AddBubbleMouseEvents((c, e) => c.OnMouseDown(e), true, Win32.WM.LBUTTONDOWN, Win32.WM.RBUTTONDOWN, Win32.WM.MBUTTONDOWN);
                bubble.AddBubbleMouseEvents((c, e) => {
                    c.OnMouseDoubleClick(e);
                    if (!e.Handled)
                    {
                        c.OnMouseDown(e);
                    }
                }, null, Win32.WM.LBUTTONDBLCLK, Win32.WM.RBUTTONDBLCLK, Win32.WM.MBUTTONDBLCLK);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, Win32.WM.LBUTTONUP, b => MouseButtons.Primary);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, Win32.WM.RBUTTONUP, b => MouseButtons.Alternate);
                bubble.AddBubbleMouseEvent((c, e) => c.OnMouseUp(e), false, Win32.WM.MBUTTONUP, b => MouseButtons.Middle);
                swf.Application.AddMessageFilter(bubble);
            }
            if (BubbleKeyEvents)
            {
                var bubble = new BubbleEventFilter();
                bubble.AddBubbleKeyEvent((c, e) => c.OnKeyDown(e), Win32.WM.KEYDOWN, KeyEventType.KeyDown);
                bubble.AddBubbleKeyEvent((c, e) => c.OnKeyDown(e), Win32.WM.SYSKEYDOWN, KeyEventType.KeyDown);
                bubble.AddBubbleKeyCharEvent((c, e) => c.OnKeyDown(e), Win32.WM.CHAR, KeyEventType.KeyDown);
                bubble.AddBubbleKeyCharEvent((c, e) => c.OnKeyDown(e), Win32.WM.SYSCHAR, KeyEventType.KeyDown);
                bubble.AddBubbleKeyEvent((c, e) => c.OnKeyUp(e), Win32.WM.KEYUP, KeyEventType.KeyUp);
                bubble.AddBubbleKeyEvent((c, e) => c.OnKeyUp(e), Win32.WM.SYSKEYUP, KeyEventType.KeyUp);
                swf.Application.AddMessageFilter(bubble);
            }
        }