PlayerControlWidget(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { this.PlayButton.Show(); this.PauseButton.Hide(); this.PlayButton.Clicked += (s, e) => { this.Pause(); }; this.PauseButton.Clicked += (s, e) => { this.Pause(); }; this.PositionScale.RestrictToFillLevel = false; this.PositionScale.ValueChanged += (sender, e) => { if (!this.isInUpdate) { this.PlayerPocess.StandardInput.WriteLine("seek " + this.PositionScale.Value + " 2"); } }; this.VolumeButton.ValueChanged += (sender, e) => { if (!this.isInUpdate) { this.volume = (float)this.VolumeButton.Value; this.PlayerPocess.StandardInput.WriteLine("volume " + this.volume * 100 + " 1"); } }; BooruApp.BooruApplication.EventCenter.WillQuit += OnWillQuit; this.updateThread = new Thread(new ThreadStart(UpdateThreadProc)); this.updateThread.Start(); this.updateTimeout = GLib.Timeout.Add(200, UpdateControls); }
ImageVoteWidget(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { this.ImageWidget = new ImageViewWidget(); this.ImageViewBox.PackStart(this.ImageWidget, true, true, 0); this.ImageWidget.Controls = PlayerControlWidget.Create(); this.ImageViewBox.PackEnd(this.ImageWidget.Controls, false, true, 0); // enable mouse scrolling this.ImageWidget.Events |= Gdk.EventMask.ScrollMask; this.ImageWidget.ScrollEvent += (o, args) => { this.ImageWidget.AdvanceSubImage(args.Event.Direction == Gdk.ScrollDirection.Down); }; // enable context menu this.ImageWidget.Events |= Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ButtonPressMask; this.ImageWidget.ButtonReleaseEvent += (o, args) => { if (args.Event.Button == 3) { this.ImagePopupMenu.Popup(); } }; this.Overlay = new TagsOverlay(this.ImageWidget); this.Overlay.IsActive = false; }
protected MainWindow(Gtk.Builder builder, IntPtr handle) : base(handle) { builder.Autoconnect(this); this.Icon = new Gdk.Pixbuf(null, "Booru.Resources.Pixbufs.icon.png"); DeleteEvent += OnDeleteEvent; this.MainNotebook.AppendPage(MainTab.Create(), BigTabLabel.Create("Start")); this.MainNotebook.AppendPage(ImagesTab.Create(), BigTabLabel.Create("Images")); this.MainNotebook.AppendPage(VoteTab.Create(), BigTabLabel.Create("Vote")); this.MainNotebook.AppendPage(TagListTab.Create(), BigTabLabel.Create("Tags")); this.MainNotebook.AppendPage(ImportTab.Create(), BigTabLabel.Create("Import")); this.MainNotebook.AppendPage(ConfigTab.Create(), BigTabLabel.Create("Settings")); // when a search is to be executed, select images tab BooruApp.BooruApplication.EventCenter.ImageSearchRequested += (arg) => { this.MainNotebook.CurrentPage = 1; }; this.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.F5) { this.ToggleFullscreen(); } }; BooruApp.BooruApplication.EventCenter.Fullscreen(this.IsFullscreen); }
void InvokeNative(Gtk.Builder builder, GLib.Object objekt, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags flags) { IntPtr native_signal_name = GLib.Marshaller.StringToPtrGStrdup(signal_name); IntPtr native_handler_name = GLib.Marshaller.StringToPtrGStrdup(handler_name); native_cb(builder == null ? IntPtr.Zero : builder.Handle, objekt == null ? IntPtr.Zero : objekt.Handle, native_signal_name, native_handler_name, connect_object == null ? IntPtr.Zero : connect_object.Handle, (int)flags, __data); GLib.Marshaller.Free(native_signal_name); GLib.Marshaller.Free(native_handler_name); }
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(); }
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; }
private OutputWidget(Gtk.Builder builder, IntPtr handle) : base(handle) { this._builder = builder; builder.Autoconnect(this); _output.Buffer = new Gtk.TextBuffer(new Gtk.TextTagTable()); _output.SizeAllocated += (o, args) => { this.Vadjustment.Value = this.Vadjustment.Upper - this.Vadjustment.PageSize; }; }
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 (); } }
ImagesTab(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { this.Sensitive = false; BooruApp.BooruApplication.EventCenter.DatabaseLoadStarted += this.OnDatabaseLoadStarted; BooruApp.BooruApplication.EventCenter.DatabaseLoadSucceeded += this.OnDatabaseLoadSucceeded; var completion = new Gtk.EntryCompletion(); completion.Model = BooruApp.BooruApplication.Database.TagEntryCompletionStore; completion.TextColumn = 0; completion.MinimumKeyLength = 3; this.TagEntry.Completion = completion; BooruApp.BooruApplication.EventCenter.ImageSearchRequested += this.ExecuteSearch; BooruApp.BooruApplication.EventCenter.FullscreenToggled += this.ToggleFullscreen; }
public PreferencesDialog(Gtk.Window parent, Gtk.Builder builder, IntPtr handle) : base(handle) { Trace.Call(parent, builder, handle); if (parent == null) { throw new ArgumentNullException("parent"); } if (builder == null) { throw new ArgumentNullException("builder"); } if (handle == IntPtr.Zero) { throw new ArgumentException("handle", "handle must not be zero."); } Parent = parent; TransientFor = parent; Builder = builder; Builder.Autoconnect(this); f_CategoryNotebook.ShowTabs = false; f_ConnectionToggleButton.Active = true; // not implemented f_InternalSettingsToolbar.NoShowAll = true; f_InternalSettingsToolbar.Visible = false; // Filters FilterListWidget = new FilterListWidget(parent, Frontend.UserConfig); // REMOTING CALL FilterListWidget.InitProtocols(Frontend.Session.GetSupportedProtocols()); FilterListWidget.Load(); f_FilterListBox.Add(FilterListWidget); // Servers ServerListView = new ServerListView(parent); ServerListView.Load(); f_ServerListBox.Add(ServerListView); Init(); ReadFromConfig(); ShowAll(); }
ConfigTab(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { int n = 100; foreach (var plugin in BooruApp.BooruApplication.PluginLoader.LoadedPlugins) { Gtk.Label label = new Gtk.Label("<b>" + plugin.Name + "</b>"); label.SetAlignment(0.0f, 0.5f); label.UseMarkup = true; label.MarginTop = 32; ConfigGrid.Attach(label, 0, n, 5, 1); n++; Gtk.HSeparator sep = new Gtk.HSeparator(); sep.MarginBottom = 16; ConfigGrid.Attach(sep, 0, n, 5, 1); n++; label = new Gtk.Label(plugin.ConfigDesc); label.SetAlignment(0.0f, 0.5f); label.UseMarkup = true; ConfigGrid.Attach(label, 0, n, 5, 1); n++; foreach (var configDef in plugin.ConfigEntryDefinitions) { Gtk.Label configLabel = new Gtk.Label(configDef.Label); configLabel.Name = configDef.Name; configLabel.TooltipMarkup = configDef.Tooltip; configLabel.SetAlignment(0.0f, 0.5f); ConfigGrid.Attach(configLabel, 0, n, 1, 1); n++; } } this.ConnectAllChildren(this); this.ShowAll(); this.Sensitive = false; BooruApp.BooruApplication.EventCenter.DatabaseLoadStarted += OnDatabaseUnloaded; BooruApp.BooruApplication.EventCenter.DatabaseLoadFailed += OnDatabaseUnloaded; BooruApp.BooruApplication.EventCenter.DatabaseLoadSucceeded += OnDatabaseLoaded; }
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(); } }
/// <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; }
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(); }
protected LoadableWidget(Gtk.Builder builder, IntPtr handle) : base(handle) { builder.Autoconnect(this); }
ImagesResultWidget(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { builder.Autoconnect(this); BooruApp.BooruApplication.EventCenter.WillQuit += Abort; BooruApp.BooruApplication.EventCenter.FullscreenToggled += this.ToggleFullscreen; this.PlayImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_PLAY)); this.StopImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_STOP)); this.TagImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_TAG)); this.ShuffleImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_SHUFFLE)); this.MarkImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_MARK)); this.UnmarkImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_UNMARK)); this.DeleteImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_DELETE)); this.ViewExternalImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_VIEW_EXTERNAL)); this.ExportImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_EXPORT)); this.AbortImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_ABORT)); this.ButtonSlideshow.Image = this.PlayImage; this.ShowTagsButton.Image = this.TagImage; this.ShuffleButton.Image = this.ShuffleImage; this.MarkButton.Image = this.MarkImage; this.DeleteButton.Image = this.DeleteImage; this.OpenExternalButton.Image = this.ViewExternalImage; this.ExportButton.Image = this.ExportImage; this.StopButton.Image = this.AbortImage; this.Removed += (o, args) => { this.Abort(); }; // TODO: add custom tag input widget /* * var tagbox = new TagBoxWidget (); * ImageViewBox.PackEnd (tagbox, false, false, 0); * tagbox.Show (); */ // add image view this.imageView = new ImageViewWidget(); this.ImageViewBox.PackStart(this.imageView, true, true, 0); this.imageView.Controls = PlayerControlWidget.Create(); this.ImageViewBox.PackEnd(this.imageView.Controls, false, true, 0); // enable mouse scrolling this.imageView.Events |= Gdk.EventMask.ScrollMask; this.imageView.ScrollEvent += (o, args) => { if (args.Event.Direction == Gdk.ScrollDirection.Down) { this.Advance(true); } else if (args.Event.Direction == Gdk.ScrollDirection.Up) { this.Advance(false); } }; // add overlay for tag display this.tagsOverlay = new TagsOverlay(this.imageView); // setup tag entry autocompletion var completion = new Gtk.EntryCompletion(); completion.Model = BooruApp.BooruApplication.Database.TagEntryCompletionStore; completion.TextColumn = 0; completion.MinimumKeyLength = 3; this.TagsEntry.Completion = completion; // set up thumb list view this.store = new ThumbStore(); this.ImageThumbView.PixbufColumn = ThumbStore.THUMB_STORE_COLUMN_THUMBNAIL; this.ImageThumbView.TooltipColumn = ThumbStore.THUMB_STORE_COLUMN_TOOLTIP; this.ImageThumbView.TextColumn = ThumbStore.THUMB_STORE_COLUMN_INDEX; this.ImageThumbView.ItemWidth = 64; this.ImageThumbView.Model = this.store; this.ImageThumbView.Model.RowInserted += on_ImageThumbView_Model_RowInserted; this.ImageThumbView.Model.RowChanged += on_ImageThumbView_Model_RowChanged; this.ImageThumbView.Events |= Gdk.EventMask.KeyPressMask; this.ImageThumbView.KeyPressEvent += on_ImageThumbView_KeyPress; this.StopButton.Sensitive = true; this.Spinner.Active = true; this.ExportButton.Sensitive = false; this.MarkButton.Sensitive = false; this.DeleteButton.Sensitive = false; //var box = (Gtk.Box)this.StopButton.Parent.Parent; //this.tagsBox = new TagsEntryWidget (); //box.PackEnd (this.tagsBox, false, true, 0); //this.tagsBox.Show (); this.idle = GLib.Timeout.Add(100, () => { if (this.imageView.Image != this.ActiveImage) { // get newly selected image this.imageView.Image = this.ActiveImage; // this.tagsBox.SetTags (image.Tags); // clear tags entry to not confuse user this.TagsEntry.Text = ""; this.UpdateButtons(); } return(true); }); }
ClosableTabLabel(Gtk.Builder builder, IntPtr handle) : base(builder, handle) { }
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 OutputWidget Create() { Gtk.Builder builder = new Gtk.Builder(null, "Output", null); return(new OutputWidget(builder, builder.GetObject("OutputWindow").Handle)); }
public static MainWindow Create() { var builder = new Gtk.Builder(null, "Booru.Resources.GUI.MainWindow.glade", null); return(new MainWindow(builder, builder.GetObject("MainWindow").Handle)); }