public WelcomePageBarButton (string title, string href, string iconResource = null) { FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows; HoverColor = Styles.WelcomeScreen.Links.HoverColor; Color = Styles.WelcomeScreen.Links.Color; FontSize = Styles.WelcomeScreen.Links.FontSize; VisibleWindow = false; this.Text = GettextCatalog.GetString (title); this.actionLink = href; if (!string.IsNullOrEmpty (iconResource)) { imageHover = Gdk.Pixbuf.LoadFromResource (iconResource); imageNormal = ImageService.MakeTransparent (imageHover, 0.7); } HBox box = new HBox (); box.Spacing = Styles.WelcomeScreen.Links.IconTextSpacing; image = new Image (); label = new Label (); box.PackStart (image, false, false, 0); if (imageNormal == null) image.NoShowAll = true; box.PackStart (label, false, false, 0); box.ShowAll (); Add (box); Update (); Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask); }
// constructor that show the graphic interface to users public Graphics(Game g) : base(Gtk.WindowType.Toplevel) { Build (); int scale = 10; if (Screen.Height < 1000) scale = 5; this.game = g; VBox gridWrapper = new VBox (); HBox box = new HBox (); this.status = new Label (""); this.chooser = new Popup (this, this.game.getChooseableFigures(), handleChooser, scale); this.mainGrid = new GridWidget (this.game, clickHandler, scale); gridWrapper.PackStart (status, false, false, 0); gridWrapper.PackStart (this.mainGrid, false, false, 0); this.sidebarLeft = new SidebarWidget (g.getRemovedFigures (), "black", scale); box.PackStart (new HBox ()); box.PackStart (this.sidebarLeft); box.PackStart (gridWrapper, false, false, 0); this.sidebarRight = new SidebarWidget (g.getRemovedFigures (), "white", scale); box.PackEnd (this.sidebarRight); box.PackStart (new HBox ()); box.ShowAll (); this.Add (box); updateGui (this.game.initialState ()); this.Show (); }
void BuildDialogUI() { // Add an HBox to the dialog's VBox. HBox hbox = new HBox (false, 8); hbox.BorderWidth = 8; this.VBox.PackStart (hbox, false, false, 0); // Add an Image widget to the HBox using a stock 'info' icon. Image stock = new Image (Stock.DialogInfo, IconSize.Dialog); hbox.PackStart (stock, false, false, 0); // Here we are using a Table to contain the other widgets. // Notice that the Table is added to the hBox. Table table = new Table (2, 2, false); table.RowSpacing = 4; table.ColumnSpacing = 4; hbox.PackStart (table, true, true, 0); Label label = new Label ("_Username"); table.Attach (label, 0, 1, 0, 1); table.Attach (usernameEntry, 1, 2, 0, 1); label.MnemonicWidget = usernameEntry; label = new Label ("_Password"); table.Attach (label, 0, 1, 1, 2); table.Attach (passwordEntry , 1, 2, 1, 2); label.MnemonicWidget = passwordEntry ; hbox.ShowAll (); // Add OK and Cancel Buttons. this.AddButton(Stock.Ok, ResponseType.Ok); this.AddButton(Stock.Cancel, ResponseType.Cancel); }
public void AddMessage (string msg, string icon) { if (lastImage != null) { HSeparator sep = new HSeparator (); sep.Show (); msgBox.PackStart (sep); lastImage.IconSize = (int) Gtk.IconSize.Button; } HBox box = new HBox (); box.Spacing = 12; Alignment imgBox = new Alignment (0, 0, 0, 0); Image img = new Image (icon, lastImage != null ? Gtk.IconSize.Button : IconSize.Dialog); imgBox.Add (img); lastImage = img; box.PackStart (imgBox, false, false, 0); Label lab = new Label (msg); lab.Xalign = 0; lab.Yalign = 0; lab.Wrap = true; lab.WidthRequest = 500; box.PackStart (lab, true, true, 0); msgBox.PackStart (box, false, false, 0); box.ShowAll (); }
public static Gtk.Window Create () { HBox options = new HBox (false, 0); CheckButton check_button = null; window = new ColorSelectionDialog ("Color selection dialog"); window.ColorSelection.HasOpacityControl = true; window.ColorSelection.HasPalette = true; window.SetDefaultSize (250, 200); window.VBox.PackStart (options, false, false, 0); window.VBox.BorderWidth = 10; check_button = new CheckButton("Show Opacity"); check_button.Active = true; options.PackStart (check_button, false, false, 0); check_button.Toggled += new EventHandler (Opacity_Callback); check_button = new CheckButton("Show Palette"); check_button.Active = true; options.PackEnd (check_button, false, false, 0); check_button.Toggled += new EventHandler (Palette_Callback); window.ColorSelection.ColorChanged += new EventHandler (Color_Changed); window.OkButton.Clicked += new EventHandler (Color_Selection_OK); window.CancelButton.Clicked += new EventHandler (Color_Selection_Cancel); options.ShowAll (); return window; }
protected void InitializeExtraWidget() { PlaylistFormatDescription [] formats = PlaylistFileUtil.ExportFormats; int default_export_index = PlaylistFileUtil.GetFormatIndex(formats, playlist); // Build custom widget used to select the export format. store = new ListStore(typeof(string), typeof(PlaylistFormatDescription)); foreach (PlaylistFormatDescription format in formats) { store.AppendValues(format.FormatName, format); } HBox hBox = new HBox(false, 2); combobox = new ComboBox(store); CellRendererText crt = new CellRendererText(); combobox.PackStart(crt, true); combobox.SetAttributes(crt, "text", 0); combobox.Active = default_export_index; combobox.Changed += OnComboBoxChange; hBox.PackStart(new Label(Catalog.GetString("Select Format: ")), false, false, 0); hBox.PackStart(combobox, true, true, 0); combobox.ShowAll(); hBox.ShowAll(); ExtraWidget = hBox; }
public void AddMessage (string msg, IconId icon) { if (lastImage != null) { HSeparator sep = new HSeparator (); sep.Show (); msgBox.PackStart (sep, false, false, 0); lastImage.IconSize = Gtk.IconSize.Menu; } HBox box = new HBox (); box.Spacing = 12; Alignment imgBox = new Alignment (0, 0, 0, 0); var img = new ImageView (icon, lastImage != null ? Gtk.IconSize.Menu : IconSize.Dialog); imgBox.Add (img); lastImage = img; box.PackStart (imgBox, false, false, 0); Label lab = new Label (msg); lab.UseUnderline = false; lab.Xalign = 0; lab.Yalign = 0; lab.Wrap = true; lab.WidthRequest = 500; box.PackStart (lab, true, true, 0); msgBox.PackStart (box, false, false, 0); box.ShowAll (); }
private void AppendChat(IChat chat) { Gtk.HBox container = new Gtk.HBox(); Gtk.Label label = new Gtk.Label(chat.Name); container.PackStart(label); Gtk.Button button = new Gtk.Button(new Gtk.Image(Gtk.IconTheme.Default.LookupIcon("gtk-close", 16, Gtk.IconLookupFlags.NoSvg).LoadIcon())); button.Clicked += OnClicked; button.Relief = Gtk.ReliefStyle.None; button.SetSizeRequest(20, 20); container.PackEnd(button); Gtk.TextView view = new Logopathy.Gui.ChatView(chat); ScrolledWindow view_swin = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0)); view_swin.Add(view); view_swin.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic); hash.Add(container, view); int pos = AppendPage(view_swin, container); container.ShowAll(); ShowAll(); AddedChats.Add(chat); ChatToPage.Add(chat, pos); }
public ListPage(Notebook notebook, ModulesTreeInfo module) { this.notebook = notebook; this.module = module; headerbox = new HBox(); headerlabel = new Label(module.Text); headerbox.PackStart(headerlabel); //Image img = new Image("gtk-close", IconSize.Menu); close_img = ImageManager.GetImage("Images.close-button.png"); //close_img = new Image("gtk-close", IconSize.Menu); btnCloseTab = new Button(close_img); btnCloseTab.BorderWidth = 0; btnCloseTab.Relief = ReliefStyle.None; //btnCloseTab.WidthRequest = 19; //btnCloseTab.HeightRequest = 19; btnCloseTab.Clicked += delegate { this.Dispose(); }; headerbox.PackStart(btnCloseTab); headerbox.ShowAll(); tableview = new DataTableView(module); this.Add(tableview); this.ShowAll(); notebook.AppendPage(this, headerbox); notebook.SetTabReorderable(this, true); }
public ParameterInformationWindow() { desc = new Gtk.Label (""); desc.Xalign = 0; desc.Wrap = true; count = new Gtk.Label (""); mainBox = new HBox (false, 2); mainBox.BorderWidth = 3; HBox arrowHBox = new HBox (); goPrev = new Gtk.Arrow (Gtk.ArrowType.Up, ShadowType.None); arrowHBox.PackStart (goPrev, false, false, 0); arrowHBox.PackStart (count, false, false, 0); goNext = new Gtk.Arrow (Gtk.ArrowType.Down, ShadowType.None); arrowHBox.PackStart (goNext, false, false, 0); VBox vBox = new VBox (); vBox.PackStart (arrowHBox, false, false, 0); mainBox.PackStart (vBox, false, false, 0); mainBox.PackStart (desc, true, true, 0); mainBox.ShowAll (); this.Add (mainBox); EnableTransparencyControl = true; }
private void BuildWidget () { HBox box = new HBox (); disk_bar_align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f); disk_bar = new SegmentedBar (); disk_bar.ValueFormatter = DapValueFormatter; disk_bar.AddSegmentRgb (Catalog.GetString ("Audio"), 0, 0x3465a4); disk_bar.AddSegmentRgb (Catalog.GetString ("Video"), 0, 0x73d216); disk_bar.AddSegmentRgb (Catalog.GetString ("Other"), 0, 0xf57900); disk_bar.AddSegment (Catalog.GetString ("Free Space"), 0, disk_bar.RemainderColor, false); UpdateUsage (); disk_bar_align.Add (disk_bar); box.PackStart (disk_bar_align, true, true, 0); disk_bar_align.TopPadding = 6; Add (box); box.ShowAll (); SizeAllocated += delegate (object o, Gtk.SizeAllocatedArgs args) { SetBackground (); disk_bar.HorizontalPadding = (int)(args.Allocation.Width * 0.25); }; }
public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6) { this.project = project as DotNetProject; Gtk.HBox box = new Gtk.HBox (false, 3); Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:")); box.PackStart (lbl, false, false, 0); comboVersions = ComboBox.NewText (); ReferenceManager refmgr = new ReferenceManager (project as DotNetProject); foreach (string v in refmgr.SupportedGtkVersions) comboVersions.AppendText (v); comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion); refmgr.Dispose (); box.PackStart (comboVersions, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); HSeparator sep = new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); if (!GtkDesignInfo.HasDesignedObjects (project)) return; GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project); checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support")); checkGettext.Active = designInfo.GenerateGettext; checkGettext.Show (); PackStart (checkGettext, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0); entryGettext = new Gtk.Entry (); entryGettext.Text = designInfo.GettextClass; entryGettext.Sensitive = checkGettext.Active; box.PackStart (entryGettext, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); sep= new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0); entryFolderName = new Gtk.Entry (); entryFolderName.Text = designInfo.SteticFolderName; entryFolderName.Sensitive = false; box.PackStart (entryFolderName, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files")); checkHideFiles.Active = designInfo.HideGtkxFiles; checkHideFiles.Show (); PackStart (checkHideFiles, false, false, 0); }
public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6) { this.project = project as DotNetProject; Gtk.HBox box = new Gtk.HBox (false, 3); Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:")); box.PackStart (lbl, false, false, 0); comboVersions = ComboBox.NewText (); ReferenceManager refmgr = new ReferenceManager (project as DotNetProject); foreach (string v in refmgr.SupportedGtkVersions) comboVersions.AppendText (v); comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion); refmgr.Dispose (); box.PackStart (comboVersions, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); HSeparator sep = new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); if (!GtkDesignInfo.HasDesignedObjects (project)) return; GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project); checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support")); checkGettext.Active = designInfo.GenerateGettext; checkGettext.Show (); PackStart (checkGettext, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0); entryGettext = new Gtk.Entry (); entryGettext.Text = designInfo.GettextClass; entryGettext.Sensitive = checkGettext.Active; box.PackStart (entryGettext, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Resource loader class:")), false, false, 0); entryResourceLoader = new Gtk.Entry (); entryResourceLoader.Text = designInfo.ImageResourceLoaderClass; entryResourceLoader.Sensitive = checkGettext.Active; box.PackStart (entryResourceLoader, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); checkGettext.Clicked += delegate { box.Sensitive = checkGettext.Active; if (checkGettext.Active) entryGettext.Text = "Mono.Unix.Catalog"; }; }
///<summary> /// Show a warning that the file has been changed /// outside of the respective DataView ///</summary> public void ShowFileChangedBar() { if (fileChangedBar == null) { fileChangedBar = new FileChangedBar(this.View); } this.PackStart(fileChangedBar, false, false, 0); this.ReorderChild(fileChangedBar, 0); fileChangedBar.ShowAll(); }
public WidgetBuilderOptionPanelWidget(Project project) : base(false, 6) { this.project = project as DotNetProject; Gtk.HBox box = new Gtk.HBox(false, 3); Gtk.Label lbl = new Gtk.Label(GettextCatalog.GetString("Target Gtk# version:")); box.PackStart(lbl, false, false, 0); comboVersions = ComboBox.NewText(); ReferenceManager refmgr = new ReferenceManager(project as DotNetProject); foreach (string v in refmgr.SupportedGtkVersions) { comboVersions.AppendText(v); } comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf(refmgr.GtkPackageVersion); refmgr.Dispose(); box.PackStart(comboVersions, false, false, 0); box.ShowAll(); PackStart(box, false, false, 0); HSeparator sep = new HSeparator(); sep.Show(); PackStart(sep, false, false, 0); if (!GtkDesignInfo.HasDesignedObjects(project)) { return; } GtkDesignInfo designInfo = GtkDesignInfo.FromProject(project); checkGettext = new CheckButton(GettextCatalog.GetString("Enable gettext support")); checkGettext.Active = designInfo.GenerateGettext; checkGettext.Show(); PackStart(checkGettext, false, false, 0); box = new Gtk.HBox(false, 3); box.PackStart(new Label(GettextCatalog.GetString("Gettext class:")), false, false, 0); entryGettext = new Gtk.Entry(); entryGettext.Text = designInfo.GettextClass; entryGettext.Sensitive = checkGettext.Active; box.PackStart(entryGettext, false, false, 0); box.ShowAll(); PackStart(box, false, false, 0); checkGettext.Clicked += delegate { box.Sensitive = checkGettext.Active; if (checkGettext.Active) { entryGettext.Text = "Mono.Unix.Catalog"; } }; }
public MiniButton (string text, string icon): this () { HBox box = new HBox (false, 3); Image img = new Image (icon, IconSize.Menu); box.PackStart (img, false, false, 0); Label label = new Label (text); label.Xalign = 0; box.PackStart (label, true, true, 0); box.ShowAll (); Add (box); }
private void createComboEncoderAutomaticVariable() { combo_encoder_variable_automatic = ComboBox.NewText(); string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, Constants.MaxForce, Constants.MeanPower, Constants.PeakPower }; UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, ""); combo_encoder_variable_automatic.Active = UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power"); hbox_combo_encoder_variable_automatic.PackStart(combo_encoder_variable_automatic, false, false, 0); hbox_combo_encoder_variable_automatic.ShowAll(); combo_encoder_variable_automatic.Sensitive = true; }
private void createComboEncoderMainVariable() { combo_encoder_main_variable = ComboBox.NewText(); comboEncoderMainVariableFill(); hbox_combo_encoder_main_variable.PackStart(combo_encoder_main_variable, false, false, 0); hbox_combo_encoder_main_variable.ShowAll(); combo_encoder_main_variable.Sensitive = true; combo_encoder_main_variable.Changed += new EventHandler(on_combo_encoder_main_variable_changed); }
protected virtual void InitializeForm() { XML form = FormHelper.LoadGladeXML("WbpPrintPreview.glade", "hboPrintPreviewRoot"); form.Autoconnect(this); btnSave.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png")); btnClose.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png")); btnPrint.SetChildImage(FormHelper.LoadImage("Icons.Print24.png")); tcPages = new SizeChooser(maxAutoColumns, maxAutoRows, DataHelper.ResourcesAssembly, FormHelper.GetResourceName("Icons.Page24.png")); tcPages.SizeChanged += tcPages_SizeChanged; algPages.Add(tcPages); btnDocumentDesigner.SetChildImage(FormHelper.LoadImage("Icons.DesignDoc24.png")); btnExport.SetChildImage(FormHelper.LoadImage("Icons.Export24.png")); Image icon = FormHelper.LoadImage("Icons.Report32.png"); algPrintPreviewIcon.Add(icon); icon.Show(); Add(hboPrintPreviewRoot); hboPrintPreviewRoot.KeyPressEvent += WbpPrintPreview_KeyPressEvent; OuterKeyPressed += WbpPrintPreview_KeyPressEvent; cboZoom.Changed += cboZoom_Changed; spbPage.ValueChanged += spbPage_Changed; spbPage.Adjustment.Lower = 1d; CreatePreview(); algPrintPreview.Add(currentPreview); hboPrintPreviewRoot.ShowAll(); btnPrint.Sensitive = BusinessDomain.AppConfiguration.IsPrinterAvailable(Printer); btnExport.Visible = BusinessDomain.DocumentExporters.Count > 0; btnSave.Visible = false; btnDocumentDesigner.Visible = documentDesigner != null; tbtnPortrait.Toggled -= tbtnPortrait_Toggled; tbtnLandscape.Active = BusinessDomain.AppConfiguration.IsPrinterAvailable(Printer) && PrintDocument.FormToPrint.Landscape; tbtnPortrait.Active = !tbtnLandscape.Active; tbtnPortrait.Toggled += tbtnPortrait_Toggled; tbtnPortrait.Image = FormHelper.LoadImage("Icons.Portrait.png"); tbtnLandscape.Image = FormHelper.LoadImage("Icons.Landscape.png"); InitializeStrings(); }
public PropertyGridHeader() { name = (PropertyDescriptor)Registry.LookupClassByName("Gtk.Widget") ["Name"]; AppendProperty(name); Gtk.HBox box = new Gtk.HBox(false, 6); image = new Gtk.Image(); box.PackStart(image, false, false, 0); label = new Gtk.Label(); box.PackStart(label, false, false, 0); box.ShowAll(); AppendPair("Widget Class", box, null); }
private void addPage (Widget widget, string label) { HBox hBox = new HBox (); hBox.Add(new Label (label)); Button button = new Button (new Image (Stock.Cancel, IconSize.Button )); hBox.Add (button); hBox.ShowAll(); notebook1.AppendPage (widget, new Label(label)); button.Clicked += delegate { widget.Destroy (); }; }
public static void Main() { Gtk.Window window; Gtk.VBox vbox; Crumbs crumbs; Application.Init (); // Outer Window window = new Gtk.Window ("Crumbs Test"); window.BorderWidth = 12; window.Destroyed += OnDestroy; // Main VBox vbox = new Gtk.VBox (); window.Add(vbox); vbox.Show (); // Crumbs widget crumbs = new Crumbs (); vbox.PackStart (crumbs, false, false, 0); // Home Button crumbs.Add (new Gtk.Image (Gtk.Stock.Home, Gtk.IconSize.Menu)); // Folder1 HBox hbox1 = new HBox (); hbox1.Spacing = 3; Gtk.Image img1 = new Gtk.Image (Stock.Directory, IconSize.Menu); hbox1.PackStart (img1, false, true, 0); hbox1.PackStart (new Label ("Documents")); hbox1.ShowAll (); crumbs.Add (hbox1); // Folder2 HBox hbox2 = new HBox (); hbox2.Spacing = 3; Gtk.Image img2 = new Gtk.Image (Stock.Directory, IconSize.Menu); hbox2.PackStart (img2, false, true, 0); hbox2.PackStart (new Label ("Spreadsheets")); hbox2.ShowAll (); crumbs.Add (hbox2); // Worksheet crumbs.Add (new Label ("Worksheet")); crumbs.ShowAll (); window.Show (); Application.Run (); }
public NotebookPage (Page page) { this.page = page; BorderWidth = 5; Spacing = 10; tab_widget = new Label (page.Name); tab_widget.Show (); Widget page_widget = page.DisplayWidget as Widget; if (page_widget != null) { page_widget.Show (); PackStart (page_widget, true, true, 0); } else { foreach (Section section in page) { AddSection (section); } if (page.ChildPages.Count > 0) { Notebook notebook = new Notebook (); notebook.ShowBorder = false; notebook.ShowTabs = false; notebook.Show (); var hbox = new HBox () { Spacing = 6 }; // FIXME this shouldn't be hard-coded to 'Source:', but this is the only // user of this code atm... var page_label = new Label (Mono.Unix.Catalog.GetString ("Source:")); var page_combo = new PageComboBox (page.ChildPages, notebook); hbox.PackStart (page_label, false, false, 0); hbox.PackStart (page_combo, true, true, 0); hbox.ShowAll (); PackStart (hbox, false, false, 0); HSeparator sep = new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); foreach (Page child_page in page.ChildPages) { NotebookPage page_ui = new NotebookPage (child_page); page_ui.BorderWidth = 0; page_ui.Show (); notebook.AppendPage (page_ui, null); } PackStart (notebook, true, true, 0); } } }
internal void Init(Gtk.Window parent, Widget waitingWidget, ButtonSet buttonSet, string title, string statement, string secondaryStatement) { this.Title = title; this.HasSeparator = false; this.Resizable = false; this.Modal = true; if(parent != null) this.TransientFor = parent; this.buttonSet = buttonSet; HBox h = new HBox(); h.BorderWidth = 10; h.Spacing = 10; if (waitingWidget != null) { h.PackStart(waitingWidget, false, false, 0); } VBox v = new VBox(); v.Spacing = 10; Label l = new Label(); l.LineWrap = true; l.UseMarkup = true; l.Selectable = false; l.CanFocus = false; l.Xalign = 0; l.Yalign = 0; l.Markup = "<span weight=\"bold\" size=\"larger\">" + statement + "</span>"; v.PackStart(l); l = new Label(secondaryStatement); l.LineWrap = true; l.Selectable = false; l.CanFocus = false; l.Xalign = 0; l.Yalign = 0; v.PackStart(l, true, true, 8); h.PackEnd(v); h.ShowAll(); this.VBox.Add(h); switch(buttonSet) { case ButtonSet.Cancel: this.AddButton(Stock.Cancel, ResponseType.Cancel); break; case ButtonSet.None: default: break; } }
private void AddPage(Widget widget) { HBox hbox = new HBox(); hbox.PackStart(new Label("Label")); Button closeButton = new Button("X"); closeButton.Relief = ReliefStyle.None; closeButton.FocusOnClick = false; closeButton.Clicked += delegate { hbox.Destroy(); widget.Destroy(); }; hbox.PackStart(closeButton); hbox.ShowAll(); notebook.AppendPage(widget, hbox); notebook.ShowAll(); }
public MainWindow(InvoiceDirectory idir_) : base(WindowType.Toplevel) { idir = idir_; SetSizeRequest(500, 500); Title = "Fakturering 2.6"; maingroup = new HBox(false, 0); buttons = new VButtonBox(); scrolledhd = new ScrolledWindow(); create = Button.NewWithLabel("Skapa ny faktura"); edit = Button.NewWithLabel("Redigera faktura"); delete = Button.NewWithLabel("Radera faktura"); showbut = Button.NewWithLabel("Visa faktura"); printbut = Button.NewWithLabel("Skriv ut faktura"); CreateListView(); Add(maingroup); maingroup.PackStart(scrolledhd, true, true, 0); maingroup.PackStart(buttons, false, false, 0); buttons.Layout = ButtonBoxStyle.Start; buttons.PackStart(create, false, false, 0); buttons.PackStart(edit, false, false, 0); buttons.PackStart(showbut, false, false, 0); buttons.PackStart(printbut, false, false, 0); buttons.PackStart(delete, false, false, 0); scrolledhd.AddWithViewport(listview); scrolledhd.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); UpdateHDList(); create.Clicked += new EventHandler(Create); edit.Clicked += new EventHandler(Edit); delete.Clicked += new EventHandler(DeleteInvoice); showbut.Clicked += new EventHandler(ShowInvoice); printbut.Clicked += new EventHandler(PrintInvoice); maingroup.ShowAll(); //Den här måste vara här då storleken inte är känd innan ScrollToEnd(scrolledhd); DeleteEvent += new Gtk.DeleteEventHandler(DeleteWindow); }
protected void OpenPanel(string label) { gtktest.DataListWidget w = new gtktest.DataListWidget(); HBox hbox = new HBox(); hbox.PackStart(new Label(label)); Button close = new Button("X"); close.Relief = ReliefStyle.None; close.FocusOnClick = false; close.Clicked += delegate { this.notebook1.Remove(w); }; hbox.PackStart(close); hbox.ShowAll(); int i = this.notebook1.AppendPage (w, hbox); this.notebook1.ShowAll(); this.notebook1.CurrentPage = i; }
public static Gtk.Widget CreateCellRenderer(ApplicationContext actx, ICollection <CellView> views) { if (views.Count == 1) { Gtk.HBox box = new Gtk.HBox(); foreach (var v in views) { box.PackStart(CreateCellRenderer(actx, v), v.Expands, false, 0); } box.ShowAll(); return(box); } else { return(CreateCellRenderer(actx, views.First())); } }
public void AddWidget(KeyAction action, string desc, HotKey key, int position) { uint row_top, row_bottom, col_left, col_right; HBox box; Label descLabel, keyLabel; Button edit; Gtk.Image editImage; box = new HBox (); box.Spacing = 5; descLabel = new Label (); descLabel.Markup = String.Format ("<b>{0}</b>", desc); keyLabel = new Label (); keyLabel.Markup = GLib.Markup.EscapeText (key.ToString()); edit = new Button (); editImage = new Gtk.Image (LongoMatch.Gui.Helpers.Misc.LoadIcon ("longomatch-pencil", 24)); edit.Add (editImage); box.PackStart (descLabel, true, true, 0); box.PackStart (keyLabel, false, true, 0); box.PackStart (edit, false, true, 0); box.ShowAll (); sgroup.AddWidget (keyLabel); descLabel.Justify = Justification.Left; descLabel.SetAlignment (0f, 0.5f); edit.Clicked += (sender, e) => { HotKey hotkey = Config.GUIToolkit.SelectHotkey (key); if (hotkey != null) { if (Config.Hotkeys.ActionsHotkeys.ContainsValue (hotkey)) { Config.GUIToolkit.ErrorMessage (Catalog.GetString ("Hotkey already in use: ") + GLib.Markup.EscapeText (hotkey.ToString()), this); } else { Config.Hotkeys.ActionsHotkeys[action] = hotkey; Config.Save (); keyLabel.Markup = GLib.Markup.EscapeText (hotkey.ToString()); } } }; row_top = (uint)(position / table.NColumns); row_bottom = (uint)row_top + 1; col_left = (uint)position % table.NColumns; col_right = (uint)col_left + 1; table.Attach (box, col_left, col_right, row_top, row_bottom); }
public HmPreferencesWidget() : base() { HmBackend.LoadCredentials (out this.username, out this.password); //Fixme Please ! I look UGLY! VBox mainVBox = new VBox(false, 12); mainVBox.BorderWidth = 10; mainVBox.Show(); Add(mainVBox); HBox usernameBox = new HBox(false, 12); Gtk.Label emailLabel = new Label ("Email Address"); usernameBox.Add (emailLabel); emailEntry = new Entry(username); usernameBox.Add (emailEntry); usernameBox.ShowAll(); mainVBox.PackStart (usernameBox, false, false, 0); HBox passwordBox = new HBox(false, 12); Gtk.Label passwordLabel = new Label ("Password"); passwordBox.Add (passwordLabel); passwordEntry = new Entry(password); passwordBox.Add (passwordEntry); passwordBox.ShowAll(); mainVBox.PackStart (passwordBox, false, false, 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; mainVBox.PackStart(statusLabel, false, false, 0); authButton = new LinkButton("Click Here to Connect"); authButton.Show(); mainVBox.PackStart(authButton, false, false, 0); mainVBox.ShowAll(); authButton.Clicked += OnAuthButtonClicked; }
public BrowseFile(HBox parent, string file, bool browse_file) { this.browse_file = browse_file; filename = new Entry (); browse = new Button (Catalog.GetString ("Browse...")); Filename = file; browse.Clicked += new EventHandler (OnBrowse); parent.Add (filename); parent.Add (browse); Gtk.Box.BoxChild box = (Gtk.Box.BoxChild) parent[browse]; box.Expand = false; box.Fill = false; parent.ShowAll (); }
public FixSource () : base (Catalog.GetString ("Metadata Fixer"), Catalog.GetString ("Metadata Fixer"), -1) { TypeUniqueId = "fixes"; var header_widget = new HBox () { Spacing = 6 }; header_widget.PackStart (new Label (Catalog.GetString ("Problem Type:")), false, false, 0); var combo = new Banshee.Widgets.DictionaryComboBox<Solver> (); foreach (var solver in problem_model.Solvers) { combo.Add (solver.Name, solver); } combo.Changed += (o, a) => { problem_model.Solver = combo.ActiveValue; SetStatus (problem_model.Solver.Description, false, false, "gtk-info"); }; combo.Active = 0; var apply_button = new Hyena.Widgets.ImageButton (Catalog.GetString ("Apply Selected Fixes"), "gtk-apply"); apply_button.Clicked += (o, a) => problem_model.Fix (); problem_model.Reloaded += (o, a) => apply_button.Sensitive = problem_model.SelectedCount > 0; header_widget.PackStart (combo, false, false, 0); header_widget.PackStart (apply_button, false, false, 0); header_widget.ShowAll (); Properties.SetStringList ("Icon.Name", "search", "gtk-search"); Properties.SetString ("ActiveSourceUIResource", "ActiveUI.xml"); Properties.SetString ("GtkActionPath", "/FixSourcePopup"); Properties.Set<Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget); Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new View (problem_model)); Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Close")); Properties.SetString ("UnmapSourceActionIconName", "gtk-close"); var actions = new BansheeActionGroup ("fix-source"); actions.AddImportant ( new ActionEntry ("RefreshProblems", Stock.Refresh, Catalog.GetString ("Refresh"), null, null, (o, a) => { problem_model.Refresh (); }) ); actions.Register (); problem_model.Reload (); }
public iFolderExceptionDialog( Gtk.Window parent, System.Exception exception) : base() { this.Title = Util.GS("iFolder Error"); this.HasSeparator = true; this.Resizable = false; this.Modal = true; this.ex = exception; if(parent != null) this.TransientFor = parent; HBox h = new HBox(); h.BorderWidth = 10; h.Spacing = 10; Image i = new Image(); i.SetFromStock(Gtk.Stock.DialogError, IconSize.Dialog); i.SetAlignment(0.5F, 0); h.PackStart(i, false, false, 0); VBox v = new VBox(); v.BorderWidth = 10; v.Spacing = 10; Label l = new Label("<span weight=\"bold\" size=\"larger\">" + GLib.Markup.EscapeText(exception.Message) + "</span>"); l.LineWrap = true; l.UseMarkup = true; l.UseUnderline = false; l.Selectable = true; l.Xalign = 0; l.Yalign = 0; v.PackStart(l); dButton = new Button(Util.GS("Show Details")); dButton.Clicked += new EventHandler(ButtonPressed); HBox bhbox = new HBox(); bhbox.PackStart(dButton, false, false, 0); v.PackEnd(bhbox, false, false, 0); details = new Label(Util.GS("Click \"Show Details\" below to get the full message returned with this error")); details.LineWrap = true; details.Selectable = true; details.Xalign = 0; details.Yalign = 0; v.PackEnd(details); h.PackEnd(v); h.ShowAll(); this.VBox.Add(h); this.AddButton(Stock.Close, ResponseType.Ok); }
public AvatarMenuItem() : base(true) { Gdk.Pixbuf[] avatars = AvatarManager.Avatars; uint cols = 4; uint rows = 5; Table table = new Table(rows, cols, false); if(avatars.Length > 0) { // Create a label and add it to the table Label label = new Label("Recent Avatars:"); label.Xalign = 0.0f; Widget label_host = RegisterWidget(label); table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); uint curIndex = 0; for(uint row = 1; row < rows; row++) { for(uint col = 0; col < cols; col++) { if( curIndex < avatars.Length ) { AvatarButton button = new AvatarButton(avatars[curIndex], curIndex); button.Clicked += OnAvatarButtonClicked; Widget button_host = RegisterWidget(button); table.Attach(button_host, col, col + 1, row, row + 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); } curIndex++; } } } else { // Create a label and add it to the table Label label = new Label("No Recent Avatars"); label.Sensitive = false; label.Xalign = 0.0f; Widget label_host = RegisterWidget(label); table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); } HBox shrinker = new HBox(); shrinker.PackStart(table, false, false, 0); shrinker.ShowAll(); Add(shrinker); }
protected override Gtk.Widget OnCreateWidget() { //创建界面部件元素 //Create the UI controls. xInnerEntry = new NoUndoNumEntry(); EntryShell xEntryShell = EntryShellBuilder.CreateShell("X", xInnerEntry); yInnerEntry = new NoUndoNumEntry(); EntryShell yEntryShell = EntryShellBuilder.CreateShell("Y", yInnerEntry); HBox hboxMain = new HBox(); hboxMain.Spacing = 4; hboxMain.PackStart(xEntryShell); hboxMain.PackStart(yEntryShell); hboxMain.ShowAll(); //设置输入框的小数点保留位数与数值范围 //Set the value range and amplitude adjustment of the two entries. //The range is saved in ValueRangeAttribute. //You can get it int "BaseEditor.Property.Attributes" ValueRangeAttribute rangeAttr = PropertyItem.Attributes[typeof(ValueRangeAttribute)] as ValueRangeAttribute; if (rangeAttr != null) { xInnerEntry.DecimalPlaces = yInnerEntry.DecimalPlaces = 2; xInnerEntry.ScrollNum = yInnerEntry.ScrollNum = rangeAttr.Step; xInnerEntry.MaxValue = yInnerEntry.MaxValue = rangeAttr.MaxValue; xInnerEntry.MinValue = yInnerEntry.MinValue = rangeAttr.MinValue; } else { xInnerEntry.SetEntryProperty(false, 2, 0.1f); yInnerEntry.SetEntryProperty(false, 2, 0.1f); } //刷新界面 //Refresh the UI controls. SetControl(); xInnerEntry.EntryValueChanged += XEntryValueChangedHandler; yInnerEntry.EntryValueChanged += YEntryValueChangedHandler; return hboxMain; }
private void BuildInterface () { HBox box = new HBox (); volume_button = new ConnectedVolumeButton (true); box.PackStart (action_service.PlaybackActions["PreviousAction"].CreateToolItem (), false, false, 0); box.PackStart (action_service.PlaybackActions["PlayPauseAction"].CreateToolItem (), false, false, 0); box.PackStart (new NextButton (action_service), false, false, 0); box.PackStart (new RepeatActionButton (true), false, false, 0); box.PackStart (slider = new ConnectedSeekSlider (SeekSliderLayout.Horizontal), true, true, 0); box.PackStart (volume_button, false, false, 0); Button exit = new Button (Stock.LeaveFullscreen); exit.Relief = ReliefStyle.None; exit.Clicked += delegate { TransientFor.Hide (); }; box.PackStart (exit, false, false, 0); Add (box); box.ShowAll (); }
public SpinButtonEntryDialog(string title, Window parent, string label, int min, int max, int current) : base(title, parent, DialogFlags.Modal, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { BorderWidth = 6; VBox.Spacing = 3; HBox hbox = new HBox (); hbox.Spacing = 6; Label lbl = new Label (label); lbl.Xalign = 0; hbox.PackStart (lbl); spinButton = new SpinButton (min, max, 1); spinButton.Value = current; hbox.PackStart (spinButton); hbox.ShowAll (); VBox.Add (hbox); DefaultResponse = ResponseType.Ok; AlternativeButtonOrder = new int[] { (int) ResponseType.Ok, (int) ResponseType.Cancel }; }
public MyTreeViewColumn(string title, Gtk.CellRenderer cell,string prop,int col,bool defaultsort) : base(title,cell,prop,col) { up_arrow = MainClass.GetResource("up_arrow.png"); down_arrow = MainClass.GetResource("down_arrow.png"); blank_arrow = MainClass.GetResource("blank_arrow.png"); model_col = col; if(defaultsort) col_icon = new Gtk.Image(up_arrow); else col_icon = new Gtk.Image(blank_arrow); Gtk.HBox hb = new Gtk.HBox(); Gtk.Label lb = new Label(title); hb.PackEnd(col_icon); hb.PackEnd(lb); this.Widget = hb; hb.ShowAll(); base.Clicked += new EventHandler(col_clicked); }
private void Build() { box = new HBox(false, 0); box.SetSizeRequest(40, 40); box.BorderWidth = 2; button = new Button(); button.Clicked += CyclePoint; lblpoints = new Label(); Pango.FontDescription desc = Pango.FontDescription.FromString("Bebas Neue 14"); lblpoints.ModifyFont(desc); lblpoints.Text = points[10]; button.Add(lblpoints); button.ShowAll(); box.Add(this.button); box.ShowAll(); // This damn this call is anoyingly needed otherwise it shant build this.Add(box); }
void reset_hbox_distance_variable(int colsNum) { foreach (Gtk.Entry entry in hbox_distance_variable.Children) { hbox_distance_variable.Remove(entry); } int wc = 3; //widthChars (width of the entry) int ml = 3; //maxLength (max chars to entry) for (int i = 0; i < colsNum; i++) { switch (i) { case 0: dd0.WidthChars = wc; dd0.MaxLength = ml; hbox_distance_variable.PackStart(dd0, false, false, 0); break; case 1: dd1.WidthChars = wc; dd1.MaxLength = ml; hbox_distance_variable.PackStart(dd1, false, false, 0); break; case 2: dd2.WidthChars = wc; dd2.MaxLength = ml; hbox_distance_variable.PackStart(dd2, false, false, 0); break; case 3: dd3.WidthChars = wc; dd3.MaxLength = ml; hbox_distance_variable.PackStart(dd3, false, false, 0); break; case 4: dd4.WidthChars = wc; dd4.MaxLength = ml; hbox_distance_variable.PackStart(dd4, false, false, 0); break; case 5: dd5.WidthChars = wc; dd5.MaxLength = ml; hbox_distance_variable.PackStart(dd5, false, false, 0); break; case 6: dd6.WidthChars = wc; dd6.MaxLength = ml; hbox_distance_variable.PackStart(dd6, false, false, 0); break; case 7: dd7.WidthChars = wc; dd7.MaxLength = ml; hbox_distance_variable.PackStart(dd7, false, false, 0); break; case 8: dd8.WidthChars = wc; dd8.MaxLength = ml; hbox_distance_variable.PackStart(dd8, false, false, 0); break; case 9: dd9.WidthChars = wc; dd9.MaxLength = ml; hbox_distance_variable.PackStart(dd9, false, false, 0); break; } } hbox_distance_variable.ShowAll(); }
public QueryWidget(PhotoQuery query, Db db) : base(new HBox()) { box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; this.query = query; query.Changed += HandleChanged; label = new Gtk.Label(Catalog.GetString("Find: ")); label.Show(); label.Ypad = 9; box.PackStart(label, false, false, 0); untagged = new Gtk.Label(Catalog.GetString("Untagged photos")); untagged.Visible = false; box.PackStart(untagged, false, false, 0); comma1_label = new Gtk.Label(", "); comma1_label.Visible = false; box.PackStart(comma1_label, false, false, 0); rated = new Gtk.Label(Catalog.GetString("Rated photos")); rated.Visible = false; box.PackStart(rated, false, false, 0); comma2_label = new Gtk.Label(", "); comma2_label.Visible = false; box.PackStart(comma2_label, false, false, 0); // Note for translators: 'Import roll' is no command, it means 'Roll that has been imported' rollfilter = new Gtk.Label(Catalog.GetString("Import roll")); rollfilter.Visible = false; box.PackStart(rollfilter, false, false, 0); folder_query_widget = new FolderQueryWidget(query); folder_query_widget.Visible = false; box.PackStart(folder_query_widget, false, false, 0); logic_widget = new LogicWidget(query, db.Tags); logic_widget.Show(); box.PackStart(logic_widget, true, true, 0); warning_box = new Gtk.HBox(); warning_box.PackStart(new Gtk.Label(System.String.Empty)); Gtk.Image warning_image = new Gtk.Image("gtk-info", Gtk.IconSize.Button); warning_image.Show(); warning_box.PackStart(warning_image, false, false, 0); clear_button = new Gtk.Button(); clear_button.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleClearButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; clear_button.TooltipText = Catalog.GetString("Clear search"); box.PackEnd(clear_button, false, false, 0); refresh_button = new Gtk.Button(); refresh_button.Add(new Gtk.Image("gtk-refresh", Gtk.IconSize.Button)); refresh_button.Clicked += HandleRefreshButtonClicked; refresh_button.Relief = Gtk.ReliefStyle.None; refresh_button.TooltipText = Catalog.GetString("Refresh search"); box.PackEnd(refresh_button, false, false, 0); Gtk.Label warning = new Gtk.Label(Catalog.GetString("No matching photos found")); warning_box.PackStart(warning, false, false, 0); warning_box.ShowAll(); warning_box.Spacing = 6; warning_box.Visible = false; box.PackEnd(warning_box, false, false, 0); warning_box.Visible = false; }
public QueryWidget(PhotoQuery query, Db db) : base(new HBox()) { box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; this.query = query; query.Changed += HandleChanged; label = new Gtk.Label(Strings.FindColonSpace); label.Show(); label.Ypad = 9; box.PackStart(label, false, false, 0); untagged = new Gtk.Label(Strings.UntaggedPhotos) { Visible = false }; box.PackStart(untagged, false, false, 0); comma1_label = new Gtk.Label(", ") { Visible = false }; box.PackStart(comma1_label, false, false, 0); rated = new Gtk.Label(Strings.RatedPhotos) { Visible = false }; box.PackStart(rated, false, false, 0); comma2_label = new Gtk.Label(", ") { Visible = false }; box.PackStart(comma2_label, false, false, 0); rollfilter = new Gtk.Label(Strings.ImportRoll) { Visible = false }; box.PackStart(rollfilter, false, false, 0); folder_query_widget = new FolderQueryWidget(query) { Visible = false }; box.PackStart(folder_query_widget, false, false, 0); Logic = new LogicWidget(query, db.Tags); Logic.Show(); box.PackStart(Logic, true, true, 0); warning_box = new Gtk.HBox(); warning_box.PackStart(new Gtk.Label(string.Empty)); var warning_image = new Gtk.Image("gtk-info", Gtk.IconSize.Button); warning_image.Show(); warning_box.PackStart(warning_image, false, false, 0); clear_button = new Gtk.Button(); clear_button.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleClearButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; clear_button.TooltipText = Strings.ClearSearch; box.PackEnd(clear_button, false, false, 0); refresh_button = new Gtk.Button(); refresh_button.Add(new Gtk.Image("gtk-refresh", Gtk.IconSize.Button)); refresh_button.Clicked += HandleRefreshButtonClicked; refresh_button.Relief = Gtk.ReliefStyle.None; refresh_button.TooltipText = Strings.RefreshSearch; box.PackEnd(refresh_button, false, false, 0); var warning = new Gtk.Label(Strings.NoMatchingPhotosFound); warning_box.PackStart(warning, false, false, 0); warning_box.ShowAll(); warning_box.Spacing = 6; warning_box.Visible = false; box.PackEnd(warning_box, false, false, 0); warning_box.Visible = false; }
protected void package() { hbox.PackStart(combo, true, true, 0); hbox.ShowAll(); combo.Sensitive = false; }
public BlessMain(string[] args) { Application.Init(); // Catalog.Init(ConfigureDefines.GETTEXT_PACKAGE, ConfigureDefines.LOCALE_DIR); // load main window from glade XML Glade.XML gxml = new Glade.XML(FileResourcePath.GetDataPath("bless.glade"), "MainWindow", "bless"); gxml.Autoconnect(this); // set the application icon MainWindow.Icon = new Gdk.Pixbuf(FileResourcePath.GetDataPath("bless-48x48.png")); string blessConfDir = FileResourcePath.GetUserPath(); // make sure local configuration directory exists try { if (!Directory.Exists(blessConfDir)) { Directory.CreateDirectory(blessConfDir); } } catch (Exception ex) { ErrorAlert ea = new ErrorAlert(Catalog.GetString("Cannot create user configuration directory"), ex.Message + Catalog.GetString("\n\nSome features of Bless may not work properly."), MainWindow); ea.Run(); ea.Destroy(); } Preferences.Proxy.Enable = false; // load default preferences Preferences.Default.Load(FileResourcePath.GetDataPath("default-preferences.xml")); Preferences.Default["Default.Layout.File"] = FileResourcePath.GetDataPath("bless-default.layout"); // load user preferences LoadPreferences(Path.Combine(blessConfDir, "preferences.xml")); Preferences.Instance.AutoSavePath = Path.Combine(blessConfDir, "preferences.xml"); // add the (empty) Menubar and toolbar uiManager = new UIManager(); MainWindow.AddAccelGroup(uiManager.AccelGroup); uiManager.AddUiFromString(uiXml); actionEntries = new ActionEntry[] { new ActionEntry("File", null, Catalog.GetString("_File"), null, null, null), new ActionEntry("Edit", null, Catalog.GetString("_Edit"), null, null, null), new ActionEntry("View", null, Catalog.GetString("_View"), null, null, null), new ActionEntry("Search", null, Catalog.GetString("_Search"), null, null, null), new ActionEntry("Tools", null, Catalog.GetString("_Tools"), null, null, null), new ActionEntry("Help", null, Catalog.GetString("_Help"), null, null, null) }; ActionGroup group = new ActionGroup("MainMenuActions"); group.Add(actionEntries); group.Add(new ToggleActionEntry[] { new ToggleActionEntry("ToolbarAction", null, Catalog.GetString("Toolbar"), null, null, new EventHandler(OnViewToolbarToggled), false) }); uiManager.InsertActionGroup(group, 0); Widget mb = uiManager.GetWidget("/menubar"); MainVBox.PackStart(mb, false, false, 0); MainVBox.ReorderChild(mb, 0); Widget tb = uiManager.GetWidget("/toolbar"); tb.Visible = false; MainVBox.PackStart(tb, false, false, 0); MainVBox.ReorderChild(tb, 1); // create the DataBook dataBook = new DataBook(); dataBook.PageAdded += new DataView.DataViewEventHandler(OnDataViewAdded); dataBook.Removed += new RemovedHandler(OnDataViewRemoved); dataBook.SwitchPage += new SwitchPageHandler(OnSwitchPage); DataViewBox.PackStart(dataBook); // create the widget groups that hold utility widgets WidgetGroup widgetGroup0 = new WidgetGroup(); WidgetGroup widgetGroup1 = new WidgetGroup(); WidgetGroup sideWidgetGroup0 = new WidgetGroup(); WidgetGroup sideWidgetGroup1 = new WidgetGroup(); widgetGroup0.Show(); widgetGroup1.Show(); sideWidgetGroup0.Show(); sideWidgetGroup1.Show(); MainVBox.PackStart(widgetGroup0, false, false, 0); MainVBox.ReorderChild(widgetGroup0, 3); MainVBox.PackStart(widgetGroup1, false, false, 0); MainVBox.ReorderChild(widgetGroup1, 4); DataViewBox.PackStart(sideWidgetGroup0, false, false, 0); DataViewBox.ReorderChild(sideWidgetGroup0, 0); DataViewBox.PackEnd(sideWidgetGroup1, false, false, 0); //MainVBox.ReorderChild(widgetGroup1, 4); Services.File = new FileService(dataBook, MainWindow); Services.Session = new SessionService(dataBook, MainWindow); Services.UI = new UIService(uiManager); //Services.Info=new InfoService(infobar); // Add area plugins PluginManager.AddForType(typeof(AreaPlugin), new object[0]); PluginManager areaPlugins = PluginManager.GetForType(typeof(AreaPlugin)); Area.InitiatePluginTable(); foreach (AreaPlugin p in areaPlugins.Plugins) { Area.AddFactoryItem(p.Name, p.CreateArea); } // Load GUI plugins PluginManager.AddForType(typeof(GuiPlugin), new object[] { MainWindow, uiManager }); PluginManager guiPlugins = PluginManager.GetForType(typeof(GuiPlugin)); foreach (Plugin p in guiPlugins.Plugins) { guiPlugins.LoadPlugin(p); } // load recent file history try { History.Instance.Load(Path.Combine(blessConfDir, "history.xml")); } catch (Exception e) { System.Console.WriteLine(e.Message); } // if user specified files on the command line // try to load them if (args.Length > 0) { Services.File.LoadFiles(args); } else if (Preferences.Instance["Session.LoadPrevious"] == "True") { bool loadIt = true; string prevSessionFile = Path.Combine(blessConfDir, "last.session"); if (Preferences.Instance["Session.AskBeforeLoading"] == "True" && File.Exists(prevSessionFile)) { MessageDialog md = new MessageDialog(MainWindow, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, Catalog.GetString("Do you want to load your previous session?")); ResponseType result = (ResponseType)md.Run(); md.Destroy(); if (result == ResponseType.Yes) { loadIt = true; } else { loadIt = false; } } // try to load previous session if (loadIt) { Services.Session.Load(prevSessionFile); } } // if nothing has been loaded, create a new file if (dataBook.NPages == 0) { ByteBuffer bb = Services.File.NewFile(); // create and setup a DataView DataView dv = Services.File.CreateDataView(bb); // append the DataView to the DataBook dataBook.AppendView(dv, new CloseViewDelegate(Services.File.CloseFile), Path.GetFileName(bb.Filename)); } PreferencesChangedHandler handler = new PreferencesChangedHandler(OnPreferencesChanged); Preferences.Proxy.Subscribe("View.Toolbar.Show", "mainwin", handler); // register drag and drop of files MainWindow.DragDataReceived += OnDragDataReceived; Gtk.Drag.DestSet(MainWindow, DestDefaults.Motion | DestDefaults.Drop, dropTargets, Gdk.DragAction.Copy | Gdk.DragAction.Move); DataViewBox.ShowAll(); Preferences.Proxy.Enable = true; // fire the preferences changed event // so things are setup according to the preferences Preferences.Proxy.NotifyAll(); Application.Run(); }
public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label) { string labelNoSpaces = label != null?label.Replace(' ', '-') : null; this.label = label; this.page = page; if (icon == null) { icon = ImageService.GetIcon("md-empty"); } if (box == null) { box = new HBox(); box.Accessible.SetShouldIgnore(true); box.Spacing = -2; tabIcon = new ImageView(); tabIcon.Accessible.SetShouldIgnore(true); tabIcon.Show(); box.PackStart(tabIcon, false, false, 3); labelWidget = new ExtendedLabel(label); // Ignore the label because the title tab already contains its name labelWidget.Accessible.SetShouldIgnore(true); labelWidget.UseMarkup = true; var alignLabel = new Alignment(0.0f, 0.5f, 1, 1); alignLabel.Accessible.SetShouldIgnore(true); alignLabel.BottomPadding = 0; alignLabel.RightPadding = 15; alignLabel.Add(labelWidget); box.PackStart(alignLabel, false, false, 0); btnDock = new ImageButton(); btnDock.Image = pixAutoHide; btnDock.TooltipText = GettextCatalog.GetString("Auto Hide"); btnDock.CanFocus = true; // btnDock.WidthRequest = btnDock.HeightRequest = 17; btnDock.Clicked += OnClickDock; btnDock.ButtonPressEvent += (o, args) => args.RetVal = true; btnDock.WidthRequest = btnDock.SizeRequest().Width; UpdateDockButtonAccessibilityLabels(); btnClose = new ImageButton(); btnClose.Image = pixClose; btnClose.TooltipText = GettextCatalog.GetString("Close"); btnClose.CanFocus = true; // btnClose.WidthRequest = btnClose.HeightRequest = 17; btnClose.WidthRequest = btnDock.SizeRequest().Width; btnClose.Clicked += delegate { item.Visible = false; }; btnClose.ButtonPressEvent += (o, args) => args.RetVal = true; al = new Alignment(0, 0.5f, 1, 1); al.Accessible.SetShouldIgnore(true); HBox btnBox = new HBox(false, 0); btnBox.Accessible.SetShouldIgnore(true); btnBox.PackStart(btnDock, false, false, 3); btnBox.PackStart(btnClose, false, false, 1); al.Add(btnBox); box.PackEnd(al, false, false, 3); Add(box); } tabIcon.Image = icon; string realLabel, realHelp; if (!string.IsNullOrEmpty(label)) { labelWidget.Parent.Show(); labelWidget.Name = label; btnDock.Name = string.Format("btnDock_{0}", labelNoSpaces ?? string.Empty); btnClose.Name = string.Format("btnClose_{0}", labelNoSpaces ?? string.Empty); realLabel = GettextCatalog.GetString("Close {0}", label); realHelp = GettextCatalog.GetString("Close the {0} pad", label); } else { labelWidget.Parent.Hide(); realLabel = GettextCatalog.GetString("Close pad"); realHelp = GettextCatalog.GetString("Close the pad"); } btnClose.Accessible.SetLabel(realLabel); btnClose.Accessible.Description = realHelp; if (label != null) { Accessible.Name = $"DockTab.{labelNoSpaces}"; Accessible.Description = GettextCatalog.GetString("Switch to the {0} tab", label); Accessible.SetTitle(label); Accessible.SetLabel(label); } // Get the required size before setting the ellipsize property, since ellipsized labels // have a width request of 0 box.ShowAll(); Show(); minWidth = tabIcon.SizeRequest().Width + al.SizeRequest().Width + 10; UpdateBehavior(); UpdateVisualStyle(); }