public static Gtk.Window Show (Gtk.Window parent) { Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.AddinManagerDialog.ui", null); AddinManagerDialog dlg = new AddinManagerDialog (builder, builder.GetObject ("AddinManagerDialog").Handle); InitDialog (dlg); parent.Add (dlg); dlg.Show (); return dlg; }
public static Gtk.Window Show(Gtk.Window parent) { Gtk.Builder builder = new Gtk.Builder(null, "Mono.Addins.GuiGtk3.interfaces.AddinManagerDialog.ui", null); AddinManagerDialog dlg = new AddinManagerDialog(builder, builder.GetObject("AddinManagerDialog").Handle); InitDialog(dlg); parent.Add(dlg); dlg.Show(); return(dlg); }
void Build() { global::Stetic.BinContainer.Attach(this); var builder = new Gtk.Builder(null, "ServerListWidget.ui", null); builder.Autoconnect(this); var box = (Gtk.Widget)builder.GetObject("ServerListBox"); Add(box); }
private SplashScreen(Gtk.Builder builder) : base(builder.GetObject("SplashScreen").Handle) { builder.Autoconnect(this); DeleteEvent += Window_DeleteEvent; _alienEngineSplash.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.AlienEngineSplash"); ShowAll(); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() : base("Webcam with Audio Sample") { // create the window widgets from the MainWindow.xml resource using the builder using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Microsoft.Psi.Samples.LinuxWebcamWithAudioSample.MainWindow.xml"); using StreamReader reader = new StreamReader(stream); var builder = new Gtk.Builder(); builder.AddFromString(reader.ReadToEnd()); this.Add((Gtk.Widget)builder.GetObject("root")); // get the widgets which we will modify this.displayImage = (Gtk.Image)builder.GetObject("image"); this.displayText = (Gtk.Label)builder.GetObject("value"); this.displayLevel = (Gtk.LevelBar)builder.GetObject("level"); // window event handlers this.Shown += this.MainWindow_Shown; this.DeleteEvent += this.MainWindow_DeleteEvent; }
public static void Run (Gtk.Window parent) { Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.AddinManagerDialog.ui", null); AddinManagerDialog dlg = new AddinManagerDialog (builder, builder.GetObject ("AddinManagerDialog").Handle); try { InitDialog (dlg); dlg.Run (); } finally { dlg.Destroy (); } }
public static void Run(Gtk.Window parent) { Gtk.Builder builder = new Gtk.Builder(null, "Mono.Addins.GuiGtk3.interfaces.AddinManagerDialog.ui", null); AddinManagerDialog dlg = new AddinManagerDialog(builder, builder.GetObject("AddinManagerDialog").Handle); try { InitDialog(dlg); dlg.Run(); } finally { dlg.Destroy(); } }
protected void OnPreferencesActionActivated(object sender, EventArgs e) { Trace.Call(sender, e); try { var builder = new Gtk.Builder(null, "PreferencesDialog2.ui", null); var widget = (Gtk.Widget)builder.GetObject("PreferencesDialog"); var dialog = new PreferencesDialog(Parent, builder, widget.Handle); dialog.Show(); } catch (Exception ex) { Frontend.ShowException(Parent, ex); } }
public void InstallAddins (AddinRegistry reg, string message, string[] addinIds) { Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.AddinInstallerDialog.ui", null); AddinInstallerDialog dlg = new AddinInstallerDialog (reg, message, addinIds, builder, builder.GetObject ("window1").Handle); try { if (dlg.Run () == (int) Gtk.ResponseType.Cancel) throw new InstallException (Catalog.GetString ("Installation cancelled")); else if (dlg.ErrMessage != null) throw new InstallException (dlg.ErrMessage); } finally { dlg.Destroy (); } }
protected static T Create <T>() { var type = typeof(T); var resourceName = "Booru.Resources.GUI." + type.Name + ".glade"; var widgetName = type.Name; var ctor = type.GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, Type.DefaultBinder, new Type[] { typeof(Gtk.Builder), typeof(IntPtr) }, null ); var builder = new Gtk.Builder(resourceName); var handle = builder.GetObject(widgetName).Handle; var widget = (T)ctor.Invoke(new object[] { builder, handle }); return(widget); }
private void OnStatusIconPopupMenu(object sender, EventArgs e) { Trace.Call(sender, e); Gtk.Menu menu = new Gtk.Menu(); Gtk.ImageMenuItem preferencesItem = new Gtk.ImageMenuItem( Gtk.Stock.Preferences, null ); preferencesItem.Activated += delegate { try { var builder = new Gtk.Builder(null, "PreferencesDialog2.ui", null); var widget = (Gtk.Widget)builder.GetObject("PreferencesDialog"); var dialog = new PreferencesDialog(f_MainWindow, builder, widget.Handle); dialog.Show(); } catch (Exception ex) { Frontend.ShowException(ex); } }; menu.Add(preferencesItem); menu.Add(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem quitItem = new Gtk.ImageMenuItem( Gtk.Stock.Quit, null ); quitItem.Activated += delegate { try { Frontend.Quit(); } catch (Exception ex) { Frontend.ShowException(ex); } }; menu.Add(quitItem); menu.ShowAll(); menu.Popup(); }
public static void Load() { Style.Add <FormHandler>("MainWindow", h => { if (!Global.UseHeaderBar) { return; } h.Menu = null; h.ToolBar = null; var builder = new Gtk.Builder(null, "MainWindow.glade", null); var headerBar = new Gtk.Widget(builder.GetObject("headerbar").Handle); var separator = new Gtk.Widget(builder.GetObject("separator1").Handle); popovermenu1 = new Gtk.Widget(builder.GetObject("popovermenu1").Handle); popovermenu2 = new Gtk.Widget(builder.GetObject("popovermenu2").Handle); Gtk3Wrapper.gtk_window_set_titlebar(h.Control.Handle, headerBar.Handle); Gtk3Wrapper.gtk_header_bar_set_show_close_button(headerBar.Handle, true); Connect(builder.GetObject("new_button").Handle, MainWindow.Instance.cmdNew); Connect(builder.GetObject("save_button").Handle, MainWindow.Instance.cmdSave); Connect(builder.GetObject("build_button").Handle, MainWindow.Instance.cmdBuild, false); Connect(builder.GetObject("rebuild_button").Handle, MainWindow.Instance.cmdRebuild, false); Connect(builder.GetObject("cancel_button").Handle, MainWindow.Instance.cmdCancelBuild, false); Connect(builder.GetObject("open_other_button").Handle, MainWindow.Instance.cmdOpen); Connect(builder.GetObject("import_button").Handle, MainWindow.Instance.cmdImport); Connect(builder.GetObject("saveas_button").Handle, MainWindow.Instance.cmdSaveAs); Connect(builder.GetObject("undo_button").Handle, MainWindow.Instance.cmdUndo); Connect(builder.GetObject("redo_button").Handle, MainWindow.Instance.cmdRedo); Connect(builder.GetObject("close_button").Handle, MainWindow.Instance.cmdClose); Connect(builder.GetObject("clean_button").Handle, MainWindow.Instance.cmdClean); Connect(builder.GetObject("help_button").Handle, MainWindow.Instance.cmdHelp); Connect(builder.GetObject("about_button").Handle, MainWindow.Instance.cmdAbout); Connect(builder.GetObject("exit_button").Handle, MainWindow.Instance.cmdExit); Connect(builder.GetObject("debugmode_button").Handle, MainWindow.Instance.cmdDebugMode); MainWindow.Instance.cmdBuild.EnabledChanged += (sender, e) => separator.Visible = MainWindow.Instance.cmdBuild.Enabled || MainWindow.Instance.cmdCancelBuild.Enabled; MainWindow.Instance.cmdCancelBuild.EnabledChanged += (sender, e) => separator.Visible = MainWindow.Instance.cmdBuild.Enabled || MainWindow.Instance.cmdCancelBuild.Enabled; MainWindow.Instance.TitleChanged += delegate { var title = MainWindow.TitleBase; var subtitle = ""; if (PipelineController.Instance.ProjectOpen) { title = (PipelineController.Instance.ProjectDirty) ? "*" : ""; title += Path.GetFileName(PipelineController.Instance.ProjectItem.OriginalPath); subtitle = Path.GetDirectoryName(PipelineController.Instance.ProjectItem.OriginalPath); } h.Control.Title = title; Gtk3Wrapper.gtk_header_bar_set_subtitle(headerBar.Handle, subtitle); }; var treeview1 = new Gtk.TreeView(builder.GetObject("treeview1").Handle); var store = new Gtk.TreeStore(typeof(string), typeof(string)); var column = new Gtk.TreeViewColumn(); var textCell = new Gtk.CellRendererText(); var dataCell = new Gtk.CellRendererText(); dataCell.Visible = false; column.PackStart(textCell, false); column.PackStart(dataCell, false); treeview1.AppendColumn(column); column.AddAttribute(textCell, "markup", 0); column.AddAttribute(dataCell, "text", 1); treeview1.Model = store; MainWindow.Instance.RecentChanged += (sender, e) => { store.Clear(); var recentList = sender as List <string>; foreach (var project in recentList) { store.InsertWithValues(0, "<b>" + Path.GetFileName(project) + "</b>\n" + Path.GetDirectoryName(project), project); } }; treeview1.RowActivated += (o, args) => { popovermenu2.Hide(); Gtk.TreeIter iter; if (!store.GetIter(out iter, args.Path)) { return; } var project = store.GetValue(iter, 1).ToString(); PipelineController.Instance.OpenProject(project); }; h.Control.ShowAll(); }); Style.Add <DialogHandler>("HeaderBar", h => { var title = h.Title; var headerBar = Gtk3Wrapper.gtk_header_bar_new(); Gtk3Wrapper.gtk_window_set_titlebar(h.Control.Handle, headerBar); h.Title = title; if (h.AbortButton.Text == "Close") { Gtk3Wrapper.gtk_header_bar_set_show_close_button(headerBar, true); return; } var defButton = (Gtk.Button)h.DefaultButton.ControlObject; defButton.StyleContext.AddClass("suggested-action"); Gtk3Wrapper.gtk_header_bar_pack_end(headerBar, defButton.Handle); Gtk3Wrapper.gtk_header_bar_pack_start(headerBar, ((Gtk.Button)h.AbortButton.ControlObject).Handle); }); Style.Add <LabelHandler>("Wrap", h => h.Control.MaxWidthChars = 55); Style.Add <ToolBarHandler>("ToolBar", h => { h.Control.ToolbarStyle = Gtk.ToolbarStyle.Icons; h.Control.IconSize = Gtk.IconSize.SmallToolbar; }); Style.Add <TreeViewHandler>("Scroll", h => { var treeView = h.Control.Child as Gtk.TreeView; Gtk.TreeIter lastIter, iter; if (treeView.Model.GetIterFirst(out iter)) { do { lastIter = iter; }while (treeView.Model.IterNext(ref iter)); var path = treeView.Model.GetPath(lastIter); treeView.ScrollToCell(path, null, false, 0, 0); } }); Style.Add <DrawableHandler>("Stretch", h => { var parent = h.Control.Parent.Parent.Parent.Parent.Parent.Parent; parent.SizeAllocated += delegate { var al = h.Control.Allocation; al.Width = parent.AllocatedWidth - 2; h.Control.SetAllocation(al); }; }); Style.Add <PixelLayoutHandler>("Stretch", h => { var parent = h.Control.Parent.Parent.Parent.Parent.Parent; parent.SizeAllocated += delegate { var al = h.Control.Allocation; al.Width = parent.AllocatedWidth; h.Control.SetAllocation(al); }; }); Style.Add <TextBoxHandler>("OverrideSize", h => { h.Control.WidthChars = 0; }); Style.Add <ScrollableHandler>("BuildOutput", h => { var child = ((((h.Control.Child as Gtk.Viewport).Child as Gtk.VBox).Children[0] as Gtk.HBox).Children[0] as Gtk.Alignment).Child; var ok = false; h.Control.SizeAllocated += delegate { // Set Width of the Drawable var al = child.Allocation; al.Width = h.Control.AllocatedWidth - 2; if (BuildOutput.ReqWidth > al.Width) { al.Width = BuildOutput.ReqWidth; } child.SetAllocation(al); if (PipelineSettings.Default.AutoScrollBuildOutput) { // Scroll to bottom if (BuildOutput.Count == -1) { ok = false; } if (!ok) { var adj = h.Control.Vadjustment; adj.Value = adj.Upper - adj.PageSize; if (adj.Upper >= BuildOutput.Count && BuildOutput.Count != -1) { ok = true; } } } }; }); }
private DummyGLWindow(Gtk.Builder builder) : base(builder.GetObject("DummyGLWindow").Handle) { Realized += OnRealized; ShowAll(); }
public static void Load() { Style.Add <ApplicationHandler>("PipelineTool", h => { Global.Application = h.Control; if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16) { Global.UseHeaderBar = Global.Application.PrefersAppMenu(); } if (Global.UseHeaderBar) { Global.Application.AppMenu = new GLib.MenuModel((new Gtk.Builder("AppMenu.glade")).GetObject("appmenu").Handle); } }); Style.Add <FormHandler>("MainWindow", h => { if (!Global.UseHeaderBar) { return; } var builder = new Gtk.Builder("MainWindow.glade"); var headerBar = new Gtk.HeaderBar(builder.GetObject("headerbar").Handle); h.Menu = null; h.ToolBar = null; Connect("new", MainWindow.Instance.cmdNew); Connect("open", MainWindow.Instance.cmdOpen); Connect("save", MainWindow.Instance.cmdSave); Connect("saveas", MainWindow.Instance.cmdSaveAs); Connect("import", MainWindow.Instance.cmdImport); Connect("close", MainWindow.Instance.cmdClose); Connect("help", MainWindow.Instance.cmdHelp); Connect("about", MainWindow.Instance.cmdAbout); Connect("quit", MainWindow.Instance.cmdExit); Connect("undo", MainWindow.Instance.cmdUndo); Connect("redo", MainWindow.Instance.cmdRedo); Connect("build", MainWindow.Instance.cmdBuild); Connect("rebuild", MainWindow.Instance.cmdRebuild); Connect("clean", MainWindow.Instance.cmdClean); Connect("cancel", MainWindow.Instance.cmdCancelBuild); var widget = new Gtk.ModelButton(builder.GetObject("button_debug").Handle); widget.Active = MainWindow.Instance.cmdDebugMode.Checked; widget.Clicked += (e, sender) => { var newstate = !PipelineSettings.Default.DebugMode; widget.Active = newstate; PipelineSettings.Default.DebugMode = newstate; }; _accelGroup = new Gtk.AccelGroup(); Connect(MainWindow.Instance.cmdNew, Gdk.Key.N, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdOpen, Gdk.Key.O, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdSave, Gdk.Key.S, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdExit, Gdk.Key.Q, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdUndo, Gdk.Key.Z, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdRedo, Gdk.Key.Y, Gdk.ModifierType.ControlMask); Connect(MainWindow.Instance.cmdBuild, Gdk.Key.F6); Connect(MainWindow.Instance.cmdHelp, Gdk.Key.F1); h.Control.AddAccelGroup(_accelGroup); _popovermenu1 = new Gtk.Widget(builder.GetObject("popovermenu1").Handle); _popovermenu2 = new Gtk.Widget(builder.GetObject("popovermenu2").Handle); h.Control.Titlebar = headerBar; headerBar.ShowCloseButton = true; _buttonbox = new Gtk.Widget(builder.GetObject("build_buttonbox").Handle); _cancelbox = new Gtk.Widget(builder.GetObject("cancel_button").Handle); _separator = new Gtk.Widget(builder.GetObject("separator1").Handle); MainWindow.Instance.cmdBuild.EnabledChanged += (sender, e) => ReloadBuildbox(); MainWindow.Instance.cmdCancelBuild.EnabledChanged += (sender, e) => ReloadBuildbox(); MainWindow.Instance.TitleChanged += delegate { var title = MainWindow.TitleBase; var subtitle = ""; if (PipelineController.Instance.ProjectOpen) { title = (PipelineController.Instance.ProjectDirty) ? "*" : ""; title += Path.GetFileName(PipelineController.Instance.ProjectItem.OriginalPath); subtitle = Path.GetDirectoryName(PipelineController.Instance.ProjectItem.OriginalPath); } h.Control.Title = title; headerBar.Subtitle = subtitle; }; var treeview1 = new Gtk.TreeView(builder.GetObject("treeview1").Handle); var store = new Gtk.TreeStore(typeof(string), typeof(string)); var column = new Gtk.TreeViewColumn(); var textCell = new Gtk.CellRendererText(); var dataCell = new Gtk.CellRendererText(); dataCell.Visible = false; column.PackStart(textCell, false); column.PackStart(dataCell, false); treeview1.AppendColumn(column); column.AddAttribute(textCell, "markup", 0); column.AddAttribute(dataCell, "text", 1); treeview1.Model = store; MainWindow.Instance.RecentChanged += (sender, e) => { store.Clear(); var recentList = sender as List <string>; foreach (var project in recentList) { store.InsertWithValues(0, "<b>" + Path.GetFileName(project) + "</b>\n" + Path.GetDirectoryName(project), project); } }; treeview1.RowActivated += (o, args) => { _popovermenu2.Hide(); Gtk.TreeIter iter; if (!store.GetIter(out iter, args.Path)) { return; } var project = store.GetValue(iter, 1).ToString(); PipelineController.Instance.OpenProject(project); }; headerBar.Show(); }); Style.Add <ButtonHandler>("Destuctive", h => h.Control.StyleContext.AddClass("destructive-action")); Style.Add <LabelHandler>("Wrap", h => h.Control.MaxWidthChars = 55); Style.Add <ToolBarHandler>("ToolBar", h => { h.Control.ToolbarStyle = Gtk.ToolbarStyle.Icons; h.Control.IconSize = Gtk.IconSize.SmallToolbar; }); Style.Add <DrawableHandler>("Stretch", h => { var parent = h.Control.Parent.Parent.Parent.Parent.Parent.Parent; parent.SizeAllocated += delegate { var al = h.Control.Allocation; al.Width = parent.AllocatedWidth - 2; h.Control.SetAllocation(al); }; }); Style.Add <PixelLayoutHandler>("Stretch", h => { var parent = h.Control.Parent.Parent.Parent.Parent.Parent; parent.SizeAllocated += delegate { var al = h.Control.Allocation; al.Width = parent.AllocatedWidth; h.Control.SetAllocation(al); }; }); }
public static MainWindow Create() { var builder = new Gtk.Builder(null, "Booru.Resources.GUI.MainWindow.glade", null); return(new MainWindow(builder, builder.GetObject("MainWindow").Handle)); }
public static OutputWidget Create() { Gtk.Builder builder = new Gtk.Builder(null, "Output", null); return(new OutputWidget(builder, builder.GetObject("OutputWindow").Handle)); }
public void InstallAddins(AddinRegistry reg, string message, string[] addinIds) { Gtk.Builder builder = new Gtk.Builder(null, "Mono.Addins.GuiGtk3.interfaces.AddinInstallerDialog.ui", null); AddinInstallerDialog dlg = new AddinInstallerDialog(reg, message, addinIds, builder, builder.GetObject("window1").Handle); try { if (dlg.Run() == (int)Gtk.ResponseType.Cancel) { throw new InstallException(Catalog.GetString("Installation cancelled")); } else if (dlg.ErrMessage != null) { throw new InstallException(dlg.ErrMessage); } } finally { dlg.Destroy(); } }