Пример #1
0
        static Command GenericAlert(WindowFrame parent, MessageDescription message)
        {
            if (message.ApplyToAllButton != null)
            {
                return(message.ApplyToAllButton);
            }

            IAlertDialogBackend backend = Toolkit.CurrentEngine.Backend.CreateBackend <IAlertDialogBackend> ();

            backend.Initialize(Toolkit.CurrentEngine.Context);
            if (message.Icon != null)
            {
                message.Icon.InitForToolkit(Toolkit.CurrentEngine);
            }

            using (backend) {
                Command res = null;
                Toolkit.CurrentEngine.InvokePlatformCode(delegate {
                    res = backend.Run(parent ?? RootWindow, message);
                });

                if (backend.ApplyToAll)
                {
                    message.ApplyToAllButton = res;
                }

                return(res);
            }
        }
Пример #2
0
 public Command Run(WindowFrame parent)
 {
     Toolkit.InvokePlatformCode(delegate {
         Backend.RunLoop((IWindowFrameBackend)WidgetRegistry.GetBackend(parent));
     });
     return(resultCommand);
 }
Пример #3
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public bool Run(WindowFrame parentWindow)
        {
            var backend = Toolkit.CurrentEngine.Backend.CreateBackend <ISelectFontDialogBackend> ();

            if (backend == null)
            {
                backend = new DefaultSelectFontDialogBackend(parentWindow);
            }
            try {
                backend.SelectedFont = SelectedFont;
                backend.Title        = Title;
                backend.PreviewText  = PreviewText;
                bool result = false;
                Toolkit.CurrentEngine.InvokePlatformCode(delegate {
                    result = backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow));
                });
                return(result);
            } catch (Exception ex) {
                Console.WriteLine(ex);
                return(false);
            } finally {
                font = backend.SelectedFont;
                backend.Dispose();
            }
        }
Пример #4
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public bool Run(WindowFrame parentWindow)
        {
            try {
                running = true;
                Backend.Initialize(multiselect);
                if (!string.IsNullOrEmpty(currentFolder))
                {
                    Backend.CurrentFolder = currentFolder;
                }
                if (!string.IsNullOrEmpty(title))
                {
                    Backend.Title = title;
                }
                Backend.CanCreateFolders = canCreateFolders;

                bool result = false;
                BackendHost.ToolkitEngine.InvokePlatformCode(delegate {
                    result = Backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow));
                });
                return(result);
            } finally {
                currentFolder = Backend.CurrentFolder;
                folder        = Backend.Folder;
                folders       = Backend.Folders;
                currentFolder = Backend.CurrentFolder;
                running       = false;
                Backend.Cleanup();
            }
        }
Пример #5
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize(filters, multiselect, initialFileName);
         if (!string.IsNullOrEmpty(currentFolder))
         {
             Backend.CurrentFolder = currentFolder;
         }
         if (activeFilter != null)
         {
             Backend.ActiveFilter = activeFilter;
         }
         if (!string.IsNullOrEmpty(title))
         {
             Backend.Title = title;
         }
         return(Backend.Run((IWindowFrameBackend)BackendHost.ToolkitEngine.GetSafeBackend(parentWindow)));
     } finally {
         currentFolder = Backend.CurrentFolder;
         activeFilter  = Backend.ActiveFilter;
         fileName      = Backend.FileName;
         fileNames     = Backend.FileNames;
         currentFolder = Backend.CurrentFolder;
         running       = false;
         Backend.Cleanup();
     }
 }
Пример #6
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize(filters, multiselect, initialFileName);
         if (!string.IsNullOrEmpty(currentFolder))
         {
             Backend.CurrentFolder = currentFolder;
         }
         if (activeFilter != null)
         {
             Backend.ActiveFilter = activeFilter;
         }
         if (!string.IsNullOrEmpty(title))
         {
             Backend.Title = title;
         }
         bool result = false;
         BackendHost.ToolkitEngine.InvokePlatformCode(delegate {
             result = Backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow));
         });
         return(result);
     } finally {
         activeFilter = Backend.ActiveFilter;
         fileName     = Backend.FileName;
         fileNames    = Backend.FileNames;
         if (fileName != string.Empty)
         {
             currentFolder = Backend.CurrentFolder;
         }
         running = false;
         Backend.Cleanup();
     }
 }
Пример #7
0
 public static void ShowMessage(WindowFrame parent, string primaryText, string secondaryText, string title, Drawing.Image icon)
 {
     if (string.IsNullOrEmpty(title))
     {
         title = parent?.Title ?? Application.TranslationCatalog.GetString("Information");
     }
     GenericAlert(parent, icon, primaryText, secondaryText, title, Command.Ok);
 }
Пример #8
0
 public static void ShowError(WindowFrame parent, string primaryText, string secondaryText, string title)
 {
     if (string.IsNullOrEmpty(title))
     {
         title = parent?.Title ?? Application.TranslationCatalog.GetString("Error");
     }
     GenericAlert(parent, Toolkit.CurrentEngine.Defaults.MessageDialog.ErrorIcon, primaryText, secondaryText, title, Command.Ok);
 }
Пример #9
0
        public Command Run(WindowFrame parent)
        {
            BackendHost.ToolkitEngine.ValidateObject(parent);

            BackendHost.ToolkitEngine.InvokePlatformCode(delegate {
                Backend.RunLoop((IWindowFrameBackend)Toolkit.GetBackend(parent));
            });
            return(resultCommand);
        }
Пример #10
0
        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);
        }
Пример #11
0
 public Popover(WindowFrame parent, Widget child, Position arrowPosition)
 {
     this.arrowPosition = arrowPosition;
     backend = WidgetRegistry.CreateBackend<IPopoverBackend> (GetType ());
     backend.Init ((IWindowFrameBackend) WidgetRegistry.GetBackend (parent),
                   (IWidgetBackend) WidgetRegistry.GetBackend (child), arrowPosition);
     backend.Closed += (sender, e) => {
         if (Closed != null)
             Closed (this, EventArgs.Empty);
     };
 }
Пример #12
0
		/// <summary>
		/// Shows the dialog.
		/// </summary>
		public bool Run (WindowFrame parentWindow)
		{
			var backend = Toolkit.CurrentEngine.Backend.CreateBackend<ISelectColorDialogBackend> ();
			try {
				if (color != Colors.Transparent)
					backend.Color = color;
				return backend.Run ((IWindowFrameBackend)Toolkit.CurrentEngine.GetSafeBackend (parentWindow), title, supportsAlpha);
			} finally {
				color = backend.Color;
				backend.Dispose ();
			}
		}
Пример #13
0
        public Command Run(WindowFrame parent)
        {
            if (parent != null)
            {
                TransientFor = parent;
            }
            AdjustSize();

            loopEnded = false;
            BackendHost.ToolkitEngine.InvokePlatformCode(delegate {
                Backend.RunLoop((IWindowFrameBackend)Toolkit.GetBackend(parent));
            });
            return(resultCommand);
        }
Пример #14
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public bool Run(WindowFrame parentWindow)
        {
            var backend = WidgetRegistry.CreateBackend <ISelectColorDialogBackend> (GetType());

            try {
                if (color != Colors.Transparent)
                {
                    backend.Color = color;
                }
                return(backend.Run((IWindowFrameBackend)WidgetRegistry.GetBackend(parentWindow), title, supportsAlpha));
            } finally {
                color = backend.Color;
                backend.Dispose();
            }
        }
Пример #15
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public bool Run(WindowFrame parentWindow)
        {
            var backend = Toolkit.CurrentEngine.Backend.CreateBackend <ISelectColorDialogBackend> ();

            try {
                if (color != Colors.Transparent)
                {
                    backend.Color = color;
                }
                return(backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow), title, supportsAlpha));
            } finally {
                color = backend.Color;
                backend.Dispose();
            }
        }
Пример #16
0
        static Command GenericAlert(WindowFrame parent, Xwt.Drawing.Image icon, string primaryText, string secondaryText, int defaultButton, params Command[] buttons)
        {
            GenericMessage message = new GenericMessage()
            {
                Icon          = icon,
                Text          = primaryText,
                SecondaryText = secondaryText,
                DefaultButton = defaultButton
            };

            foreach (Command but in buttons)
            {
                message.Buttons.Add(but);
            }

            return(GenericAlert(parent, message));
        }
Пример #17
0
        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();
        }
Пример #18
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        public bool Run(WindowFrame parentWindow)
        {
            var backend = Toolkit.CurrentEngine.Backend.CreateBackend <ISelectColorDialogBackend> ();

            try {
                if (color != Colors.Transparent)
                {
                    backend.Color = color;
                }
                bool result = false;
                Toolkit.CurrentEngine.InvokePlatformCode(delegate {
                    result = backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow), title, supportsAlpha);
                });
                return(result);
            } finally {
                color = backend.Color;
                backend.Dispose();
            }
        }
Пример #19
0
        public DefaultSelectFontDialogBackend(WindowFrame parentWindow)
        {
            parent = parentWindow;

            fontDialog        = new Dialog();
            fontDialog.Width  = 500;
            fontDialog.Height = 300;

            VBox box = new VBox();

            fontSelector              = new FontSelector();
            fontSelector.FontChanged += (sender, e) => SelectedFont = fontSelector.SelectedFont;
            box.PackStart(fontSelector, true);

            fontDialog.Content = box;

            fontDialog.Buttons.Add(new DialogButton(Command.Cancel));
            fontDialog.Buttons.Add(new DialogButton(Command.Ok));
        }
Пример #20
0
        static Command GenericAlert(WindowFrame parent, MessageDescription message)
        {
            if (message.ApplyToAllButton != null)
            {
                return(message.ApplyToAllButton);
            }

            IAlertDialogBackend backend = WidgetRegistry.CreateBackend <IAlertDialogBackend> (typeof(IAlertDialogBackend));

            using (backend) {
                var res = backend.Run(parent ?? RootWindow, message);

                if (backend.ApplyToAll)
                {
                    message.ApplyToAllButton = res;
                }

                return(res);
            }
        }
Пример #21
0
        public RunConfigurationNameDialog(Xwt.WindowFrame parent, string name, Command action, IEnumerable <string> invalidNames)
        {
            TransientFor      = parent;
            Resizable         = false;
            Width             = 300;
            this.invalidNames = invalidNames;
            mainBox           = new VBox();
            var box = new HBox();

            mainBox.PackStart(box, true);
            box.PackStart(new Label(GettextCatalog.GetString("Name")), false);
            entry      = new TextEntry();
            entry.Text = name ?? "";
            box.PackStart(entry, true);
            Content = mainBox;

            Buttons.Add(new DialogButton(Command.Cancel));
            Buttons.Add(okButton = new DialogButton(action));
            this.DefaultCommand  = okButton.Command;
            entry.Activated     += Entry_Activated;
            entry.Changed       += (s, o) => UpdateControls();
        }
Пример #22
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize(multiselect);
         if (!string.IsNullOrEmpty(currentFolder))
         {
             Backend.CurrentFolder = currentFolder;
         }
         if (!string.IsNullOrEmpty(title))
         {
             Backend.Title = title;
         }
         return(Backend.Run((IWindowFrameBackend)WidgetRegistry.GetBackend(parentWindow)));
     } finally {
         currentFolder = Backend.CurrentFolder;
         folder        = Backend.Folder;
         folders       = Backend.Folders;
         currentFolder = Backend.CurrentFolder;
         running       = false;
         Backend.Cleanup();
     }
 }
Пример #23
0
		public Command Run (WindowFrame parent)
		{
			BackendHost.ToolkitEngine.ValidateObject (parent);
			if (parent != null)
				TransientFor = parent;
			AdjustSize ();

			loopEnded = false;
			BackendHost.ToolkitEngine.InvokePlatformCode (delegate {
				Backend.RunLoop ((IWindowFrameBackend) Toolkit.GetBackend (parent));
			});
			return resultCommand;
		}
Пример #24
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize (filters, multiselect, initialFileName);
         if (!string.IsNullOrEmpty (currentFolder))
             Backend.CurrentFolder = currentFolder;
         if (activeFilter != null)
             Backend.ActiveFilter = activeFilter;
         if (!string.IsNullOrEmpty (title))
             Backend.Title = title;
         return Backend.Run ((IWindowFrameBackend)backendHost.ToolkitEngine.GetSafeBackend (parentWindow));
     } finally {
         currentFolder = Backend.CurrentFolder;
         activeFilter = Backend.ActiveFilter;
         fileName = Backend.FileName;
         fileNames = Backend.FileNames;
         currentFolder = Backend.CurrentFolder;
         running = false;
         Backend.Cleanup ();
     }
 }
Пример #25
0
 public static void ShowWarning(WindowFrame parent, string primaryText, string secondaryText)
 {
     GenericAlert(parent, StockIcons.Warning, primaryText, secondaryText, Command.Ok);
 }
Пример #26
0
 public static void ShowError(WindowFrame parent, string primaryText)
 {
     ShowError(parent, primaryText, null);
 }
Пример #27
0
 static Command GenericAlert(WindowFrame parent, Xwt.Drawing.Image icon, string primaryText, string secondaryText, params Command[] buttons)
 {
     return(GenericAlert(parent, icon, primaryText, secondaryText, buttons.Length - 1, buttons));
 }
Пример #28
0
 public static void ShowMessage(WindowFrame parent, string primaryText, string secondaryText)
 {
     ShowMessage(parent, StockIcons.Information, primaryText, secondaryText);
 }
Пример #29
0
 internal void SetParentWindow(WindowFrame win)
 {
     parentWindow = win;
 }
Пример #30
0
 static Command GenericAlert(WindowFrame parent, Xwt.Drawing.Image icon, string primaryText, string secondaryText, params Command[] buttons)
 {
     return GenericAlert (parent, icon, primaryText, secondaryText, buttons.Length - 1, buttons);
 }
Пример #31
0
		public DefaultSelectFontDialogBackend (WindowFrame parentWindow)
		{
			parent = parentWindow;

			fontDialog = new Dialog ();
			fontDialog.Width = 500;
			fontDialog.Height = 300;

			VBox box = new VBox ();
			fontSelector = new FontSelector ();
			fontSelector.FontChanged += (sender, e) => SelectedFont = fontSelector.SelectedFont;
			box.PackStart (fontSelector, true);

			fontDialog.Content = box;

			fontDialog.Buttons.Add (new DialogButton (Command.Cancel));
			fontDialog.Buttons.Add (new DialogButton (Command.Ok));
		}
Пример #32
0
 public static void ShowMessage(WindowFrame parent, string primaryText, string secondaryText, Drawing.Image icon)
 {
     GenericAlert (parent, icon, primaryText, secondaryText, Command.Ok);
 }
Пример #33
0
		public new bool Run (WindowFrame parentWindow)
		{
			return base.Run (parentWindow) == Command.Ok;
		}
Пример #34
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize (multiselect);
         if (!string.IsNullOrEmpty (currentFolder))
             Backend.CurrentFolder = currentFolder;
         if (!string.IsNullOrEmpty (title))
             Backend.Title = title;
         return Backend.Run ((IWindowFrameBackend)BackendHost.ToolkitEngine.GetSafeBackend (parentWindow));
     } finally {
         currentFolder = Backend.CurrentFolder;
         folder = Backend.Folder;
         folders = Backend.Folders;
         currentFolder = Backend.CurrentFolder;
         running = false;
         Backend.Cleanup ();
     }
 }
Пример #35
0
        public Command Run(WindowFrame parent)
        {
            BackendHost.ToolkitEngine.ValidateObject (parent);

            BackendHost.ToolkitEngine.InvokePlatformCode (delegate {
                Backend.RunLoop ((IWindowFrameBackend) Toolkit.GetBackend (parent));
            });
            return resultCommand;
        }
Пример #36
0
        static Command GenericAlert(WindowFrame parent, MessageDescription message)
        {
            if (message.ApplyToAllButton != null)
                return message.ApplyToAllButton;

            IAlertDialogBackend backend = Toolkit.CurrentEngine.Backend.CreateBackend<IAlertDialogBackend> ();
            backend.Initialize (Toolkit.CurrentEngine.Context);

            using (backend) {
                var res = backend.Run (parent ?? RootWindow, message);

                if (backend.ApplyToAll)
                    message.ApplyToAllButton = res;

                return res;
            }
        }
Пример #37
0
 public Command Run(WindowFrame parent)
 {
     Toolkit.InvokePlatformCode (delegate {
         Backend.RunLoop ((IWindowFrameBackend) WidgetRegistry.GetBackend (parent));
     });
     return resultCommand;
 }
Пример #38
0
 public static bool Confirm(WindowFrame window, string primaryText, string secondaryText, Drawing.Image icon, Command button)
 {
     return GenericAlert (window, icon, primaryText, secondaryText, Command.Cancel, button) == button;
 }
Пример #39
0
 public static void ShowMessage(WindowFrame parent, string primaryText, string secondaryText)
 {
     GenericAlert (parent, StockIcons.Information, primaryText, secondaryText, Command.Ok);
 }
Пример #40
0
 public static Command AskQuestion(WindowFrame window, QuestionMessage message)
 {
     return(GenericAlert(window, message));
 }
Пример #41
0
 public static void ShowMessage(WindowFrame parent, Xwt.Drawing.Image icon, string primaryText, string secondaryText)
 {
     GenericAlert(parent, icon, primaryText, secondaryText, Command.Ok);
 }
Пример #42
0
 public static void ShowWarning(WindowFrame parent, string primaryText, string secondaryText)
 {
     GenericAlert (parent, StockIcons.Warning, primaryText, secondaryText, Command.Ok);
 }
Пример #43
0
 public static void ShowMessage(WindowFrame parent, string primaryText)
 {
     ShowMessage (parent, primaryText, null);
 }
Пример #44
0
		/// <summary>
		/// Shows the dialog.
		/// </summary>
		public bool Run (WindowFrame parentWindow, Action<Color> colorChangedCallback)
		{
			if(backend.Color != Colors.Transparent) {
				backend.Color = backend.Color;
			}
			return backend.Run((IWindowFrameBackend)Toolkit.CurrentEngine.GetSafeBackend(parentWindow), title, supportsAlpha, colorChangedCallback);
		}
Пример #45
0
 public static void ShowWarning(WindowFrame parent, string primaryText)
 {
     ShowWarning(parent, primaryText, null);
 }
Пример #46
0
 public static void ShowWarning(WindowFrame parent, string primaryText, string secondaryText)
 {
     ShowWarning(parent, primaryText, secondaryText, string.Empty);
 }
Пример #47
0
 public static void ShowMessage(WindowFrame parent, string primaryText)
 {
     ShowMessage(parent, primaryText, null);
 }
Пример #48
0
 public static void ShowWarning(WindowFrame parent, string primaryText)
 {
     ShowWarning (parent, primaryText, null);
 }
Пример #49
0
 public static void ShowError(WindowFrame parent, string primaryText)
 {
     ShowError (parent, primaryText, null);
 }
Пример #50
0
 internal void SetParentWindow(WindowFrame win)
 {
     parentWindow = win;
 }
Пример #51
0
 public static bool Confirm(WindowFrame window, string primaryText, string secondaryText, Command button)
 {
     return GenericAlert (window, Toolkit.CurrentEngine.Defaults.MessageDialog.QuestionIcon, primaryText, secondaryText, Command.Cancel, button) == button;
 }
Пример #52
0
        static Command GenericAlert(WindowFrame parent, Xwt.Drawing.Image icon, string primaryText, string secondaryText, int defaultButton, params Command[] buttons)
        {
            GenericMessage message = new GenericMessage () {
                Icon = icon,
                Text = primaryText,
                SecondaryText = secondaryText,
                DefaultButton = defaultButton
            };
            foreach (Command but in buttons)
                message.Buttons.Add (but);

            return GenericAlert (parent, message);
        }
Пример #53
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     var backend = WidgetRegistry.CreateBackend<ISelectColorDialogBackend> (GetType ());
     try {
         if (color != Colors.Transparent)
             backend.Color = color;
         return backend.Run ((IWindowFrameBackend)WidgetRegistry.GetBackend (parentWindow), title, supportsAlpha);
     } finally {
         color = backend.Color;
         backend.Dispose ();
     }
 }
Пример #54
0
 public static void ShowWarning(WindowFrame parent, string primaryText, string secondaryText)
 {
     GenericAlert (parent, Toolkit.CurrentEngine.Defaults.MessageDialog.WarningIcon, primaryText, secondaryText, Command.Ok);
 }
Пример #55
0
		/// <summary>
		/// Shows the dialog.
		/// </summary>
		public bool Run (WindowFrame parentWindow)
		{
			var backend = Toolkit.CurrentEngine.Backend.CreateBackend<ISelectFontDialogBackend> ();
			if (backend == null)
				backend = new DefaultSelectFontDialogBackend (parentWindow);
			try {
				backend.SelectedFont = SelectedFont;
				backend.Title = Title;
				backend.PreviewText = PreviewText;
				return backend.Run ((IWindowFrameBackend)Toolkit.CurrentEngine.GetSafeBackend (parentWindow));
			} catch (Exception ex) {
				Console.WriteLine (ex);
				return false;
			} finally {
				font = backend.SelectedFont;
				backend.Dispose ();
			}
		}
Пример #56
0
		public bool Run (WindowFrame parent)
		{
			var cmd = Dialog.Run (parent);
			return cmd == Command.Ok;
		}