Ejemplo n.º 1
0
        public ProgressDialog(MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails)
        {
            MonoDevelop.Components.IdeTheme.ApplyTheme(this);
            this.Build();
            this.Title   = BrandingService.ApplicationName;
            HasSeparator = false;
            ActionArea.Hide();
            DefaultHeight = 5;

            TransientFor = parent;

            btnCancel.Visible = allowCancel;

            expander.Visible = showDetails;

            buffer = detailsTextView.Buffer;
            detailsTextView.Editable = false;

            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            buffer.TagTable.Add(bold);

            tag        = new TextTag("0");
            tag.Indent = 10;
            buffer.TagTable.Add(tag);
            tags.Add(tag);
        }
		public MultiConfigItemOptionsDialog (Window parentWindow, object dataObject): base (parentWindow, dataObject)
		{
			IConfigurationTarget ct = DataObject as IConfigurationTarget;
			if (ct == null)
				throw new System.InvalidOperationException ("MultiConfigItemOptionsDialog can only be used for SolutionEntityItem and Solution objects. Invalid data object: " + DataObject);
			if (ct.DefaultConfiguration != null) {
				currentConfig = ct.DefaultConfiguration.Name;
				currentPlatform = ct.DefaultConfiguration.Platform;
			}
		}
Ejemplo n.º 3
0
		public override bool GetIsFullscreen (Window window)
		{
			if (MacSystemInformation.OsVersion < MacSystemInformation.Lion) {
				return base.GetIsFullscreen (window);
			}

			NSWindow nswin = GtkQuartz.GetWindow (window);
			return (nswin.StyleMask & NSWindowStyle.FullScreenWindow) != 0;
		}
Ejemplo n.º 4
0
		public virtual void SetIsFullscreen (Window window, bool isFullscreen)
		{
			Gtk.Window windowControl = window;
			windowControl.Data ["isFullScreen"] = isFullscreen;
			if (isFullscreen) {
				windowControl.Fullscreen ();
			} else {
				windowControl.Unfullscreen ();
				SetMainWindowDecorations (windowControl);
			}
		}
Ejemplo n.º 5
0
		public ItemOptionsDialog (Window parentWindow, object dataObject)
			: base (parentWindow, dataObject, "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels")
		{
		}
Ejemplo n.º 6
0
		static string GetTextResponse (Window parent, string question, string caption, string initialValue, bool isPassword)
		{
			return messageService.GetTextResponse (parent, question, caption, initialValue, isPassword);
		}
Ejemplo n.º 7
0
			public AlertButton GenericAlert (Window parent, MessageDescription message)
			{
				var dialog = new AlertDialog (message) {
					TransientFor = parent ?? GetDefaultModalParent ()
				};
				return dialog.Run ();
			}
Ejemplo n.º 8
0
		public static void ShowMessage (Window parent, string primaryText, string secondaryText)
		{
			GenericAlert (parent, MonoDevelop.Ide.Gui.Stock.Information, primaryText, secondaryText, AlertButton.Ok);
		}
Ejemplo n.º 9
0
		public static int ShowCustomDialog (Dialog dlg, Window parent)
		{
			Gtk.Dialog dialog = dlg;
			try {
				return RunCustomDialog (dlg, parent);
			} finally {
				dialog?.Destroy ();
			}
		}
Ejemplo n.º 10
0
		public static void ShowWarning (Window parent, string primaryText, string secondaryText)
		{
			GenericAlert (parent, MonoDevelop.Ide.Gui.Stock.Warning, primaryText, secondaryText, AlertButton.Ok);
		}
Ejemplo n.º 11
0
		public static void ShowMessage (Window parent, string primaryText)
		{
			ShowMessage (parent, primaryText, null);
		}
Ejemplo n.º 12
0
		public static void ShowWarning (Window parent, string primaryText)
		{
			ShowWarning (parent, primaryText, null);
		}
Ejemplo n.º 13
0
		internal static AlertButton ShowError (Window parent, string primaryText, string secondaryText, Exception ex, bool logError, params AlertButton[] buttons)
		{
			if (logError) {
				string msg = string.IsNullOrEmpty (secondaryText) ? primaryText : primaryText + ". " + secondaryText;
				LoggingService.LogError (msg, ex);
			}

			if (string.IsNullOrEmpty (secondaryText) && (ex != null))
				secondaryText = ex.Message;

			return GenericAlert (parent, MonoDevelop.Ide.Gui.Stock.Error, primaryText, secondaryText, buttons);
		}
Ejemplo n.º 14
0
		public static void ShowError (Window parent, string primaryText, string secondaryText, Exception ex)
		{
			ShowError (parent, primaryText, secondaryText, ex, true, AlertButton.Ok);
		}
Ejemplo n.º 15
0
 public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath) : this(parentWindow, dataObject, extensionPath, true)
 {
 }
Ejemplo n.º 16
0
		/// <summary>
		/// Places and runs a transient dialog. Does not destroy it, so values can be retrieved from its widgets.
		/// </summary>
		public static int RunCustomDialog (Dialog dlg, Window parent)
		{
			// if dialog is modal, make sure it's parented on any existing modal dialog
			Gtk.Dialog dialog = dlg;
			if (dialog.Modal) {
				parent = GetDefaultModalParent ();
			}

			//ensure the dialog has a parent
			if (parent == null) {
				parent = dialog.TransientFor ?? RootWindow;
			}

			dialog.TransientFor = parent;
			dialog.DestroyWithParent = true;

			if (dialog.Title == null)
				dialog.Title = BrandingService.ApplicationName;

			#if MAC
			Runtime.RunInMainThread (() => {
				// If there is a native NSWindow model window running, we need
				// to show the new dialog over that window.
				if (NSApplication.SharedApplication.ModalWindow != null)
					dialog.Shown += HandleShown;
				else
					PlaceDialog (dialog, parent);
			}).Wait ();
			#endif
			return GtkWorkarounds.RunDialogWithNotification (dialog);
		}
Ejemplo n.º 17
0
		public static void ShowError (Window parent, string primaryText, string secondaryText)
		{
			ShowError (parent, primaryText, secondaryText, null);
		}
Ejemplo n.º 18
0
		/// <summary>
		/// Positions a dialog relative to its parent on platforms where default placement is known to be poor.
		/// </summary>
		public static void PlaceDialog (Window childControl, Window parent)
		{
			//HACK: this is a workaround for broken automatic window placement on Mac
			if (!Platform.IsMac)
				return;

			Gtk.Window child = childControl;
			//modal windows should always be placed o top of existing modal windows
			if (child.Modal)
				parent = GetDefaultModalParent ();

			//else center on the focused toplevel
			if (parent == null)
				parent = GetFocusedToplevel ();

			if (parent != null)
				CenterWindow (child, parent);
		}
Ejemplo n.º 19
0
			public AlertButton ShowException (Window parent, string title, string message, Exception e, params AlertButton[] buttons)
			{
				if ((buttons == null || buttons.Length == 0) && (e is UserException) && ((UserException)e).AlreadyReportedToUser)
					return AlertButton.Ok;

				var exceptionDialog = new ExceptionDialog {
					Buttons = buttons ?? new [] { AlertButton.Ok },
					Title = title ?? GettextCatalog.GetString ("An error has occurred"),
					Message = message,
					Exception = e,
					TransientFor = parent ?? GetDefaultModalParent (),
				};
				exceptionDialog.Run ();
				return exceptionDialog.ResultButton;
			}
Ejemplo n.º 20
0
		/// <summary>Centers a window relative to its parent.</summary>
		static void CenterWindow (Window childControl, Window parentControl)
		{
			Gtk.Window child = childControl;
			Gtk.Window parent = parentControl;
			child.Child.Show ();
			int w, h, winw, winh, x, y, winx, winy;
			child.GetSize (out w, out h);
			parent.GetSize (out winw, out winh);
			parent.GetPosition (out winx, out winy);
			x = Math.Max (0, (winw - w) /2) + winx;
			y = Math.Max (0, (winh - h) /2) + winy;
			child.Move (x, y);
		}
Ejemplo n.º 21
0
			public string GetTextResponse (Window parent, string question, string caption, string initialValue, bool isPassword)
			{
				var dialog = new TextQuestionDialog {
					Question = question,
					Caption = caption,
					Value = initialValue,
					IsPassword = isPassword,
					TransientFor = parent ?? GetDefaultModalParent ()
				};
				if (dialog.Run ())
					return dialog.Value;
				return null;
			}
Ejemplo n.º 22
0
		public static AlertButton GenericAlert (Window parent, string icon, string primaryText, string secondaryText, params AlertButton[] buttons)
		{
			return GenericAlert (parent, icon, primaryText, secondaryText, buttons.Length - 1, buttons);
		}
		public CombineOptionsDialog (Window parentWindow, Solution solution) : base (parentWindow, solution)
		{
			this.Title = GettextCatalog.GetString ("Solution Options") + " – " + solution.Name;
		}
Ejemplo n.º 24
0
		public static AlertButton GenericAlert (Window parent, string icon, string primaryText, string secondaryText, int defaultButton,
			params AlertButton[] buttons)
		{
			return GenericAlert (parent, icon, primaryText, secondaryText, defaultButton, CancellationToken.None, buttons);
		}
Ejemplo n.º 25
0
		public virtual bool GetIsFullscreen (Window window)
		{
			return ((bool?) window.GetNativeWidget <Gtk.Window> ().Data ["isFullScreen"]) ?? false;
		}
Ejemplo n.º 26
0
		public static AlertButton GenericAlert (Window parent, string icon, string primaryText, string secondaryText, int defaultButton,
			CancellationToken cancellationToken,
			params AlertButton[] buttons)
		{
			var message = new GenericMessage (primaryText, secondaryText, cancellationToken) {
				Icon = icon,
				DefaultButton = defaultButton,
			};
			foreach (AlertButton but in buttons)
				message.Buttons.Add (but);
			
			return messageService.GenericAlert (parent, message);
		}
Ejemplo n.º 27
0
		public ProjectOptionsDialog (Window parentWindow, SolutionItem project) : base (parentWindow, project)
		{
			this.Title = GettextCatalog.GetString ("Project Options") + " - " + project.Name;
			this.DefaultWidth = 960;
			this.DefaultHeight = 680;
		}
Ejemplo n.º 28
0
		public static AlertButton GenericAlert (Window parent, GenericMessage message)
		{
			return messageService.GenericAlert (parent, message);
		}
Ejemplo n.º 29
0
        public DefaultPolicyOptionsDialog(MonoDevelop.Components.Window parentWindow)
            : base(parentWindow, new PolicySet(),
                   "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels")
        {
            this.Title = GettextCatalog.GetString("Policies");
            editingSet = (PolicySet)DataObject;

            HBox topBar = new HBox();

            topBar.Spacing = 3;
            topBar.PackStart(new Label(GettextCatalog.GetString("Editing Policy:")), false, false, 0);

            policiesCombo = ComboBox.NewText();
            topBar.PackStart(policiesCombo, false, false, 0);

            deleteButton = new Button(GettextCatalog.GetString("Delete Policy"));
            topBar.PackEnd(deleteButton, false, false, 0);

            exportButton       = new MenuButton();
            exportButton.Label = GettextCatalog.GetString("Export");
            exportButton.ContextMenuRequested = delegate {
                ContextMenu menu = new ContextMenu();

                ContextMenuItem item = new ContextMenuItem(GettextCatalog.GetString("To file..."));
                item.Clicked += HandleToFile;
                menu.Items.Add(item);

                item          = new ContextMenuItem(GettextCatalog.GetString("To project or solution..."));
                item.Clicked += HandleToProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    item.Sensitive = false;
                }
                menu.Items.Add(item);

                return(menu);
            };
            topBar.PackEnd(exportButton, false, false, 0);

            newButton       = new MenuButton();
            newButton.Label = GettextCatalog.GetString("Add Policy");
            newButton.ContextMenuRequested = delegate {
                ContextMenu menu = new ContextMenu();

                ContextMenuItem item = new ContextMenuItem(GettextCatalog.GetString("New policy..."));
                item.Clicked += HandleNewButtonClicked;
                menu.Items.Add(item);

                item          = new ContextMenuItem(GettextCatalog.GetString("From file..."));
                item.Clicked += HandleFromFile;
                menu.Items.Add(item);

                item          = new ContextMenuItem(GettextCatalog.GetString("From project or solution..."));
                item.Clicked += HandleFromProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    item.Sensitive = false;
                }
                menu.Items.Add(item);

                return(menu);
            };
            topBar.PackEnd(newButton, false, false, 0);

            Alignment align = new Alignment(0f, 0f, 1f, 1f);

            align.LeftPadding   = 9;
            align.TopPadding    = 9;
            align.RightPadding  = 9;
            align.BottomPadding = 9;
            align.Add(topBar);

            HeaderBox ebox = new HeaderBox();

            ebox.GradientBackground = true;
            ebox.SetMargins(0, 1, 0, 0);
            ebox.Add(align);

            ebox.ShowAll();

            VBox.PackStart(ebox, false, false, 0);
            VBox.BorderWidth = 0;
            Box.BoxChild c = (Box.BoxChild)VBox [ebox];
            c.Position = 0;

            foreach (PolicySet ps in PolicyService.GetUserPolicySets())
            {
                PolicySet copy = ps.Clone();
                originalSets [copy] = ps;
                sets.Add(copy);
            }
            FillPolicySets();

            policiesCombo.Changed += HandlePoliciesComboChanged;
            deleteButton.Clicked  += HandleDeleteButtonClicked;
        }
Ejemplo n.º 30
0
		public static string GetTextResponse (Window parent, string question, string caption, string initialValue)
		{
			return GetTextResponse (parent, question, caption, initialValue, false);
		}
Ejemplo n.º 31
0
		public override void SetIsFullscreen (Window window, bool isFullscreen)
		{
			if (MacSystemInformation.OsVersion < MacSystemInformation.Lion) {
				base.SetIsFullscreen (window, isFullscreen);
				return;
			}

			NSWindow nswin = GtkQuartz.GetWindow (window);
			if (isFullscreen != ((nswin.StyleMask & NSWindowStyle.FullScreenWindow) != 0))
				nswin.ToggleFullScreen (null);
		}
Ejemplo n.º 32
0
		public static string GetPassword (Window parent, string question, string caption)
		{
			return GetTextResponse (parent, question, caption, string.Empty, true);
		}
Ejemplo n.º 33
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
Ejemplo n.º 34
0
		public static AlertButton ShowException (Window parent, Exception e, string message, string title, params AlertButton[] buttons)
		{
			if (!IdeApp.IsInitialized)
				throw new Exception ("IdeApp has not been initialized. Propagating the exception.", e); 
			return messageService.ShowException (parent, title, message, e, buttons);
		}