public CodeSegmentEditorWindow(TextEditor editor) : base(Gtk.WindowType.Toplevel) { Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.Child = codeSegmentEditor; scrolledWindow.ShadowType = Gtk.ShadowType.In; Child = scrolledWindow; codeSegmentEditor.Realize(); ((SimpleEditMode)codeSegmentEditor.CurrentMode).AddBinding(Gdk.Key.Escape, Close); TextEditorOptions options = new TextEditorOptions(); options.FontName = editor.Options.FontName; options.ColorScheme = editor.Options.ColorScheme; options.ShowRuler = false; options.ShowLineNumberMargin = false; options.ShowFoldMargin = false; options.ShowIconMargin = false; options.Zoom = 0.8; codeSegmentEditor.Document.MimeType = editor.MimeType; codeSegmentEditor.Document.ReadOnly = true; codeSegmentEditor.Options = options; codeSegmentEditor.KeyPressEvent += delegate(object o, Gtk.KeyPressEventArgs args) { if (args.Event.Key == Gdk.Key.Escape) { Destroy(); } }; Gtk.Widget parent = editor.Parent; while (parent != null && !(parent is Gtk.Window)) { parent = parent.Parent; } if (parent is Gtk.Window) { this.TransientFor = (Gtk.Window)parent; } this.SkipTaskbarHint = true; this.Decorated = false; Gdk.Pointer.Grab(this.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask, null, null, Gtk.Global.CurrentEventTime); Gtk.Grab.Add(this); GrabBrokenEvent += delegate { Destroy(); }; codeSegmentEditor.GrabFocus(); }