Exemple #1
0
        Xwt.Command ShowDialogWithParent(AddPackageSourceDialog dialog)
        {
            Xwt.WindowFrame parent = Xwt.Toolkit.CurrentEngine.WrapWindow(Toplevel);
            Xwt.Command     result = dialog.Run(parent);

            // Ensure dialog has focus after browsing for a folder.
            IdeServices.DesktopService.FocusWindow(parent);

            return(result);
        }
Exemple #2
0
        public override bool IsInteractive(MonoTextEditor editor, Xwt.WindowFrame tipWindow)
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return(false);
            }
            return(provider.IsInteractive(wrappedEditor, tipWindow));
        }
Exemple #3
0
        public override Xwt.WindowFrame ShowTooltipWindow(MonoTextEditor editor, Xwt.WindowFrame tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, Ide.Editor.TooltipItem item)
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return(tipWindow);
            }
            provider.ShowTooltipWindow(wrappedEditor, tipWindow, item, modifierState.ToXwtValue(), mouseX, mouseY);
            return(tipWindow);
        }
Exemple #4
0
        public static WindowTransparencyDecorator Attach(Xwt.WindowFrame window)
        {
            //var gtkWindow = (Xwt.Toolkit.GetBackend (window) as Xwt.Backends.IWindowFrameBackend)?.Window as Gtk.Window;
            var gtkWindow = Xwt.Toolkit.Load(Xwt.ToolkitType.Gtk).GetNativeWindow(window) as Gtk.Window;

            if (gtkWindow != null)
            {
                return(new WindowTransparencyDecorator(gtkWindow));
            }
            throw new NotSupportedException();
        }
        public virtual Xwt.WindowFrame ShowTooltipWindow(MonoTextEditor editor, Xwt.WindowFrame tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, MonoDevelop.Ide.Editor.TooltipItem item)
        {
            int    w;
            double xalign;

            GetRequiredPosition(editor, tipWindow, out w, out xalign);

            ShowAndPositionTooltip(editor, tipWindow, mouseX, mouseY, w, xalign);

            return(tipWindow);
        }
Exemple #6
0
        protected override void GetRequiredPosition(MonoTextEditor editor, Xwt.WindowFrame tipWindow, out int requiredWidth, out double xalign)
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                requiredWidth = 0;
                xalign        = 0;
                return;
            }
            provider.GetRequiredPosition(wrappedEditor, tipWindow, out requiredWidth, out xalign);
        }
Exemple #7
0
        protected void OnButtonNewTagClicked(object sender, EventArgs e)
        {
            using (var dlg = new GitSelectRevisionDialog(repo)) {
                Xwt.WindowFrame parent = Xwt.Toolkit.CurrentEngine.WrapWindow(this);
                if (dlg.Run(parent) != Xwt.Command.Ok)
                {
                    return;
                }

                repo.AddTag(dlg.TagName, dlg.SelectedRevision, dlg.TagMessage);
                FillTags();
            }
        }
Exemple #8
0
        public override void TakeMouseControl(MonoTextEditor editor, Xwt.WindowFrame tipWindow)
        {
            if (!IsMouseOver(tipWindow))
            {
                editor.TextArea.HideTooltip();
            }
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return;
            }
            provider.TakeMouseControl(wrappedEditor, tipWindow);
        }
        protected async void OnButtonNewTagClicked(object sender, EventArgs e)
        {
            using (var dlg = new GitSelectRevisionDialog(repo)) {
                Xwt.WindowFrame parent = Xwt.Toolkit.CurrentEngine.WrapWindow(this);
                if (dlg.Run(parent) != Xwt.Command.Ok)
                {
                    return;
                }

                var token = destroyTokenSource.Token;
                await repo.AddTagAsync(dlg.TagName, dlg.SelectedRevision, dlg.TagMessage, token);

                if (!token.IsCancellationRequested)
                {
                    FillTags();
                }
            }
        }
        internal static void ShowAndPositionTooltip(MonoTextEditor editor, Xwt.WindowFrame tipWindow, int mouseX, int mouseY, int width, double xalign)
        {
            int ox = 0, oy = 0;

            if (editor.GdkWindow != null)
            {
                editor.GdkWindow.GetOrigin(out ox, out oy);
            }

            width += 10;

            int x = mouseX + ox + editor.Allocation.X;
            int y = mouseY + oy + editor.Allocation.Y;

            Gdk.Rectangle geometry = editor.Screen.GetUsableMonitorGeometry(editor.Screen.GetMonitorAtPoint(x, y));

            x -= (int)((double)width * xalign);
            y += 10;

            if (x + width >= geometry.X + geometry.Width)
            {
                x = geometry.X + geometry.Width - width;
            }
            if (x < geometry.Left)
            {
                x = geometry.Left;
            }

            int h = (int)tipWindow.Height;

            if (y + h >= geometry.Y + geometry.Height)
            {
                y = geometry.Y + geometry.Height - h;
            }
            if (y < geometry.Top)
            {
                y = geometry.Top;
            }

            tipWindow.Location = new Xwt.Point(x, y);

            tipWindow.Show();
        }
Exemple #11
0
        /// <summary>Shows dialog</summary>
        /// <returns><value>True</value> if user want to proceed current operation, and <value>False</value> if user don't.</returns>
        public bool ShowDialog(Xwt.WindowFrame parent = null)
        {
            Build();
            Xwt.Command DialogResult = null;
            if (parent == null)
            {
                DialogResult = this.Run();
            }
            else
            {
                DialogResult = this.Run(parent);
            }
            //4beginners: xwtdialog.Run() == winform.ShowDialog() == vb6form.Show(vbModal);

            if (DialogResult == null)
            {
                return(false);
            }
            switch (DialogResult.Id)             //hack due to C# limitation (it's unable to do switch(){} on custon types)
            {
            case "Add":
            case "Apply":
            case "Clear":
            case "Copy":
            case "Cut":
            case "Delete":
            case "Ok":
            case "Paste":
            case "Remove":
            case "Save":
            case "SaveAs":
            case "Yes":
                return(true);
            }
            return(false);
        }
Exemple #12
0
        static bool IsMouseOver(Xwt.WindowFrame tipWidget)
        {
            var mousePosition = Xwt.Desktop.MouseLocation;

            return(tipWidget.ScreenBounds.Contains(mousePosition));
        }
 public override bool TryCloseTooltipWindow(Xwt.WindowFrame tipWindow, Ide.Editor.TooltipCloseReason reason)
 {
     return(provider.TryCloseTooltipWindow(tipWindow, reason));
 }
Exemple #14
0
        protected override Xwt.Point CalculateWindowLocation(TextEditor editor, TooltipItem item, Xwt.WindowFrame xwtWindow, int mouseX, int mouseY, Xwt.Point origin)
        {
            int    w;
            double xalign;

            GetRequiredPosition(editor, xwtWindow, out w, out xalign);
            w += 10;
            var allocation = GetAllocation(editor);

            var info = (TaggedTooltipInformation <CodeActions.CodeActionContainer>)item.Item;
            var loc  = editor.OffsetToLocation(info.Tag.Span.Start);
            var p    = editor.LocationToPoint(loc);
            var view = editor.GetContent <SourceEditorView> ();
            int x    = (int)(p.X + origin.X + allocation.X + xPadding);
            int y    = (int)(p.Y + view.TextEditor.GetLineHeight(loc.Line) + origin.Y + allocation.Y + yPadding);

            Gtk.Widget widget   = editor;
            var        geometry = widget.Screen.GetUsableMonitorGeometry(widget.Screen.GetMonitorAtPoint(x, y));

            if (x + w >= geometry.X + geometry.Width)
            {
                x = geometry.X + geometry.Width - w;
            }
            if (x < geometry.Left)
            {
                x = geometry.Left;
            }

            if (info.Tag?.FloatingWidgetShown == true)
            {
                x += windowSize;
            }

            int h = (int)xwtWindow.Size.Height;

            if (y + h >= geometry.Y + geometry.Height)
            {
                y = geometry.Y + geometry.Height - h;
            }
            if (y < geometry.Top)
            {
                y = geometry.Top;
            }

            return(new Xwt.Point(x, y));
        }
Exemple #15
0
 public virtual override object GetNativeWindow(Xwt.WindowFrame window)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
        protected virtual Xwt.Point CalculateWindowLocation(TextEditor editor, TooltipItem item, Xwt.WindowFrame xwtWindow, int mouseX, int mouseY, Xwt.Point origin)
        {
            int    w;
            double xalign;

            GetRequiredPosition(editor, xwtWindow, out w, out xalign);
            w += 10;

            var allocation = GetAllocation(editor);
            int x          = (int)(mouseX + origin.X + allocation.X);
            int y          = (int)(mouseY + origin.Y + allocation.Y);

            Gtk.Widget widget   = editor;
            var        geometry = widget.Screen.GetUsableMonitorGeometry(widget.Screen.GetMonitorAtPoint(x, y));

            x -= (int)((double)w * xalign);
            y += 10;

            if (x + w >= geometry.X + geometry.Width)
            {
                x = geometry.X + geometry.Width - w;
            }
            if (x < geometry.Left)
            {
                x = geometry.Left;
            }

            int h = (int)xwtWindow.Size.Height;

            if (y + h >= geometry.Y + geometry.Height)
            {
                y = geometry.Y + geometry.Height - h;
            }
            if (y < geometry.Top)
            {
                y = geometry.Top;
            }

            return(new Xwt.Point(x, y));
        }
Exemple #17
0
        public bool RunWizard(Xwt.WindowFrame parentWindow)
        {
            var dialog = new WizardDialog(this);

            return(dialog.Run(parentWindow));
        }
 Xwt.Command ShowDialogWithParent(AddPackageSourceDialog dialog)
 {
     Xwt.WindowFrame parent = Xwt.Toolkit.CurrentEngine.WrapWindow(Toplevel);
     return(dialog.Run(parent));
 }
 protected virtual void GetRequiredPosition(MonoTextEditor editor, Xwt.WindowFrame tipWindow, out int requiredWidth, out double xalign)
 {
     requiredWidth = (int)tipWindow.Width;
     xalign        = 0.5;
 }
 public virtual bool IsInteractive(MonoTextEditor editor, Xwt.WindowFrame tipWindow)
 {
     return(false);
 }
Exemple #21
0
 internal protected XwtWindowControl(Xwt.WindowFrame window) : base(window)
 {
     this.window = window;
 }
Exemple #22
0
 public static Xwt.Backends.IWindowBackend GetBackend(this Xwt.WindowFrame o)
 {
     return((Xwt.Backends.IWindowBackend)Xwt.Toolkit.CurrentEngine.GetSafeBackend(o));
 }
 public virtual void TakeMouseControl(MonoTextEditor editor, Xwt.WindowFrame tipWindow)
 {
 }
 public virtual Xwt.Command Run(Xwt.WindowFrame transientFor, Xwt.MessageDescription message)
 {
     throw new NotImplementedException();
 }