Ejemplo n.º 1
0
        public CodeSegmentEditorWindow(MonoTextEditor 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();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Hide the completion window.
 /// </summary>
 private void HideCompletionWindow()
 {
     CompletionForm.Hide();
     textEditor.Document.ReadOnly = false;
     textEditor.GrabFocus();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Hide the completion window.
 /// </summary>
 private void HideCompletionWindow(object sender, EventArgs e)
 {
     textEditor.Document.ReadOnly = false;
     textEditor.GrabFocus();
 }