public MainForm() { InitializeComponent(); EventfulList <Instance> instList = new EventfulList <Instance>(); InstanceList = instList; instList.Added += InstAdded; instList.Removed += InstRemoved; // If on windows, set the theme for our instance list. if (OSUtils.OS == OSEnum.Windows) { OSUtils.SetWindowTheme(instView.Handle, "explorer", null); } EventfulList <Task> tList = new EventfulList <Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; //mainLayoutPanel. statusStrips = new Dictionary <int, StatusStrip>(); }
public MainForm() { InitializeComponent(); EventfulList<Instance> instList = new EventfulList<Instance>(); InstanceList = instList; instList.Added += InstAdded; instList.Removed += InstRemoved; // If on windows, set the theme for our instance list. if (OSUtils.OS == OSEnum.Windows) OSUtils.SetWindowTheme(instView.Handle, "explorer", null); EventfulList<Task> tList = new EventfulList<Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; //mainLayoutPanel. statusStrips = new Dictionary<int, StatusStrip>(); }
public MainWindow() { XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "mainVBox", null); gxml.Toplevel = this; gxml.Autoconnect(this); XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade", "instContextMenu", null); gxml2.Autoconnect(this); /* * HACK: the nested menu isn't picked up by the first gxml object. It is probably a GTK# bug. * This is the fix - manually asking for the menu and connecting it. */ XML gxml3 = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "menunew", null); gxml3.Autoconnect(this); newInstButton.Menu = menunew; this.Add(mainVBox); ShowAll(); this.WidthRequest = 620; this.HeightRequest = 380; DeleteEvent += (o, args) => Application.Quit(); // Set up the instance icon view instListStore = new ListStore( typeof(string), typeof(Gdk.Pixbuf), typeof(Instance)); instView.Model = instListStore; instView.TextColumn = 0; instView.PixbufColumn = 1; instView.ItemWidth = -1; Gtk.CellRendererText crt = instView.Cells[0] as CellRendererText; crt.Editable = true; crt.Edited += (object o, EditedArgs args) => { int EditedIndex = int.Parse(args.Path); TreeIter iter; // don't allow bad names if (!Instance.NameIsValid(args.NewText)) { return; } System.Console.WriteLine("Path: " + args.Path + " New text: " + args.NewText); if (instListStore.GetIterFromString(out iter, args.Path)) { instListStore.SetValue(iter, 0, args.NewText); Instance inst = instListStore.GetValue(iter, 2) as Instance; inst.Name = args.NewText; } }; instView.Orientation = Orientation.Vertical; instView.ButtonPressEvent += (o, args) => { if (args.Event.Button == 3 && instView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y) != null) { instView.SelectPath(instView.GetPathAtPos( (int)args.Event.X, (int)args.Event.Y)); instContextMenu.Popup(); } }; instView.KeyPressEvent += (object o, KeyPressEventArgs args) => { if (args.Event.Key == Gdk.Key.F2) { if (instView.SelectedItems.Count() != 0) { instView.SetCursor(instView.SelectedItems[0], instView.Cells[0], true); } } else if (args.Event.Key == Gdk.Key.Escape) { if (EscPressed != null) { EscPressed(this, EventArgs.Empty); } } }; // Set up the task list EventfulList <Task> tList = new EventfulList <Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; taskProgBars = new Dictionary <int, Box>(); // Set up the instance list EventfulList <Instance> iList = new EventfulList <Instance>(); iList.Added += InstAdded; iList.Removed += InstRemoved; InstanceList = iList; helpButton.Sensitive = false; if (OSUtils.OS == OSEnum.Linux) { Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem; openalRemoveItem.Visible = true; } }
public MainWindow() { XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "mainVBox", null); gxml.Toplevel = this; gxml.Autoconnect(this); XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade", "instContextMenu", null); gxml2.Autoconnect(this); this.Add(mainVBox); ShowAll(); this.WidthRequest = 620; this.HeightRequest = 380; DeleteEvent += (o, args) => Application.Quit(); // Set up the instance icon view instListStore = new ListStore( typeof(string), typeof(Gdk.Pixbuf), typeof(Instance)); instView.Model = instListStore; instView.TextColumn = 0; instView.PixbufColumn = 1; instView.ItemWidth = -1; instView.Orientation = Orientation.Vertical; instView.ButtonPressEvent += (o, args) => { if (args.Event.Button == 3 && instView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y) != null) { instView.SelectPath(instView.GetPathAtPos( (int)args.Event.X, (int)args.Event.Y)); instContextMenu.Popup(); } }; // Set up the task list EventfulList<Task> tList = new EventfulList<Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; taskProgBars = new Dictionary<int, Box>(); // Set up the instance list EventfulList<Instance> iList = new EventfulList<Instance>(); iList.Added += InstAdded; iList.Removed += InstRemoved; InstanceList = iList; helpButton.Sensitive = false; if(OSUtils.OS == OSEnum.Linux) { Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem; openalRemoveItem.Visible = true; } }
public MainWindow() { XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "mainVBox", null); gxml.Toplevel = this; gxml.Autoconnect(this); XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade", "instContextMenu", null); gxml2.Autoconnect(this); /* * HACK: the nested menu isn't picked up by the first gxml object. It is probably a GTK# bug. * This is the fix - manually asking for the menu and connecting it. */ XML gxml3 = new XML(null, "MultiMC.GTKGUI.MainWindow.glade", "menunew", null); gxml3.Autoconnect(this); newInstButton.Menu = menunew; this.Add(mainVBox); ShowAll(); this.WidthRequest = 620; this.HeightRequest = 380; DeleteEvent += (o, args) => Application.Quit(); // Set up the instance icon view instListStore = new ListStore( typeof(string), typeof(Gdk.Pixbuf), typeof(Instance)); instView.Model = instListStore; instView.TextColumn = 0; instView.PixbufColumn = 1; instView.ItemWidth = -1; Gtk.CellRendererText crt = instView.Cells[0] as CellRendererText; crt.Editable = true; crt.Edited += (object o, EditedArgs args) => { int EditedIndex = int.Parse(args.Path); TreeIter iter; // don't allow bad names if(!Instance.NameIsValid(args.NewText)) return; System.Console.WriteLine("Path: " + args.Path + " New text: " + args.NewText); if(instListStore.GetIterFromString(out iter,args.Path)) { instListStore.SetValue(iter, 0, args.NewText); Instance inst = instListStore.GetValue(iter, 2) as Instance; inst.Name = args.NewText; } }; instView.Orientation = Orientation.Vertical; instView.ButtonPressEvent += (o, args) => { if (args.Event.Button == 3 && instView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y) != null) { instView.SelectPath(instView.GetPathAtPos( (int)args.Event.X, (int)args.Event.Y)); instContextMenu.Popup(); } }; instView.KeyPressEvent += (object o, KeyPressEventArgs args) => { if(args.Event.Key == Gdk.Key.F2) { if(instView.SelectedItems.Count() != 0) instView.SetCursor(instView.SelectedItems[0], instView.Cells[0], true); } else if(args.Event.Key == Gdk.Key.Escape) { if(EscPressed != null) EscPressed(this, EventArgs.Empty); } }; // Set up the task list EventfulList<Task> tList = new EventfulList<Task>(); tList.Added += TaskAdded; tList.Removed += TaskRemoved; TaskList = tList; taskProgBars = new Dictionary<int, Box>(); // Set up the instance list EventfulList<Instance> iList = new EventfulList<Instance>(); iList.Added += InstAdded; iList.Removed += InstRemoved; InstanceList = iList; helpButton.Sensitive = false; if(OSUtils.OS == OSEnum.Linux) { Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem; openalRemoveItem.Visible = true; } }