public void SetRootWindow(Gtk.Window root) { rootWidget = root; if (rootWidget.IsRealized) rootWidget.AddAccelGroup (AccelGroup); else rootWidget.Realized += new EventHandler (RootRealized); }
/// <summary> /// Sets the root window. The manager will start the command route at this window, if no other is active. /// </summary> public void SetRootWindow (Gtk.Window root) { if (rootWidget != null) rootWidget.KeyPressEvent -= OnKeyPressed; rootWidget = root; rootWidget.AddAccelGroup (AccelGroup); RegisterTopWindow (rootWidget); }
public static void Build(object obj, string id) { System.Collections.Hashtable bindings = new System.Collections.Hashtable(); if ((id == "MainWindow")) { Gtk.Window cobj = ((Gtk.Window)(obj)); // Widget MainWindow cobj.Title = "GNFOViewer"; Gtk.UIManager w1 = new Gtk.UIManager(); Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default"); Gtk.Action w3 = new Gtk.Action("File", "_File", null, null); w3.ShortLabel = "_File"; bindings["File"] = w3; w2.Add(w3, "<Alt>f"); Gtk.Action w4 = new Gtk.Action("Tools", "_Tools", null, null); w4.ShortLabel = "_Tools"; bindings["Tools"] = w4; w2.Add(w4, "<Alt>t"); Gtk.Action w5 = new Gtk.Action("Open", "Open", null, "gtk-open"); w5.ShortLabel = "Open"; bindings["Open"] = w5; w2.Add(w5, "<Control>o"); Gtk.Action w6 = new Gtk.Action("Quit", "Quit", null, "gtk-quit"); w6.ShortLabel = "Quit"; bindings["Quit"] = w6; w2.Add(w6, "<Control>q"); Gtk.Action w7 = new Gtk.Action("Invert", "Invert", null, "gtk-refresh"); w7.ShortLabel = "Invert"; bindings["Invert"] = w7; w2.Add(w7, "<Control>i"); w1.InsertActionGroup(w2, 0); cobj.AddAccelGroup(w1.AccelGroup); cobj.Icon = Gtk.IconTheme.Default.LoadIcon("stock_smiley-26", 16, 0); cobj.WindowPosition = ((Gtk.WindowPosition)(3)); cobj.DefaultWidth = 640; cobj.DefaultHeight = 480; cobj.Events = ((Gdk.EventMask)(0)); cobj.Name = "MainWindow"; // Container child MainWindow.Gtk.Container+ContainerChild Gtk.VBox w8 = new Gtk.VBox(); w8.Events = ((Gdk.EventMask)(0)); w8.Name = "vbox1"; // Container child vbox1.Gtk.Box+BoxChild w1.AddUiFromString("<ui><menubar name='menubar1'><menu action='File'><menuitem action='Open'/><menuitem action='Quit'/></menu><menu action='Tools'><menuitem action='Invert'/></menu></menubar></ui>"); Gtk.MenuBar w9 = ((Gtk.MenuBar)(w1.GetWidget("/menubar1"))); w9.Events = ((Gdk.EventMask)(0)); w9.Name = "menubar1"; bindings["menubar1"] = w9; w8.Add(w9); Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(w8[w9])); w10.Position = 0; w10.Expand = false; w10.Fill = false; // Container child vbox1.Gtk.Box+BoxChild Gtk.ScrolledWindow w11 = new Gtk.ScrolledWindow(); w11.VscrollbarPolicy = ((Gtk.PolicyType)(1)); w11.HscrollbarPolicy = ((Gtk.PolicyType)(1)); w11.CanFocus = true; w11.Events = ((Gdk.EventMask)(0)); w11.Name = "scrolledwindow1"; // Container child scrolledwindow1.Gtk.Container+ContainerChild Gtk.TextView w12 = new Gtk.TextView(); w12.CursorVisible = false; w12.Editable = false; w12.CanFocus = true; w12.Events = ((Gdk.EventMask)(0)); w12.Name = "textview1"; bindings["textview1"] = w12; w11.Add(w12); bindings["scrolledwindow1"] = w11; w8.Add(w11); Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(w8[w11])); w14.Position = 1; bindings["vbox1"] = w8; cobj.Add(w8); bindings["MainWindow"] = cobj; w9.Show(); w12.Show(); w11.Show(); w8.Show(); cobj.Show(); cobj.DeleteEvent += ((Gtk.DeleteEventHandler)(System.Delegate.CreateDelegate(typeof(Gtk.DeleteEventHandler), cobj, "OnDeleteEvent"))); w5.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnOpenActivated"))); w6.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnQuitActivated"))); w7.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnInvertActivated"))); } System.Reflection.FieldInfo[] fields = obj.GetType().GetFields(((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic) | System.Reflection.BindingFlags.Instance)); for (int n = 0; (n < fields.Length); n = (n + 1)) { System.Reflection.FieldInfo field = fields[n]; object widget = bindings[field.Name]; if (((widget != null) && field.FieldType.IsInstanceOfType(widget))) { field.SetValue(obj, widget); } } }