public DockMenu(Gtk.Window parent) : base(Gtk.WindowType.Popup) { SetLight(); AcceptFocus = false; Decorated = false; KeepAbove = true; AppPaintable = true; SkipPagerHint = true; SkipTaskbarHint = true; Resizable = false; Modal = true; TypeHint = WindowTypeHint.Dock; AddEvents((int)Gdk.EventMask.AllEventsMask); this.SetCompositeColormap(); Container = new Gtk.Alignment(0.5f, 0.5f, 0, 0); Container.Show(); Add(Container); SetPadding(); DockServices.Theme.ThemeChanged += DockyControllerThemeChanged; Gdk.Screen.Default.CompositedChanged += HandleCompositedChanged; }
public MonoMacPackagingSettingsDialog () { this.Title = GettextCatalog.GetString ("Create Mac Installer"); this.DestroyWithParent = true; this.Modal = true; settingsWidget.Show (); var al = new Alignment (0.5f, 0.5f, 1.0f, 1.0f) { TopPadding = 12, BottomPadding = 12, RightPadding = 12, LeftPadding = 12, Child = settingsWidget, }; al.Show (); this.VBox.PackStart (al, true, true, 0); var okButton = new Button () { Label = GettextCatalog.GetString ("Create Package") }; var cancelButton = new Button (Stock.Cancel); this.AddActionWidget (cancelButton, ResponseType.Cancel); this.AddActionWidget (okButton, ResponseType.Ok); this.ActionArea.ShowAll (); }
public PopoverWindow(Gtk.WindowType type) : base(type) { SkipTaskbarHint = true; SkipPagerHint = true; AppPaintable = true; TypeHint = WindowTypeHint.Tooltip; CheckScreenColormap(); alignment = new Alignment(0, 0, 1f, 1f); alignment.Show(); Add(alignment); disableSizeCheck = false; SizeRequested += (object o, SizeRequestedArgs args) => { if (this.AnimationIsRunning("Resize") && !disableSizeCheck) { Gtk.Requisition result = new Gtk.Requisition(); result.Width = Math.Max(args.Requisition.Width, Math.Max(Allocation.Width, targetSize.Width)); result.Height = Math.Max(args.Requisition.Height, Math.Max(Allocation.Height, targetSize.Height)); args.Requisition = result; } }; UpdatePadding(); }
public PopoverWindow (Gtk.WindowType type) : base(type) { SkipTaskbarHint = true; SkipPagerHint = true; AppPaintable = true; TypeHint = WindowTypeHint.Tooltip; CheckScreenColormap (); alignment = new Alignment (0, 0, 1f, 1f); alignment.Show (); Add (alignment); disableSizeCheck = false; SizeRequested += (object o, SizeRequestedArgs args) => { if (this.AnimationIsRunning("Resize") && !disableSizeCheck) { Gtk.Requisition result = new Gtk.Requisition (); result.Width = Math.Max (args.Requisition.Width, Math.Max (Allocation.Width, targetSize.Width)); result.Height = Math.Max (args.Requisition.Height, Math.Max (Allocation.Height, targetSize.Height)); args.Requisition = result; } }; UpdatePadding (); }
public EnableStartupNotesPreference () { IPropertyEditorBool enableStartupNotes_peditor; Gtk.CheckButton enableStartupNotesCheckbox; Gtk.Label enableStartupNotesLabel; // Enable Startup Notes option enableStartupNotesLabel = new Gtk.Label (Catalog.GetString ("Enable startup notes")); enableStartupNotesLabel.UseMarkup = true; enableStartupNotesLabel.Justify = Gtk.Justification.Left; enableStartupNotesLabel.SetAlignment (0.0f, 0.5f); enableStartupNotesLabel.Show (); enableStartupNotesCheckbox = new Gtk.CheckButton (); enableStartupNotesCheckbox.Add (enableStartupNotesLabel); enableStartupNotesCheckbox.Show (); enableStartupNotes_peditor = Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_STARTUP_NOTES, enableStartupNotesCheckbox); Preferences.Get (enableStartupNotes_peditor.Key); enableStartupNotes_peditor.Setup (); align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f); align.Show (); align.Add (enableStartupNotesCheckbox); }
public EnableStartupNotesPreference() { IPropertyEditorBool enableStartupNotes_peditor; Gtk.CheckButton enableStartupNotesCheckbox; Gtk.Label enableStartupNotesLabel; // Enable Startup Notes option enableStartupNotesLabel = new Gtk.Label(Catalog.GetString("Enable startup notes")); enableStartupNotesLabel.UseMarkup = true; enableStartupNotesLabel.Justify = Gtk.Justification.Left; enableStartupNotesLabel.SetAlignment(0.0f, 0.5f); enableStartupNotesLabel.Show(); enableStartupNotesCheckbox = new Gtk.CheckButton(); enableStartupNotesCheckbox.Add(enableStartupNotesLabel); enableStartupNotesCheckbox.Show(); enableStartupNotes_peditor = Services.Factory.CreatePropertyEditorToggleButton(Preferences.ENABLE_STARTUP_NOTES, enableStartupNotesCheckbox); Preferences.Get(enableStartupNotes_peditor.Key); enableStartupNotes_peditor.Setup(); align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 1.0f); align.Show(); align.Add(enableStartupNotesCheckbox); }
public override bool GetPreferenceTabWidget(PreferencesDialog parent, out string tabLabel, out Gtk.Widget preferenceWidget) { Gtk.Label label; Gtk.SpinButton menuNoteCountSpinner; Gtk.Alignment align; int menuNoteCount; // Addin's tab caption tabLabel = Catalog.GetString("Advanced"); Gtk.VBox opts_list = new Gtk.VBox(false, 12); opts_list.BorderWidth = 12; opts_list.Show(); align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 1.0f); align.Show(); opts_list.PackStart(align, false, false, 0); Gtk.Table table = new Gtk.Table(1, 2, false); table.ColumnSpacing = 6; table.RowSpacing = 6; table.Show(); align.Add(table); // Menu Note Count option label = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list (maximum 18)")); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.Show(); table.Attach(label, 0, 1, 0, 1); menuNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT); // we have a hard limit of 18 set, thus not allowing anything bigger than 18 menuNoteCountSpinner = new Gtk.SpinButton(1, 18, 1); menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18; menuNoteCountSpinner.Show(); table.Attach(menuNoteCountSpinner, 1, 2, 0, 1); menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference; if (opts_list != null) { preferenceWidget = opts_list; return(true); } else { preferenceWidget = null; return(false); } }
public override bool GetPreferenceTabWidget ( PreferencesDialog parent, out string tabLabel, out Gtk.Widget preferenceWidget) { Gtk.Label label; Gtk.SpinButton menuNoteCountSpinner; Gtk.Alignment align; int menuNoteCount; // Addin's tab caption tabLabel = Catalog.GetString ("Advanced"); Gtk.VBox opts_list = new Gtk.VBox (false, 12); opts_list.BorderWidth = 12; opts_list.Show (); align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 1.0f); align.Show (); opts_list.PackStart (align, false, false, 0); Gtk.Table table = new Gtk.Table (1, 2, false); table.ColumnSpacing = 6; table.RowSpacing = 6; table.Show (); align.Add (table); // Menu Note Count option label = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list (maximum 18)")); label.UseMarkup = true; label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.Show (); table.Attach (label, 0, 1, 0, 1); menuNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT); // we have a hard limit of 18 set, thus not allowing anything bigger than 18 menuNoteCountSpinner = new Gtk.SpinButton (1, 18, 1); menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18; menuNoteCountSpinner.Show (); table.Attach (menuNoteCountSpinner, 1, 2, 0, 1); menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference; if (opts_list != null) { preferenceWidget = opts_list; return true; } else { preferenceWidget = null; return false; } }
public HoverImageButton() { Gtk.Alignment al = new Alignment (0.5f, 0.5f, 0f, 0f); al.Show (); CanFocus = true; VisibleWindow = false; image = new ImageView(); image.Show(); al.Add (image); Add(al); }
public MenuMinMaxNoteCountPreference () { table = new Gtk.Table (2, 2, false); table.ColumnSpacing = 6; table.RowSpacing = 6; table.Show (); // Menu Min Note Count option menuMinNoteCountLabel = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list")); menuMinNoteCountLabel.UseMarkup = true; menuMinNoteCountLabel.Justify = Gtk.Justification.Left; menuMinNoteCountLabel.SetAlignment (0.0f, 0.5f); menuMinNoteCountLabel.Show (); table.Attach (menuMinNoteCountLabel, 0, 1, 0, 1); menuMinNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT); menuMaxNoteCount = (int) Preferences.Get (Preferences.MENU_MAX_NOTE_COUNT); // This is to avoid having Max bigger than absolute maximum if someone changed the setting // outside of the Tomboy using e.g. gconf menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue); // This is to avoid having Min bigger than Max if someone changed the setting // outside of the Tomboy using e.g. gconf menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount); menuMinNoteCountSpinner = new Gtk.SpinButton (1, menuMaxNoteCount, 1); menuMinNoteCountSpinner.Value = menuMinNoteCount; menuMinNoteCountSpinner.Show (); table.Attach (menuMinNoteCountSpinner, 1, 2, 0, 1); menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference; // Menu Max Note Count option menuMaxNoteCountLabel = new Gtk.Label (Catalog.GetString ("Maximum number of notes to show in Recent list")); menuMaxNoteCountLabel.UseMarkup = true; menuMaxNoteCountLabel.Justify = Gtk.Justification.Left; menuMaxNoteCountLabel.SetAlignment (0.0f, 0.5f); menuMaxNoteCountLabel.Show (); table.Attach (menuMaxNoteCountLabel, 0, 1, 1, 2); menuMaxNoteCountSpinner = new Gtk.SpinButton (menuMinNoteCount, int.MaxValue, 1); menuMaxNoteCountSpinner.Value = menuMaxNoteCount; menuMaxNoteCountSpinner.Show (); table.Attach (menuMaxNoteCountSpinner, 1, 2, 1, 2); menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference; align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f); align.Show (); align.Add (table); }
public MenuMinMaxNoteCountPreference() { table = new Gtk.Table(2, 2, false); table.ColumnSpacing = 6; table.RowSpacing = 6; table.Show(); // Menu Min Note Count option menuMinNoteCountLabel = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list")); menuMinNoteCountLabel.UseMarkup = true; menuMinNoteCountLabel.Justify = Gtk.Justification.Left; menuMinNoteCountLabel.SetAlignment(0.0f, 0.5f); menuMinNoteCountLabel.Show(); table.Attach(menuMinNoteCountLabel, 0, 1, 0, 1); menuMinNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT); menuMaxNoteCount = (int)Preferences.Get(Preferences.MENU_MAX_NOTE_COUNT); // This is to avoid having Max bigger than absolute maximum if someone changed the setting // outside of the Tomboy using e.g. gconf menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue); // This is to avoid having Min bigger than Max if someone changed the setting // outside of the Tomboy using e.g. gconf menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount); menuMinNoteCountSpinner = new Gtk.SpinButton(1, menuMaxNoteCount, 1); menuMinNoteCountSpinner.Value = menuMinNoteCount; menuMinNoteCountSpinner.Show(); table.Attach(menuMinNoteCountSpinner, 1, 2, 0, 1); menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference; // Menu Max Note Count option menuMaxNoteCountLabel = new Gtk.Label(Catalog.GetString("Maximum number of notes to show in Recent list")); menuMaxNoteCountLabel.UseMarkup = true; menuMaxNoteCountLabel.Justify = Gtk.Justification.Left; menuMaxNoteCountLabel.SetAlignment(0.0f, 0.5f); menuMaxNoteCountLabel.Show(); table.Attach(menuMaxNoteCountLabel, 0, 1, 1, 2); menuMaxNoteCountSpinner = new Gtk.SpinButton(menuMinNoteCount, int.MaxValue, 1); menuMaxNoteCountSpinner.Value = menuMaxNoteCount; menuMaxNoteCountSpinner.Show(); table.Attach(menuMaxNoteCountSpinner, 1, 2, 1, 2); menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference; align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 1.0f); align.Show(); align.Add(table); }
private DefaultApplicationHelperDialog() : base(null, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.None, Catalog.GetString ("Make Banshee the default media player?"), Catalog.GetString ("Currently another program is configured as the default media player. Would you prefer Banshee to be the default?")) { remember = new CheckButton (Catalog.GetString ("Do not ask me this again")); remember.UseUnderline = true; remember.Active = DefaultApplicationHelper.EverAskedSchema.Get () ? DefaultApplicationHelper.RememberChoiceSchema.Get () : false; remember.Show (); Alignment align = new Alignment (0f, 0f, 1f, 1f); align.TopPadding = 6; align.Child = remember; align.Show (); LabelVBox.PackEnd (align, false, false, 0); AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.No, false); AddCustomButton (Catalog.GetString ("Make Banshee the Default"), Gtk.ResponseType.Yes, true).HasFocus = true; }
public override bool GetPreferenceTabWidget(PreferencesDialog parent, out string tabLabel, out Gtk.Widget preferenceWidget) { Gtk.Alignment align; // Addin's tab caption tabLabel = Catalog.GetString("Advanced"); Gtk.VBox opts_list = new Gtk.VBox(false, 12); opts_list.BorderWidth = 12; opts_list.Show(); align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 1.0f); align.Show(); opts_list.PackStart(align, false, false, 0); /* * If you want to add new settings to the Advanced tab - follow the steps below: * 1) define a class which implements the functionality (see e.g. MenuMinMaxNoteCountPreference.cs); * 2) define property/method for that class that returns the widget you want to place onto the tab; * 3) (similar to the below) instantiate object of your class and add its widget to the "align" widget; */ // Instantiate class for Menu Min/Max Note Count setting MenuMinMaxNoteCountPreference menuNoteCountPref = new MenuMinMaxNoteCountPreference(); // Add the widget for this setting to the Advanced tab align.Add(menuNoteCountPref.Widget); if (opts_list != null) { preferenceWidget = opts_list; return(true); } else { preferenceWidget = null; return(false); } }
public PopoverWidget () { AppPaintable = true; VisibleWindow = false; alignment = new Alignment (0, 0, 1f, 1f); alignment.Show (); Add (alignment); disableSizeCheck = false; SizeRequested += (object o, SizeRequestedArgs args) => { if (this.AnimationIsRunning("Resize") && !disableSizeCheck) { Gtk.Requisition result = new Gtk.Requisition (); result.Width = Math.Max (args.Requisition.Width, Math.Max (Allocation.Width, targetSize.Width)); result.Height = Math.Max (args.Requisition.Height, Math.Max (Allocation.Height, targetSize.Height)); args.Requisition = result; } }; UpdatePadding (); }
static void SetButtonIcon (Button button, string stockIcon) { Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f); Label label = new Label (button.Label); HBox hbox = new HBox (false, 2); Image image = new Image (); image.Pixbuf = Stetic.IconLoader.LoadIcon (button, stockIcon, IconSize.Button); image.Show (); hbox.Add (image); label.Show (); hbox.Add (label); hbox.Show (); alignment.Add (hbox); button.Child.Destroy (); alignment.Show (); button.Add (alignment); }
public PopoverWidget() { AppPaintable = true; VisibleWindow = false; alignment = new Alignment(0, 0, 1f, 1f); alignment.Show(); Add(alignment); disableSizeCheck = false; SizeRequested += (object o, SizeRequestedArgs args) => { if (this.AnimationIsRunning("Resize") && !disableSizeCheck) { Gtk.Requisition result = new Gtk.Requisition(); result.Width = Math.Max(args.Requisition.Width, Math.Max(Allocation.Width, targetSize.Width)); result.Height = Math.Max(args.Requisition.Height, Math.Max(Allocation.Height, targetSize.Height)); args.Requisition = result; } }; UpdatePadding(); }
Widget CreateExceptionInfoHeader () { ExceptionMessageLabel = new Label () { UseMarkup = true, Selectable = true, Wrap = true, WidthRequest = 500, Xalign = 0.0f, Yalign = 0.0f }; ExceptionTypeLabel = new Label () { UseMarkup = true, Xalign = 0.0f }; ExceptionMessageLabel.Show (); ExceptionTypeLabel.Show (); var alignment = new Alignment (0.0f, 0.0f, 0.0f, 0.0f); alignment.Child = ExceptionMessageLabel; alignment.BorderWidth = 6; alignment.Show (); var frame = new InfoFrame (alignment); frame.Show (); var vbox = new VBox (false, 12); vbox.PackStart (ExceptionTypeLabel, false, true, 0); vbox.PackStart (frame, true, true, 0); vbox.Show (); return vbox; }
void Build () { Title = GettextCatalog.GetString ("Exception Caught"); DefaultWidth = 500; DefaultHeight = 500; HeightRequest = 350; WidthRequest = 350; VBox.Foreach (VBox.Remove); VBox.PackStart (CreateExceptionHeader (), false, true, 0); paned = new VPanedThin (); paned.GrabAreaSize = 10; paned.Pack1 (CreateStackTraceTreeView (), true, false); paned.Pack2 (CreateExceptionValueTreeView (), true, false); paned.Show (); var vbox = new VBox (false, 0); var whiteBackground = new EventBox (); whiteBackground.Show (); whiteBackground.ModifyBg (StateType.Normal, Ide.Gui.Styles.PrimaryBackgroundColor.ToGdkColor ()); whiteBackground.Add (vbox); hadInnerException = HasInnerException (); if (hadInnerException) { vbox.PackStart (new VBox (), false, false, 6); vbox.PackStart (CreateInnerExceptionMessage (), false, true, 0); vbox.ShowAll (); } vbox.PackStart (paned, true, true, 0); vbox.Show (); if (hadInnerException) { var box = new HBox (); box.PackStart (CreateInnerExceptionsTree (), false, false, 0); box.PackStart (whiteBackground, true, true, 0); box.Show (); VBox.PackStart (box, true, true, 0); DefaultWidth = 900; DefaultHeight = 700; WidthRequest = 550; HeightRequest = 450; } else { VBox.PackStart (whiteBackground, true, true, 0); } var actionArea = new HBox (false, 0) { BorderWidth = 14 }; OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show (); OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions ().ProjectAssembliesOnly; var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show (); actionArea.PackStart (alignment, true, true, 0); actionArea.PackStart (CreateButtonBox (), false, true, 0); actionArea.PackStart (new VBox (), false, true, 3); // dummy just to take extra 6px at end to make it 20pixels actionArea.ShowAll (); VBox.PackStart (actionArea, false, true, 0); }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); hbox.PackStart (label, false, false, 0); store = new ListStore (typeof (string), typeof (PolicySet)); policyCombo = new ComboBox (store); CellRenderer renderer = new CellRendererText (); policyCombo.PackStart (renderer, true); policyCombo.AddAttribute (renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string) model.GetValue (iter, 0)) == "--"; hbox.PackStart (policyCombo, false, false, 0); VBox vbox = new VBox (false, 6); vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
void AddMultiOptionCombo (SortedDictionary<string, List<TargetFramework>> options) { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { LeftPadding = 18 }; var model = new ListStore (new Type[] { typeof (string), typeof (object) }); var renderer = new CellRendererText (); var combo = new ComboBox (model); var check = new CheckButton (); List<TargetFramework> targets; var hbox = new HBox (); int current = 0; int active = -1; string label; foreach (var kvp in options) { label = kvp.Key; if (current + 1 < options.Count) label += " or later"; targets = kvp.Value; if (active == -1) { foreach (var target in targets) { if (target.Id.Equals (project.TargetFramework.Id)) { active = current; break; } } } model.AppendValues (label, targets); current++; } combo.PackStart (renderer, true); combo.AddAttribute (renderer, "text", 0); check.Show (); combo.Show (); if (active != -1) { combo.Active = active; check.Active = true; } else { check.Active = false; combo.Active = 0; } combo.Changed += (sender, e) => { if (check.Active) TargetFrameworkChanged (check, combo); }; check.Toggled += (sender, e) => { TargetFrameworkChanged (check, combo); }; comboboxes.Add (check, combo); hbox.PackStart (check, false, false, 0); hbox.PackStart (combo, false, true, 0); hbox.Show (); alignment.Add (hbox); alignment.Show (); vbox1.PackStart (alignment, false, false, 0); }
public DockMenu (Gtk.Window parent) : base(Gtk.WindowType.Popup) { SetLight (); AcceptFocus = false; Decorated = false; KeepAbove = true; AppPaintable = true; SkipPagerHint = true; SkipTaskbarHint = true; Resizable = false; Modal = true; TypeHint = WindowTypeHint.Dock; AddEvents ((int) Gdk.EventMask.AllEventsMask); this.SetCompositeColormap (); Container = new Gtk.Alignment (0.5f, 0.5f, 0, 0); Container.Show (); Add (Container); SetPadding (); DockServices.Theme.ThemeChanged += DockyControllerThemeChanged; Gdk.Screen.Default.CompositedChanged += HandleCompositedChanged; }
private void BuildHeader () { header_table = new Table (2, 2, false); header_table.Show (); primary_vbox.PackStart (header_table, false, false, 0); main_menu = new MainMenu (); if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) { main_menu.Show (); header_table.Attach (main_menu, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); } Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u; toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u; header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar"); header_toolbar.ShowArrow = false; header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; header_toolbar.Show (); if (PlatformDetection.IsMeeGo) { header_toolbar.IconSize = IconSize.LargeToolbar; header_toolbar.Name = "meego-toolbar"; } toolbar_alignment.Add (header_toolbar); toolbar_alignment.Show (); header_table.Attach (toolbar_alignment, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); var next_button = new NextButton (ActionService, PlatformDetection.IsMeeGo); next_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button); seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () }; seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get (); seek_slider.SeekSlider.SizeAllocated += (o, a) => { SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width); }; seek_slider.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider); var track_info_display = new ClassicTrackInfoDisplay (); track_info_display.Show (); track_info_container = TrackInfoDisplay.GetEditable (track_info_display); track_info_container.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true); if (PlatformDetection.IsMeeGo) { track_info_display.ArtworkSpacing = 5; seek_slider.LeftPadding = 20; seek_slider.RightPadding = 20; var menu = (Menu)(ActionService.UIManager.GetWidget ("/ToolbarMenu")); var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true); menu_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button); var close_button = new Button (Image.NewFromIconName ("window-close", IconSize.LargeToolbar)) { TooltipText = Catalog.GetString ("Close") }; close_button.Clicked += (o, e) => Hide (); close_button.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button); } else { var volume_button = new ConnectedVolumeButton (); volume_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button); } }
void AddSingleOptionCheckbox (OptionCombo option) { if (option.Items.Count != 1) throw new InvalidOperationException (); option.Check = new CheckButton (option.Items [0].Name); option.Check.Toggled += (sender, e) => { TargetFrameworkChanged (option); }; option.Check.Show (); var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { LeftPadding = 18, RightPadding = 18 }; alignment.Add (option.Check); alignment.Show (); vbox1.PackStart (alignment, false, true, 0); }
private bool need_authorization_checked = true; // state for at which button the auth arrows should point private void OnPreferencesServiceInstallWidgetAdapters (object sender, EventArgs args) { if (reporting_preference != null && scrobbler != null) { reporting_preference.Value = scrobbler.Enabled; } if (account_section == null) { return; } var align = new Alignment (0.0f, 0.0f, 1.0f, 1.0f) { LeftPadding = 20, RightPadding = 20 }; sign_in_box = new Table (0, 0, false) { ColumnSpacing = 6, RowSpacing = 2 }; align.Add (sign_in_box); align.Show (); username_preference.DisplayWidget = align; align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f) { LeftPadding = 20, RightPadding = 20, TopPadding = 5 }; var button_box = new HBox () { Spacing = 6 }; button_box.PackStart (new Badge (source.Account), false, false, 0); signup_button = new Gtk.LinkButton (source.Account.SignUpUrl, Catalog.GetString ("Sign up for Last.fm")); signup_button.Xalign = 0f; button_box.PackStart (signup_button, false, false, 0); profile_page_button = new Gtk.LinkButton (String.Empty, Catalog.GetString ("Visit Your Last.fm Profile Page")); profile_page_button.Clicked += (o, e) => source.Account.VisitUserProfile (source.Account.UserName); profile_page_button.Xalign = 0f; button_box.PackStart (profile_page_button, false, false, 0); align.Add (button_box); align.ShowAll (); account_section["lastfm-signup"].DisplayWidget = align; GetSignInState (); BuildSignIn (); }
void CreatePageWidget (SectionPage page) { List<PanelInstance> boxPanels = new List<PanelInstance> (); List<PanelInstance> tabPanels = new List<PanelInstance> (); foreach (PanelInstance pi in page.Panels) { if (pi.Widget == null) { pi.Widget = pi.Panel.CreatePanelWidget (); //HACK: work around bug 469427 - broken themes match on widget names if (pi.Widget.Name.IndexOf ("Panel") > 0) pi.Widget.Name = pi.Widget.Name.Replace ("Panel", "_"); } else if (pi.Widget.Parent != null) ((Gtk.Container) pi.Widget.Parent).Remove (pi.Widget); if (pi.Node.Grouping == PanelGrouping.Tab) tabPanels.Add (pi); else boxPanels.Add (pi); } // Try to fit panels with grouping=box or auto in the main page. // If they don't fit. Move auto panels to its own tab page. int mainPageSize; bool fits; do { PanelInstance lastAuto = null; mainPageSize = 0; foreach (PanelInstance pi in boxPanels) { if (pi.Node.Grouping == PanelGrouping.Auto) lastAuto = pi; // HACK: This we are parenting/unparenting the widget here as a workaround // for a layout issue. To properly calculate the size of the widget, the widget // needs to have the style that it will have when added to the window. pi.Widget.Parent = this; mainPageSize += pi.Widget.SizeRequest ().Height + 6; pi.Widget.Unparent (); } fits = mainPageSize <= pageFrame.Allocation.Height; if (!fits) { if (lastAuto != null && boxPanels.Count > 1) { boxPanels.Remove (lastAuto); tabPanels.Insert (0, lastAuto); } else { fits = true; } } } while (!fits); Gtk.VBox box = new VBox (false, 12); box.Show (); for (int n=0; n<boxPanels.Count; n++) { if (n != 0) { HSeparator sep = new HSeparator (); sep.Show (); box.PackStart (sep, false, false, 0); } PanelInstance pi = boxPanels [n]; box.PackStart (pi.Widget, pi.Node.Fill, pi.Node.Fill, 0); pi.Widget.Show (); } box.BorderWidth = 12; if (tabPanels.Count > 0) { /* SquaredNotebook nb = new SquaredNotebook (); nb.Show (); nb.AddTab (box, GettextCatalog.GetString ("General")); foreach (PanelInstance pi in tabPanels) { Gtk.Alignment a = new Alignment (0, 0, 1, 1); a.BorderWidth = 9; a.Show (); a.Add (pi.Widget); nb.AddTab (a, GettextCatalog.GetString (pi.Node.Label)); pi.Widget.Show (); }*/ Gtk.Notebook nb = new Notebook (); nb.Show (); Gtk.Label blab = new Gtk.Label (GettextCatalog.GetString ("General")); blab.Show (); box.BorderWidth = 9; nb.InsertPage (box, blab, -1); foreach (PanelInstance pi in tabPanels) { Gtk.Label lab = new Gtk.Label (GettextCatalog.GetString (pi.Node.Label)); lab.Show (); Gtk.Alignment a = new Alignment (0, 0, 1, 1); a.BorderWidth = 9; a.Show (); a.Add (pi.Widget); nb.InsertPage (a, lab, -1); pi.Widget.Show (); } page.Widget = nb; nb.BorderWidth = 12; } else { page.Widget = box; } }
public PortableRuntimeOptionsPanelWidget (PortableDotNetProject project, IEnumerable<ItemConfiguration> configurations) { this.project = project; this.Build (); SortedDictionary<string, List<Framework>> options = new SortedDictionary<string, List<Framework>> (); foreach (var fx in Runtime.SystemAssemblyService.GetTargetFrameworks ()) { if (fx.Hidden || fx.Id.Identifier != ".NETPortable" || !project.TargetRuntime.IsInstalled (fx)) continue; foreach (var sfx in fx.SupportedFrameworks) { List<Framework> list; if (!options.TryGetValue (sfx.DisplayName, out list)) { list = new List<Framework> (); options.Add (sfx.DisplayName, list); } list.Add (sfx); } } foreach (var opt in options) { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { LeftPadding = 18 }; List<Framework> versions = opt.Value; CheckButton check; // FIXME: VS11 introduces comboboxes for some of these... which I suspect will need to sort based on version //versions.Sort (CompareFrameworksByVersion); check = new CheckButton (versions[0].DisplayName + " " + versions[0].MinimumVersionDisplayName); check.Sensitive = false; // Desensitize until we support changing these values... foreach (var ver in versions) { if (ver.TargetFramework == project.TargetFramework) { check.Active = true; break; } } check.Show (); alignment.Add (check); alignment.Show (); vbox1.PackStart (alignment, false, false, 0); } }
public MainToolbar() { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert(new Pango.AttrWeight(Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); if (Platform.IsWindows) { ctx.Ellipsize = Pango.EllipsizeMode.Middle; } runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } var pixel_scale = GtkWorkarounds.GetPixelScale(); int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - (int)(300 * pixel_scale), args.Allocation.Left); int right = Math.Min(left + (int)(600 * pixel_scale), args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) { SearchEntryLostFocus(o, e); } }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) { SearchEntryResized(o, e); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, (int)(21 * GtkWorkarounds.GetPixelScale())); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) { ConfigurationChanged(o, e); } }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs(); if (RuntimeChanged != null) { RuntimeChanged(o, ea); } TreeIter it; if (runtimeCombo.GetActiveIter(out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter(lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference(e.OldActiveWidget); }; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public MainToolbar() { IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos(); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; runtimeCombo.PackStart(ctx, true); runtimeCombo.AddAttribute(ctx, "text", 0); var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = 7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - 300, args.Allocation.Left); int right = Math.Min(left + 600, args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); var searchFiles = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Files")); searchFiles.Activated += delegate { SetSearchCategory("files"); }; var searchTypes = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Types")); searchTypes.Activated += delegate { SetSearchCategory("type"); }; var searchMembers = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Members")); searchMembers.Activated += delegate { SetSearchCategory("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand(Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel(); }; UpdateSearchEntryLabel(); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { if (popup != null) { popup.OpenFile(); } }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) { popup.Destroy(); } doc.Select(); } return; } if (popup != null) { args.RetVal = popup.ProcessKey(args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) { PositionPopup(); } }; BuildToolbar(); IdeApp.CommandService.RegisterCommandBar(buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged(ToolbarExtensionPath)) { BuildToolbar(); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = 5; align.LeftPadding = 9; align.RightPadding = 18; align.BottomPadding = 10; align.Add(contentBox); Add(align); UpdateCombos(); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar(this); this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public ProgressBarSample() { Gtk.HSeparator separator; Gtk.Table table; Gtk.Button button; Gtk.CheckButton check; Gtk.VBox vbox; //Application.Init (); /* Allocate memory for the data that is passed to the callbacks*/ pdata = new ProgressData(); pdata.activity_mode = false; pdata.window = new Gtk.Window(Gtk.WindowType.Toplevel); pdata.window.Resizable = true; pdata.window.DeleteEvent += destroy_progress; pdata.window.Title = "GtkProgressBar"; pdata.window.BorderWidth = 0; vbox = new Gtk.VBox(false, 5); vbox.BorderWidth = 10; pdata.window.Add(vbox); vbox.Show(); /* Create a centering alignment object */ Gtk.Alignment align = new Gtk.Alignment(1, 1, 0, 0); vbox.PackStart(align, false, false, 5); align.Show(); /* Create the GtkProgressBar */ pdata.pbar = new Gtk.ProgressBar(); pdata.pbar.Text = ""; align.Add(pdata.pbar); pdata.pbar.Show(); /* Add a timer callback to update the value of the progress bar*/ pdata.timer = GLib.Timeout.Add(10000, new GLib.TimeoutHandler(progress_timeout)); separator = new Gtk.HSeparator(); vbox.PackStart(separator, false, false, 0); separator.Show(); /* rows, columns, homogeneous */ table = new Gtk.Table(2, 3, false); vbox.PackStart(table, false, true, 0); table.Show(); /* Add a check button to select displaying of the trough text*/ check = new Gtk.CheckButton("Query cada 1 minuto"); table.Attach(check, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 5, 5); check.Clicked += toggle_show_text; check.Show(); /* Add a check button to toggle activity mode */ check = new Gtk.CheckButton("Activity mode"); table.Attach(check, 0, 1, 1, 2, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 5, 5); check.Clicked += toggle_activity_mode; check.Active = true; check.Show(); /* Add a check button to toggle orientation */ check = new Gtk.CheckButton("Right to Left"); table.Attach(check, 0, 1, 2, 3, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 5, 5); check.Clicked += toggle_orientation; check.Show(); /* Add a button to exit the program */ button = new Gtk.Button("close"); button.Clicked += button_click; vbox.PackStart(button, false, false, 0); /* This makes it so the button is the default. */ button.CanDefault = true; /* This grabs this button to be the default button. Simply hitting * the "Enter" key will cause this button to activate. */ button.GrabDefault(); button.Show(); pdata.window.ShowAll(); //Application.Run (); }
void AddSingleOptionCheckbox (string label, List<TargetFramework> targetFrameworks) { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { LeftPadding = 18 }; var check = new CheckButton (label); foreach (var fx in targetFrameworks) { if (fx.Id.Equals (project.TargetFramework.Id)) { check.Active = true; break; } } check.Toggled += (sender, e) => { TargetFrameworkChanged (check, targetFrameworks); }; checkboxes.Add (check, targetFrameworks); check.Show (); alignment.Add (check); alignment.Show (); vbox1.PackStart (alignment, false, false, 0); }
public MainToolbar() { executionTargetsChanged = DispatchService.GuiDispatch(new EventHandler(HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos(); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } var pixel_scale = GtkWorkarounds.GetPixelScale(); int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - (int)(300 * pixel_scale), args.Allocation.Left); int right = Math.Min(left + (int)(600 * pixel_scale), args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); var searchFiles = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Files")); searchFiles.Activated += delegate { SetSearchCategory("files"); }; var searchTypes = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Types")); searchTypes.Activated += delegate { SetSearchCategory("type"); }; var searchMembers = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Members")); searchMembers.Activated += delegate { SetSearchCategory("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand(Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel(); }; UpdateSearchEntryLabel(); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern(matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy(); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc.Editor != null) { doc.Select(); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation(pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret(); doc.Editor.Parent.StartCaretPulseAnimation(); } return; } if (popup != null) { popup.OpenFile(); } }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) { popup.Destroy(); } doc.Select(); } return; } if (popup != null) { args.RetVal = popup.ProcessKey(args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) { PositionPopup(); } }; SizeAllocated += delegate { PositionPopup(); }; BuildToolbar(); IdeApp.CommandService.RegisterCommandBar(buttonBar); AddinManager.ExtensionChanged += OnExtensionChanged; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, 21); configurationCombo.Changed += HandleConfigurationChanged; runtimeCombo.Changed += HandleRuntimeChanged; UpdateCombos(); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar(this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference(e.OldActiveWidget); }; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public PreviewVisualizerWindow (ObjectValue val, Gtk.Widget invokingWidget) : base (Gtk.WindowType.Toplevel) { this.TypeHint = WindowTypeHint.PopupMenu; this.Decorated = false; if (((Gtk.Window)invokingWidget.Toplevel).Modal) this.Modal = true; TransientFor = (Gtk.Window) invokingWidget.Toplevel; Theme.SetFlatColor (new Cairo.Color (245 / 256.0, 245 / 256.0, 245 / 256.0)); Theme.Padding = 3; ShowArrow = true; var mainBox = new VBox (); var headerTable = new Table (1, 3, false); headerTable.ColumnSpacing = 5; var closeButton = new ImageButton () { InactiveImage = ImageService.GetIcon ("md-popup-close", IconSize.Menu), Image = ImageService.GetIcon ("md-popup-close-hover", IconSize.Menu) }; closeButton.Clicked += delegate { this.Destroy (); }; var hb = new HBox (); var vb = new VBox (); hb.PackStart (vb, false, false, 0); vb.PackStart (closeButton, false, false, 0); headerTable.Attach (hb, 0, 1, 0, 1); var headerTitle = new Label (); headerTitle.ModifyFg (StateType.Normal, new Color (36, 36, 36)); var font = headerTitle.Style.FontDescription.Copy (); font.Weight = Pango.Weight.Bold; headerTitle.ModifyFont (font); headerTitle.Text = val.TypeName; var vbTitle = new VBox (); vbTitle.PackStart (headerTitle, false, false, 3); headerTable.Attach (vbTitle, 1, 2, 0, 1); if (DebuggingService.HasValueVisualizers (val)) { var openButton = new Button (); openButton.Label = "Open"; openButton.Relief = ReliefStyle.Half; openButton.Clicked += delegate { PreviewWindowManager.DestroyWindow (); DebuggingService.ShowValueVisualizer (val); }; var hbox = new HBox (); hbox.PackEnd (openButton, false, false, 2); headerTable.Attach (hbox, 2, 3, 0, 1); } else { headerTable.Attach (new Label (), 2, 3, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 10, 0); } mainBox.PackStart (headerTable); mainBox.ShowAll (); var previewVisualizer = DebuggingService.GetPreviewVisualizer (val); if (previewVisualizer == null) previewVisualizer = new GenericPreviewVisualizer (); Control widget = null; try { widget = previewVisualizer.GetVisualizerWidget (val); } catch (Exception e) { DebuggingService.DebuggerSession.LogWriter (true, "Exception during preview widget creation: " + e.Message); } if (widget == null) { widget = new GenericPreviewVisualizer ().GetVisualizerWidget (val); } var alignment = new Alignment (0, 0, 1, 1); alignment.SetPadding (3, 5, 5, 5); alignment.Show (); alignment.Add (widget); mainBox.PackStart (alignment); ContentBox.Add (mainBox); }
public void ShowCalendar() { popup = new Window(WindowType.Popup); popup.Screen = parent.Screen; Frame frame = new Frame(); frame.Shadow = ShadowType.Out; frame.Show(); popup.Add(frame); VBox box = new VBox(false, 0); box.Show(); frame.Add(box); cal = new Calendar(); cal.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; cal.KeyPressEvent += OnCalendarKeyPressed; popup.ButtonPressEvent += OnButtonPressed; cal.Show(); Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); calAlignment.Show(); calAlignment.SetPadding(4, 4, 4, 4); calAlignment.Add(cal); box.PackStart(calAlignment, false, false, 0); //Requisition req = SizeRequest(); parent.GdkWindow.GetOrigin(out xPos, out yPos); // popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3); popup.Move(xPos, yPos); popup.Show(); popup.GrabFocus(); Grab.Add(popup); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(popup.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(popup); popup.Destroy(); popup = null; } } else { Grab.Remove(popup); popup.Destroy(); popup = null; } cal.DaySelected += OnCalendarDaySelected; cal.MonthChanged += OnCalendarMonthChanged; cal.Date = date; }
void AddWarningLabel () { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { TopPadding = 8, LeftPadding = 18, RightPadding = 18 }; warning = new Label ("Test Error"); warning.SetAlignment (0.0f, 0.5f); warning.Show (); infoImage = new Image (GetType ().Assembly, "warning-16.png"); warningImage = new Image (GetType ().Assembly, "error-16.png"); warningHBox = new HBox (false, 6); warningHBox.PackStart (infoImage, false, false, 0); warningHBox.PackStart (warningImage, false, false, 0); warningHBox.PackStart (warning, false, true, 0); alignment.Child = warningHBox; alignment.Show (); vbox1.PackStart (alignment, false, true, 0); }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); hbox.PackStart (label, false, false, 0); store = new ListStore (typeof (string), typeof (PolicySet)); policyCombo = new ComboBox (store); CellRenderer renderer = new CellRendererText (); policyCombo.PackStart (renderer, true); policyCombo.AddAttribute (renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string) model.GetValue (iter, 0)) == "--"; hbox.PackStart (policyCombo, false, false, 0); VBox vbox = new VBox (false, 6); vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); // Warning message to be shown when the user modifies the default policy warningMessage = new HBox (); warningMessage.Spacing = 6; Image img = new Image (Gtk.Stock.DialogWarning, IconSize.LargeToolbar); warningMessage.PackStart (img, false, false, 0); Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + "Settings for existing projects can be modified in the project (or solution) options dialog.")); wl.Xalign = 0; wl.Wrap = true; wl.WidthRequest = 450; warningMessage.PackStart (wl, true, true, 0); warningMessage.ShowAll (); warningMessage.Visible = false; vbox.PackEnd (warningMessage, false, false, 0); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.SwitchPage += delegate(object o, SwitchPageArgs args) { if (notebook.Page >= 0 && notebook.Page < this.panels.Count) this.panels[notebook.Page].PanelSelected (); }; notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
private void ShowCalendar() { popup = new Window(WindowType.Popup); popup.Screen = tree.Screen; Frame frame = new Frame(); frame.Shadow = ShadowType.Out; frame.Show(); popup.Add(frame); VBox box = new VBox(false, 0); box.Show(); frame.Add(box); cal = new Calendar(); cal.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; cal.KeyPressEvent += OnCalendarKeyPressed; popup.ButtonPressEvent += OnButtonPressed; cal.Show(); Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); calAlignment.Show(); calAlignment.SetPadding(4, 4, 4, 4); calAlignment.Add(cal); box.PackStart(calAlignment, false, false, 0); // FIXME: Make the popup appear directly below the date Gdk.Rectangle allocation = tree.Allocation; // Gtk.Requisition req = tree.SizeRequest (); int x = 0, y = 0; tree.GdkWindow.GetOrigin(out x, out y); // popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3); popup.Move(x + allocation.X, y + allocation.Y); popup.Show(); popup.GrabFocus(); Grab.Add(popup); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(popup.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(popup); popup.Destroy(); popup = null; } } else { Grab.Remove(popup); popup.Destroy(); popup = null; } cal.DaySelectedDoubleClick += OnCalendarDaySelected; cal.ButtonPressEvent += OnCalendarButtonPressed; cal.Date = date == DateTime.MinValue ? DateTime.Now : date; }
void Build () { Title = GettextCatalog.GetString ("Exception Caught"); DefaultHeight = 350; DefaultWidth = 500; VBox.Spacing = 0; VBox.PackStart (CreateExceptionHeader (), false, true, 0); var vbox = new VBox (false, 0); vbox.PackStart (CreateSeparator (), false, true, 0); vbox.PackStart (CreateExceptionValueTreeView (), true, true, 0); vbox.PackStart (CreateSeparator (), false, true, 0); vbox.PackStart (CreateStackTraceTreeView (), true, true, 0); vbox.PackStart (CreateSeparator (), false, true, 0); vbox.Show (); VBox.PackStart (vbox, true, true, 0); var actionArea = new HBox (false, 12) { BorderWidth = 6 }; OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show (); var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show (); actionArea.PackStart (alignment, true, true, 0); actionArea.PackStart (CreateButtonBox (), false, true, 0); actionArea.Show (); VBox.PackStart (actionArea, false, true, 0); ActionArea.Hide (); }
void Build () { Title = GettextCatalog.GetString ("Exception Caught"); DefaultHeight = 500; DefaultWidth = 600; VBox.Spacing = 0; VBox.PackStart (CreateExceptionHeader (), false, true, 0); var paned = new VPaned (); paned.Add1 (CreateExceptionValueTreeView ()); paned.Add2 (CreateStackTraceTreeView ()); paned.Show (); var vbox = new VBox (false, 0); vbox.PackStart (CreateSeparator (), false, true, 0); vbox.PackStart (paned, true, true, 0); vbox.PackStart (CreateSeparator (), false, true, 0); vbox.Show (); VBox.PackStart (vbox, true, true, 0); var actionArea = new HBox (false, 12) { BorderWidth = 6 }; OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show (); OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions ().ProjectAssembliesOnly; var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show (); actionArea.PackStart (alignment, true, true, 0); actionArea.PackStart (CreateButtonBox (), false, true, 0); actionArea.Show (); VBox.PackStart (actionArea, false, true, 0); ActionArea.Hide (); }
public MainToolbar() { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombosBox = new HBox(false, 8); var ctx = new Gtk.CellRendererText(); runConfigurationCombo = new Gtk.ComboBox(); runConfigurationCombo.Model = runConfigurationStore; runConfigurationCombo.PackStart(ctx, true); runConfigurationCombo.AddAttribute(ctx, "text", 0); runConfigurationCombo.TooltipText = GettextCatalog.GetString("A project or named set of projects and execution options that should be launched when running or debugging the solution."); var runConfigurationComboVBox = new VBox(); runConfigurationComboVBox.PackStart(runConfigurationCombo, true, false, 0); configurationCombosBox.PackStart(runConfigurationComboVBox, false, false, 0); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombo.TooltipText = GettextCatalog.GetString("A named set of projects and their configurations to be built when building the solution."); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert(new Pango.AttrWeight(Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); if (Platform.IsWindows) { ctx.Ellipsize = Pango.EllipsizeMode.Middle; } runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; runtimeCombo.TooltipText = GettextCatalog.GetString("The device on which to deploy and launch the projects when running or debugging."); var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - 300, args.Allocation.Left); int right = Math.Min(left + 600, args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) { SearchEntryLostFocus(o, e); } }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) { SearchEntryResized(o, e); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) { ConfigurationChanged(o, e); } }; runConfigurationCombo.Changed += (o, e) => { if (RunConfigurationChanged != null) { RunConfigurationChanged(o, e); } }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs(); if (RuntimeChanged != null) { RuntimeChanged(o, ea); } TreeIter it; if (runtimeCombo.GetActiveIter(out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter(lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences) : base() { if (backend == null) throw new ArgumentNullException ("backend"); if (preferences == null) throw new ArgumentNullException ("preferences"); this.backend = backend; this.preferences = preferences; LoadPreferences (); BorderWidth = 0; // We're using an event box so we can paint the background white EventBox imageEb = new EventBox (); imageEb.BorderWidth = 0; imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255)); imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255)); imageEb.Show (); VBox mainVBox = new VBox(false, 0); mainVBox.BorderWidth = 10; mainVBox.Show(); Add(mainVBox); // Add the rtm logo image = new Gtk.Image (normalPixbuf); image.Show(); //make the dialog box look pretty without hard coding total size and //therefore clipping displays with large fonts. Alignment spacer = new Alignment((float)0.5, 0, 0, 0); spacer.SetPadding(0, 0, 125, 125); spacer.Add(image); spacer.Show(); imageEb.Add (spacer); mainVBox.PackStart(imageEb, true, true, 0); // Status message label statusLabel = new Label(); statusLabel.Justify = Gtk.Justification.Center; statusLabel.Wrap = true; statusLabel.LineWrap = true; statusLabel.Show(); statusLabel.UseMarkup = true; statusLabel.UseUnderline = false; authButton = new LinkButton ( #if GETTEXT Catalog.GetString ("Click Here to Connect")); #elif ANDROID #endif authButton.Clicked += OnAuthButtonClicked; if ( isAuthorized ) { statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are currently connected"); #elif ANDROID #endif string userName = preferences.Get (PreferencesKeys.UserNameKey); if (userName != null && userName.Trim () != string.Empty) statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are currently connected as") + #elif ANDROID #endif "\n" + userName.Trim(); } else { statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are not connected"); #elif ANDROID #endif authButton.Show(); } mainVBox.PackStart(statusLabel, false, false, 0); mainVBox.PackStart(authButton, false, false, 0); Label blankLabel = new Label("\n"); blankLabel.Show(); mainVBox.PackStart(blankLabel, false, false, 0); }
public MainToolbar () { executionTargetsChanged = DispatchService.GuiDispatch (new EventHandler (HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos (); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); var searchFiles = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Files")); searchFiles.Activated += delegate { SetSearchCategory ("files"); }; var searchTypes = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Types")); searchTypes.Activated += delegate { SetSearchCategory ("type"); }; var searchMembers = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Members")); searchMembers.Activated += delegate { SetSearchCategory ("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel (); }; UpdateSearchEntryLabel (); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase (StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern (matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy (); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc != null) { doc.Select (); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret (); doc.Editor.Parent.StartCaretPulseAnimation (); } return; } if (popup != null) popup.OpenFile (); }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) popup.Destroy (); doc.Select (); } return; } if (popup != null) { args.RetVal = popup.ProcessKey (args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) PositionPopup (); }; BuildToolbar (); IdeApp.CommandService.RegisterCommandBar (buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged (ToolbarExtensionPath)) BuildToolbar (); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); UpdateCombos (); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar (this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = e.OldActiveWidget; }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
public MainToolbar () { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); if (Platform.IsWindows) ctx.Ellipsize = Pango.EllipsizeMode.Middle; runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9" matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) SearchEntryResized (o, e); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) ConfigurationChanged (o, e); }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs (); if (RuntimeChanged != null) RuntimeChanged (o, ea); TreeIter it; if (runtimeCombo.GetActiveIter (out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter (lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference (e.OldActiveWidget); }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }