示例#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
        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;
        }