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; } }
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; }
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); } }
public ItemOptionsDialog (Window parentWindow, object dataObject) : base (parentWindow, dataObject, "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels") { }
static string GetTextResponse (Window parent, string question, string caption, string initialValue, bool isPassword) { return messageService.GetTextResponse (parent, question, caption, initialValue, isPassword); }
public AlertButton GenericAlert (Window parent, MessageDescription message) { var dialog = new AlertDialog (message) { TransientFor = parent ?? GetDefaultModalParent () }; return dialog.Run (); }
public static void ShowMessage (Window parent, string primaryText, string secondaryText) { GenericAlert (parent, MonoDevelop.Ide.Gui.Stock.Information, primaryText, secondaryText, AlertButton.Ok); }
public static int ShowCustomDialog (Dialog dlg, Window parent) { Gtk.Dialog dialog = dlg; try { return RunCustomDialog (dlg, parent); } finally { dialog?.Destroy (); } }
public static void ShowWarning (Window parent, string primaryText, string secondaryText) { GenericAlert (parent, MonoDevelop.Ide.Gui.Stock.Warning, primaryText, secondaryText, AlertButton.Ok); }
public static void ShowMessage (Window parent, string primaryText) { ShowMessage (parent, primaryText, null); }
public static void ShowWarning (Window parent, string primaryText) { ShowWarning (parent, primaryText, null); }
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); }
public static void ShowError (Window parent, string primaryText, string secondaryText, Exception ex) { ShowError (parent, primaryText, secondaryText, ex, true, AlertButton.Ok); }
public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath) : this(parentWindow, dataObject, extensionPath, true) { }
/// <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); }
public static void ShowError (Window parent, string primaryText, string secondaryText) { ShowError (parent, primaryText, secondaryText, null); }
/// <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); }
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; }
/// <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); }
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; }
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; }
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); }
public virtual bool GetIsFullscreen (Window window) { return ((bool?) window.GetNativeWidget <Gtk.Window> ().Data ["isFullScreen"]) ?? false; }
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); }
public ProjectOptionsDialog (Window parentWindow, SolutionItem project) : base (parentWindow, project) { this.Title = GettextCatalog.GetString ("Project Options") + " - " + project.Name; this.DefaultWidth = 960; this.DefaultHeight = 680; }
public static AlertButton GenericAlert (Window parent, GenericMessage message) { return messageService.GenericAlert (parent, message); }
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; }
public static string GetTextResponse (Window parent, string question, string caption, string initialValue) { return GetTextResponse (parent, question, caption, initialValue, false); }
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); }
public static string GetPassword (Window parent, string question, string caption) { return GetTextResponse (parent, question, caption, string.Empty, true); }
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; }
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); }