private static void PlatformInit() { Linux = true; _theme = IconTheme.Default; var iconMissing = _theme.LoadIcon("dialog-error", 16, 0); var file = _theme.LoadIcon("text-x-generic", 16, 0); var fileMissing = file.Copy(); iconMissing.Composite(fileMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); var folder = _theme.LoadIcon("folder", 16, 0); var folderMissing = folder.Copy(); iconMissing.Composite(folderMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); _files["."] = ToEtoImage(file); _fileMissing = ToEtoImage(fileMissing); _folder = ToEtoImage(folder); _folderMissing = ToEtoImage(folderMissing); _xwtFiles["."] = ToXwtImage(file); _xwtFileMissing = ToXwtImage(fileMissing); _xwtFolder = ToXwtImage(folder); _xwtFolderMissing = ToXwtImage(folderMissing); if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16) { _app = new Application(null, GLib.ApplicationFlags.None); _app.Register(GLib.Cancellable.Current); UseHeaderBar = Gtk3Wrapper.gtk_application_prefers_app_menu(_app.Handle); } }
private static Gdk.Pixbuf PlatformGetFileIcon(string path) { Gdk.Pixbuf icon = null; var info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(path), "standard::*", 0, new IntPtr(), new IntPtr())); var sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { icon = _theme.LoadIcon(sicon[i], 16, 0); if (icon != null) { break; } } catch { } } if (icon == null) { throw new Exception(); } return(icon); }
public static Pixbuf GetIcon(string fileName) { #if GTK3 GLib.FileInfo info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(fileName), "standard::*", 0, new IntPtr(), new IntPtr())); try { string[] sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { var icon = theme.LoadIcon(sicon[i], 16, (IconLookupFlags)0); if (icon != null) { return(icon); } } catch { } } } catch { } return(theme.LoadIcon("text-x-generic", 16, (IconLookupFlags)0)); #endif return(new Pixbuf(null, "MonoGame.Tools.Pipeline.Icons.blueprint.png")); }
public static IntPtr GetNewDialog(IntPtr parrent) { #if GTK3 if (UseHeaderBar) { return(Gtk3Wrapper.gtk_dialog_new_with_buttons("", parrent, 4 + (int)DialogFlags.Modal)); } #endif return((new Dialog("", new Gtk.Window(parrent), DialogFlags.Modal)).Handle); }
private static void PlatformShowOpenWithDialog(string filePath) { var adialoghandle = Gtk3Wrapper.gtk_app_chooser_dialog_new(((Gtk.Window)MainWindow.Instance.ControlObject).Handle, 4 + (int)DialogFlags.Modal, Gtk3Wrapper.g_file_new_for_path(filePath)); var adialog = new AppChooserDialog(adialoghandle); if (adialog.Run() == (int)ResponseType.Ok) { Process.Start(adialog.AppInfo.Executable, "\"" + filePath + "\""); } adialog.Destroy(); }
public static void Connect(string action, Command cmd) { var a = new SimpleAction(action); a.Activate += (o, args) => { _popovermenu1.Hide(); _popovermenu2.Hide(); cmd.Execute(); }; cmd.EnabledChanged += (sender, e) => a.Enabled = cmd.Enabled; Gtk3Wrapper.g_action_map_add_action(Global.ApplicationHandle, a.Handle); }
private static void Connect(Command cmd, Gdk.Key key, Gdk.ModifierType modifier = Gdk.ModifierType.None) { var cclosure = Gtk3Wrapper.g_cclosure_new(Marshal.GetFunctionPointerForDelegate( (Action <IntPtr, IntPtr, IntPtr, IntPtr, IntPtr>)((IntPtr a, IntPtr b, IntPtr c, IntPtr d, IntPtr data) => { var command = ((GCHandle)data).Target as Command; if (command.Enabled) { command.Execute(); } })), (IntPtr)GCHandle.Alloc(cmd), IntPtr.Zero); Gtk3Wrapper.gtk_accel_group_connect(_actionGroup, key, modifier, Gtk.AccelFlags.Mask, cclosure); }
public static void Initalize() { #if LINUX GtkMajorVersion = Gtk3Wrapper.gtk_get_major_version(); GtkMinorVersion = Gtk3Wrapper.gtk_get_minor_version(); Process proc = new Process(); proc.StartInfo.FileName = "/bin/bash"; proc.StartInfo.Arguments = "-c \"echo $XDG_CURRENT_DESKTOP\""; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); while (!proc.StandardOutput.EndOfStream) { string line = proc.StandardOutput.ReadLine(); DesktopEnvironment = line; } #endif UseHeaderBar = Global.GtkMajorVersion >= 3 && Global.GtkMinorVersion >= 12 && Global.DesktopEnvironment == "GNOME"; }
private static void PlatformInit() { Linux = true; _theme = IconTheme.Default; try { _iconMissing = _theme.LoadIcon("dialog-error", 16, 0); } catch { _iconMissing = new Gdk.Pixbuf(null, "TreeView.Missing.png"); } if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16) { _app = new Gtk.Application(null, GLib.ApplicationFlags.None); _app.Register(GLib.Cancellable.Current); UseHeaderBar = Gtk3Wrapper.gtk_application_prefers_app_menu(_app.Handle); } }
private static Eto.Drawing.Image PlatformGetFileIcon(string path, bool exists) { Gdk.Pixbuf icon = null; try { var info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(path), "standard::*", 0, new IntPtr(), new IntPtr())); var sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { icon = _theme.LoadIcon(sicon[i], 16, 0); if (icon != null) { break; } } catch { } } } catch { } if (icon == null) { icon = _theme.LoadIcon("text-x-generic", 16, 0); } if (!exists) { icon = icon.Copy(); _iconMissing.Composite(icon, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); } return(new Bitmap(new BitmapHandler(icon))); }
static void Main(string[] args) { Styles.Load(); var app = new Application(Platform.Detect); #if WINDOWS Xwt.Application.InitializeAsGuest(Xwt.ToolkitType.Wpf); #elif LINUX Xwt.Application.InitializeAsGuest(Xwt.ToolkitType.Gtk3); #endif app.Style = "PipelineTool"; var win = new MainWindow(); var controller = PipelineController.Create(win); #if LINUX Gtk3Wrapper.gtk_application_add_window(Global.ApplicationHandle, win.NativeHandle); #endif string project = null; if (Global.Unix && !Global.Linux) { project = Environment.GetEnvironmentVariable("MONOGAME_PIPELINE_PROJECT"); } else if (args != null && args.Length > 0) { project = string.Join(" ", args); } if (!string.IsNullOrEmpty(project)) { controller.OpenProject(project); } app.Run(win); }
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; } } } }; }); }
public SimpleAction(string name) : base(Gtk3Wrapper.g_simple_action_new(name, IntPtr.Zero)) { }
public static void Load() { Style.Add <ApplicationHandler>("PipelineTool", h => { Global.ApplicationHandle = h.Control.Handle; if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16) { Global.UseHeaderBar = Gtk3Wrapper.gtk_application_prefers_app_menu(h.Control.Handle); } if (Global.UseHeaderBar) { Gtk3Wrapper.gtk_application_set_app_menu(h.Control.Handle, (new Gtk.Builder("MainWindow.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.Widget(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); _actionGroup = Gtk3Wrapper.gtk_accel_group_new(); 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); Gtk3Wrapper.gtk_window_add_accel_group(h.Control.Handle, _actionGroup); _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); _mainbutton = new Gtk.RadioButton(""); RejectActive(builder.GetObject("build_button").Handle); RejectActive(builder.GetObject("rebuild_button").Handle); RejectActive(builder.GetObject("clean_button").Handle); _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; 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); }; 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 HeaderBar() : base(Gtk3Wrapper.gtk_header_bar_new()) { }
public void AttachToWindow(Window window) { Gtk3Wrapper.gtk_window_set_titlebar(window.Handle, this.Handle); }
public Popover(Widget relativeWidget) : base(Gtk3Wrapper.gtk_popover_new(relativeWidget.Handle)) { }
protected virtual void Build() { global::Stetic.Gui.Initialize(this); // Widget MonoGame.Tools.Pipeline.MainWindow this.UIManager = new global::Gtk.UIManager(); global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup("Default"); this.FileAction = new global::Gtk.Action("FileAction", global::Mono.Unix.Catalog.GetString("File"), null, null); this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString("File"); w1.Add(this.FileAction, null); this.NewAction = new global::Gtk.Action("NewAction", global::Mono.Unix.Catalog.GetString("New..."), null, "gtk-new"); this.NewAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New..."); w1.Add(this.NewAction, "<Control>n"); this.OpenAction = new global::Gtk.Action("OpenAction", global::Mono.Unix.Catalog.GetString("Open..."), null, "gtk-open"); this.OpenAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Open..."); w1.Add(this.OpenAction, "<Control>o"); this.OpenRecentAction = new global::Gtk.Action("OpenRecentAction", global::Mono.Unix.Catalog.GetString("Open Recent"), null, null); this.OpenRecentAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Open Recent"); w1.Add(this.OpenRecentAction, null); this.CloseAction = new global::Gtk.Action("CloseAction", global::Mono.Unix.Catalog.GetString("Close"), null, "gtk-close"); this.CloseAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Close"); w1.Add(this.CloseAction, null); this.ImportAction = new global::Gtk.Action("ImportAction", global::Mono.Unix.Catalog.GetString("Import..."), null, null); this.ImportAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Import..."); w1.Add(this.ImportAction, null); this.SaveAction = new global::Gtk.Action("SaveAction", global::Mono.Unix.Catalog.GetString("Save"), null, "gtk-save"); this.SaveAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Save"); w1.Add(this.SaveAction, "<Control>s"); this.SaveAsAction = new global::Gtk.Action("SaveAsAction", global::Mono.Unix.Catalog.GetString("Save As..."), null, "gtk-save-as"); this.SaveAsAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Save As..."); w1.Add(this.SaveAsAction, null); this.ExitAction = new global::Gtk.Action("ExitAction", global::Mono.Unix.Catalog.GetString("Exit"), null, "gtk-quit"); this.ExitAction.HideIfEmpty = false; this.ExitAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Exit"); w1.Add(this.ExitAction, null); this.EditAction = new global::Gtk.Action("EditAction", global::Mono.Unix.Catalog.GetString("Edit"), null, null); this.EditAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Edit"); w1.Add(this.EditAction, null); this.UndoAction = new global::Gtk.Action("UndoAction", global::Mono.Unix.Catalog.GetString("Undo"), null, "gtk-undo"); this.UndoAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Undo"); w1.Add(this.UndoAction, "<Control>z"); this.RedoAction = new global::Gtk.Action("RedoAction", global::Mono.Unix.Catalog.GetString("Redo"), null, "gtk-redo"); this.RedoAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Redo"); w1.Add(this.RedoAction, "<Control>y"); RenameAction = new Action("RenameAction", global::Mono.Unix.Catalog.GetString("Rename"), null, null); RenameAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Rename"); w1.Add(RenameAction, null); this.DeleteAction = new global::Gtk.Action("DeleteAction", global::Mono.Unix.Catalog.GetString("Delete"), null, "gtk-delete"); this.DeleteAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Delete"); w1.Add(this.DeleteAction, null); this.BuildAction = new global::Gtk.Action("BuildAction", global::Mono.Unix.Catalog.GetString("Build"), null, null); this.BuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Build"); w1.Add(this.BuildAction, null); this.BuildAction1 = new global::Gtk.Action("BuildAction1", global::Mono.Unix.Catalog.GetString("Build"), null, "gtk-execute"); this.BuildAction1.ShortLabel = global::Mono.Unix.Catalog.GetString("Build"); w1.Add(this.BuildAction1, "<Mod2>F6"); this.RebuildAction = new global::Gtk.Action("RebuildAction", global::Mono.Unix.Catalog.GetString("Rebuild"), null, "gtk-execute"); this.RebuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Rebuild"); w1.Add(this.RebuildAction, null); this.CleanAction = new global::Gtk.Action("CleanAction", global::Mono.Unix.Catalog.GetString("Clean"), null, null); this.CleanAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Clean"); w1.Add(this.CleanAction, null); this.DebugModeAction = new global::Gtk.ToggleAction("DebugModeAction", global::Mono.Unix.Catalog.GetString("Debug Mode"), null, null); this.DebugModeAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Debug Mode"); w1.Add(this.DebugModeAction, null); this.FilterOutputAction = new global::Gtk.ToggleAction("FilterOutputAction", global::Mono.Unix.Catalog.GetString("Filter Output"), null, null); this.FilterOutputAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Filter Output"); this.FilterOutputAction.Active = true; w1.Add(this.FilterOutputAction, null); this.HelpAction = new global::Gtk.Action("HelpAction", global::Mono.Unix.Catalog.GetString("Help"), null, null); this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Help"); w1.Add(this.HelpAction, null); this.ViewHelpAction = new global::Gtk.Action("ViewHelpAction", global::Mono.Unix.Catalog.GetString("View Help"), null, "gtk-help"); this.ViewHelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString("View Help"); w1.Add(this.ViewHelpAction, "<Mod2>F1"); this.AboutAction = new global::Gtk.Action("AboutAction", global::Mono.Unix.Catalog.GetString("About"), null, "gtk-about"); this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString("About"); w1.Add(this.AboutAction, null); this.CancelBuildAction = new global::Gtk.Action("CancelBuildAction", global::Mono.Unix.Catalog.GetString("Cancel Build"), null, "gtk-stop"); this.CancelBuildAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Cancel Build"); w1.Add(this.CancelBuildAction, null); this.AddAction = new global::Gtk.Action("AddAction", global::Mono.Unix.Catalog.GetString("Add"), null, null); this.AddAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add"); w1.Add(this.AddAction, null); this.NewItemAction = new global::Gtk.Action("NewItemAction", global::Mono.Unix.Catalog.GetString("New Item..."), null, "gtk-file"); this.NewItemAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New Item..."); w1.Add(this.NewItemAction, null); this.NewFolderAction = new global::Gtk.Action("NewFolderAction", global::Mono.Unix.Catalog.GetString("New Folder..."), null, "gtk-directory"); this.NewFolderAction.ShortLabel = global::Mono.Unix.Catalog.GetString("New Folder..."); w1.Add(this.NewFolderAction, null); this.ExistingItemAction = new global::Gtk.Action("ExistingItemAction", global::Mono.Unix.Catalog.GetString("Existing Item..."), null, null); this.ExistingItemAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add Existing Item..."); w1.Add(this.ExistingItemAction, null); this.ExistingFolderAction = new global::Gtk.Action("ExistingFolderAction", global::Mono.Unix.Catalog.GetString("Existing Folder..."), null, null); this.ExistingFolderAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Add Existing Folder..."); w1.Add(this.ExistingFolderAction, null); this.UIManager.InsertActionGroup(w1, 0); this.AddAccelGroup(this.UIManager.AccelGroup); this.Name = "MonoGame.Tools.Pipeline.MainWindow"; this.Icon = global::Gdk.Pixbuf.LoadFromResource("MonoGame.Tools.Pipeline.App.ico"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Container child MonoGame.Tools.Pipeline.MainWindow.Gtk.Container+ContainerChild this.vbox2 = new global::Gtk.VBox(); this.vbox2.Name = "vbox2"; // Container child vbox2.Gtk.Box+BoxChild this.UIManager.AddUiFromString("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='NewAction' action='NewAction'/><menuitem name='OpenAction' action='OpenAction'/><menuitem name='OpenRecentAction' action='OpenRecentAction'/><menuitem name='CloseAction' action='CloseAction'/><separator/><menuitem name='ImportAction' action='ImportAction'/><separator/><menuitem name='SaveAction' action='SaveAction'/><menuitem name='SaveAsAction' action='SaveAsAction'/><separator/><menuitem name='ExitAction' action='ExitAction'/></menu><menu name='EditAction' action='EditAction'><menuitem name='UndoAction' action='UndoAction'/><menuitem name='RedoAction' action='RedoAction'/><separator/><menu name='AddAction' action='AddAction'><menuitem name='NewItemAction' action='NewItemAction'/><menuitem name='NewFolderAction' action='NewFolderAction'/><separator/><menuitem name='ExistingItemAction' action='ExistingItemAction'/><menuitem name='ExistingFolderAction' action='ExistingFolderAction'/></menu><separator/><menuitem name='RenameAction' action='RenameAction'/><menuitem name='DeleteAction' action='DeleteAction'/></menu><menu name='BuildAction' action='BuildAction'><menuitem name='BuildAction1' action='BuildAction1'/><menuitem name='RebuildAction' action='RebuildAction'/><menuitem name='CleanAction' action='CleanAction'/><menuitem name='CancelBuildAction' action='CancelBuildAction'/><separator name='sep1'/><menuitem name='DebugModeAction' action='DebugModeAction'/><menuitem name='FilterOutputAction' action='FilterOutputAction'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='ViewHelpAction' action='ViewHelpAction'/><separator/><menuitem name='AboutAction' action='AboutAction'/></menu></menubar></ui>"); this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox2.Add(this.menubar1); toolBar1 = new Toolbar(); toolNew = new ToolButton(new Image(null, "Toolbar.New.png"), "New"); toolNew.TooltipText = toolNew.Label; toolBar1.Add(toolNew); toolOpen = new ToolButton(new Image(null, "Toolbar.Open.png"), "Open"); toolOpen.TooltipText = toolOpen.Label; toolBar1.Add(toolOpen); toolSave = new ToolButton(new Image(null, "Toolbar.Save.png"), "Save"); toolSave.TooltipText = toolSave.Label; toolBar1.Add(toolSave); toolBar1.Add(new SeparatorToolItem()); toolNewItem = new ToolButton(new Image(null, "Toolbar.NewItem.png"), "Add New Item"); toolNewItem.TooltipText = toolNewItem.Label; toolBar1.Add(toolNewItem); toolAddItem = new ToolButton(new Image(null, "Toolbar.ExistingItem.png"), "Add Existing Item"); toolAddItem.TooltipText = toolAddItem.Label; toolBar1.Add(toolAddItem); toolNewFolder = new ToolButton(new Image(null, "Toolbar.NewFolder.png"), "Add New Folder"); toolNewFolder.TooltipText = toolNewFolder.Label; toolBar1.Add(toolNewFolder); toolAddFolder = new ToolButton(new Image(null, "Toolbar.ExistingFolder.png"), "Add Existing Folder"); toolAddFolder.TooltipText = toolAddFolder.Label; toolBar1.Add(toolAddFolder); toolBar1.Add(new SeparatorToolItem()); toolBuild = new ToolButton(new Image(null, "Toolbar.Build.png"), "Build"); toolBuild.TooltipText = toolBuild.Label; toolBar1.Add(toolBuild); toolRebuild = new ToolButton(new Image(null, "Toolbar.Rebuild.png"), "Rebuild"); toolRebuild.TooltipText = toolRebuild.Label; toolBar1.Add(toolRebuild); toolClean = new ToolButton(new Image(null, "Toolbar.Clean.png"), "Clean"); toolClean.TooltipText = toolClean.Label; toolBar1.Add(toolClean); toolBar1.Add(new SeparatorToolItem()); toolFilterOutput = new ToggleToolButton(); toolFilterOutput.Label = toolFilterOutput.TooltipText = "Filter Output"; toolFilterOutput.IconWidget = new Image(null, "Toolbar.FilterOutput.png"); toolBar1.Add(toolFilterOutput); if (!Global.UseHeaderBar) { this.vbox2.PackStart(toolBar1, false, true, 0); } global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.menubar1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.hpaned1 = new global::Gtk.HPaned(); this.hpaned1.CanFocus = true; this.hpaned1.Name = "hpaned1"; this.hpaned1.Position = 179; // Container child hpaned1.Gtk.Paned+PanedChild this.vpaned2 = new global::Gtk.VPaned(); this.vpaned2.CanFocus = true; this.vpaned2.Name = "vpaned2"; this.vpaned2.Position = 247; // Container child vpaned2.Gtk.Paned+PanedChild this.projectview1 = new global::MonoGame.Tools.Pipeline.ProjectView(); this.projectview1.Events = ((global::Gdk.EventMask)(256)); this.projectview1.Name = "projectview1"; this.vpaned2.Add(this.projectview1); global::Gtk.Paned.PanedChild w3 = ((global::Gtk.Paned.PanedChild)(this.vpaned2 [this.projectview1])); w3.Resize = false; // Container child vpaned2.Gtk.Paned+PanedChild this.propertiesview1 = new global::MonoGame.Tools.Pipeline.PropertiesView(); this.propertiesview1.Events = ((global::Gdk.EventMask)(256)); this.propertiesview1.Name = "propertiesview1"; this.vpaned2.Add(this.propertiesview1); global::Gtk.Paned.PanedChild w4 = ((global::Gtk.Paned.PanedChild)(this.vpaned2 [this.propertiesview1])); w4.Resize = false; this.hpaned1.Add(this.vpaned2); global::Gtk.Paned.PanedChild w5 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.vpaned2])); w5.Resize = false; // Container child hpaned1.Gtk.Paned+PanedChild buildOutput1 = new BuildOutput(); this.hpaned1.Add(this.buildOutput1); this.vbox2.Add(this.hpaned1); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hpaned1])); w8.Position = 2; this.Add(this.vbox2); treeview1 = new TreeView(); #if GTK3 if (Global.UseHeaderBar) { Builder builder = new Builder(null, "MonoGame.Tools.Pipeline.Gtk.MainWindow.HeaderBar.glade", null); hbar = new HeaderBar(builder.GetObject("headerbar").Handle); builder.Autoconnect(this); hbar.AttachToWindow(this); hbar.ShowCloseButton = true; hbar.Show(); foreach (var o in menubar1.Children) { menubar1.Remove(o); menu2.Insert(o, 4); } new_button.Clicked += OnNewActionActivated; save_button.Clicked += OnSaveActionActivated; build_button.Clicked += OnBuildAction1Activated; rebuild_button.Clicked += OnRebuildActionActivated; cancel_button.Clicked += OnCancelBuildActionActivated; filteroutput_button.ButtonReleaseEvent += ToggleFilterOutput; filteroutput_button.Sensitive = true; vbox2.Remove(menubar1); open_menubutton = new MenuButton(open_button.Handle); var popover = new Popover(open_menubutton); var vbox = new VBox(); vbox.WidthRequest = 350; vbox.HeightRequest = 300; Gtk3Wrapper.gtk_tree_view_set_activate_on_single_click(treeview1.Handle, true); treeview1.HeadersVisible = false; treeview1.EnableGridLines = TreeViewGridLines.Horizontal; treeview1.HoverSelection = true; treeview1.RowActivated += delegate(object o, RowActivatedArgs args) { popover.Hide(); TreeIter iter; if (!recentListStore.GetIter(out iter, args.Path)) { return; } OpenProject(recentListStore.GetValue(iter, 1).ToString()); }; ScrolledWindow scroll1 = new ScrolledWindow(); scroll1.WidthRequest = 350; scroll1.HeightRequest = 300; scroll1.Add(treeview1); vbox.PackStart(scroll1, true, true, 0); var openButton = new Button("Open Other..."); openButton.Clicked += delegate(object sender, System.EventArgs e) { popover.Hide(); OnOpenActionActivated(sender, e); }; vbox.PackStart(openButton, false, true, 0); vbox.ShowAll(); popover.Add(vbox); open_menubutton.Popup = popover; } #endif this.Title = basetitle; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 751; this.DefaultHeight = 557; #if GTK3 Gdk.Geometry geom = new Gdk.Geometry(); geom.MinWidth = 400; geom.MinHeight = 300; this.SetGeometryHints(this, geom, Gdk.WindowHints.MinSize); #endif this.Show(); this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent); this.NewAction.Activated += new global::System.EventHandler(this.OnNewActionActivated); this.toolNew.Clicked += OnNewActionActivated; this.OpenAction.Activated += new global::System.EventHandler(this.OnOpenActionActivated); this.toolOpen.Clicked += OnOpenActionActivated; this.CloseAction.Activated += new global::System.EventHandler(this.OnCloseActionActivated); this.ImportAction.Activated += new global::System.EventHandler(this.OnImportActionActivated); this.SaveAction.Activated += new global::System.EventHandler(this.OnSaveActionActivated); this.toolSave.Clicked += OnSaveActionActivated; this.SaveAsAction.Activated += new global::System.EventHandler(this.OnSaveAsActionActivated); this.ExitAction.Activated += new global::System.EventHandler(this.OnExitActionActivated); this.UndoAction.Activated += new global::System.EventHandler(this.OnUndoActionActivated); this.RedoAction.Activated += new global::System.EventHandler(this.OnRedoActionActivated); RenameAction.Activated += this.OnRenameActionActivated; this.DeleteAction.Activated += new global::System.EventHandler(this.OnDeleteActionActivated); this.BuildAction1.Activated += new global::System.EventHandler(this.OnBuildAction1Activated); toolBuild.Clicked += OnBuildAction1Activated; this.RebuildAction.Activated += new global::System.EventHandler(this.OnRebuildActionActivated); toolRebuild.Clicked += OnRebuildActionActivated; this.CleanAction.Activated += new global::System.EventHandler(this.OnCleanActionActivated); toolClean.Clicked += OnCleanActionActivated; this.ViewHelpAction.Activated += new global::System.EventHandler(this.OnViewHelpActionActivated); this.AboutAction.Activated += new global::System.EventHandler(this.OnAboutActionActivated); this.NewItemAction.Activated += new global::System.EventHandler(this.OnNewItemActionActivated); this.toolNewItem.Clicked += OnNewItemActionActivated; this.NewFolderAction.Activated += new global::System.EventHandler(this.OnNewFolderActionActivated); this.toolNewFolder.Clicked += OnNewFolderActionActivated; this.ExistingItemAction.Activated += new global::System.EventHandler(this.OnAddItemActionActivated); this.toolAddItem.Clicked += OnAddItemActionActivated; this.ExistingFolderAction.Activated += new global::System.EventHandler(this.OnAddFolderActionActivated); this.toolAddFolder.Clicked += OnAddFolderActionActivated; this.DebugModeAction.Activated += new global::System.EventHandler(this.OnDebugModeActionActivated); this.FilterOutputAction.Activated += OnFilterOutputActionActivated; this.toolFilterOutput.ButtonReleaseEvent += ToggleFilterOutput; this.CancelBuildAction.Activated += new global::System.EventHandler(this.OnCancelBuildActionActivated); this.SizeAllocated += MainWindow_SizeAllocated; }
public MenuButton() : base(Gtk3Wrapper.gtk_menu_button_new()) { }
public ColorChooserDialog(Window parrent, string title) : base(Gtk3Wrapper.gtk_color_chooser_dialog_new(title, parrent.Handle)) { ColorChooser = new ColorChooser(this.Handle); }