Пример #1
0
        public GtkWPFWidget(System.Windows.Controls.Control wpfControl)
        {
            wpfWindow = new System.Windows.Window {
                Content            = wpfControl,
                AllowsTransparency = true,
                WindowStyle        = WindowStyle.None,
                Background         = System.Windows.Media.Brushes.Transparent,
            };
            wpfWindow.PreviewKeyDown += (sender, e) => {
                // TODO: Some commands check for toplevels, and this window is not a toplevel.
                var key = e.Key == System.Windows.Input.Key.System ? e.SystemKey : e.Key;
                e.Handled = Ide.IdeApp.CommandService.ProcessKeyEvent(GtkWin32Interop.ConvertKeyEvent(e.KeyboardDevice.Modifiers, key));
            };

            wpfWindow.Closed += (sender, e) => {
                if (fromGtk)
                {
                    return;
                }

                Ide.IdeApp.Exit();
            };
            wpfWindow.ShowInTaskbar = false;
            WidgetFlags            |= WidgetFlags.NoWindow;
        }
Пример #2
0
        void AttachWindow()
        {
            IntPtr gtkWindowPtr = GtkWin32Interop.HWndGet(Ide.IdeApp.Workbench.RootWindow.GdkWindow);
            IntPtr wpfWindowPtr = new WindowInteropHelper(wpfWindow).Handle;

            GtkWin32Interop.SetWindowLongPtr(wpfWindowPtr, (int)GtkWin32Interop.GWLParameter.GWL_HWNDPARENT, gtkWindowPtr);
            Ide.IdeApp.Workbench.RootWindow.ConfigureEvent += OnWindowConfigured;
        }
Пример #3
0
        protected override void OnShown()
        {
            base.OnShown();

            IntPtr gtkWindowPtr = GtkWin32Interop.HWndGet(Ide.IdeApp.Workbench.RootWindow.GdkWindow);
            IntPtr wpfWindowPtr = wpfWidgetHost.Handle;

            GtkWin32Interop.SetWindowLongPtr(wpfWindowPtr, (int)GtkWin32Interop.GWLParameter.GWL_HWNDPARENT, gtkWindowPtr);
            Ide.IdeApp.Workbench.RootWindow.ConfigureEvent += OnWindowConfigured;
        }
Пример #4
0
        public GtkWPFWidget(System.Windows.Controls.Control wpfControl)
        {
            wpfWidgetHost = new System.Windows.Forms.Integration.ElementHost
            {
                BackColor = System.Drawing.Color.SeaGreen,
                Child     = wpfControl,
            };

            wpfControl.PreviewKeyDown += (sender, e) => {
                // TODO: Some commands check for toplevels, and this window is not a toplevel.
                if (e.Key == System.Windows.Input.Key.Escape)
                {
                    System.Windows.Input.Keyboard.ClearFocus();
                    MonoDevelop.Ide.IdeApp.Workbench.Present();
                    return;
                }

                var key = e.Key == System.Windows.Input.Key.System ? e.SystemKey : e.Key;
                e.Handled = Ide.IdeApp.CommandService.ProcessKeyEvent(GtkWin32Interop.ConvertKeyEvent(e.KeyboardDevice.Modifiers, key));
            };
            WidgetFlags |= WidgetFlags.NoWindow;
        }