public static Window InspectInNewWindow(IGUIComplete newObj) { DefocusableWindow win = new DefocusableWindow(); win.SetPosition(WindowPosition.Center); win.Title = "Inspector"; win.TransientFor = MainWindow.main; win.TypeHint = Gdk.WindowTypeHint.Utility; Inspector inspector = new Inspector(newObj) { BorderWidth = 2 }; inspector.Hidden += delegate { if (inspector.obj == null) { win.Destroy(); } }; win.Add(inspector); win.DeleteEvent += (o, a) => DependencyManager.DisconnectAll(inspector); //Gtk complains if GC hasn't gotten around to us, and obj tries to reload this. win.FocusInEvent += (o, a) => win.TransientFor = MainWindow.main; win.DefaultHeight = inspector.Child.SizeRequest().Height + 10; win.ShowAll(); return(win); }
public void OnTriggerDestroyed(IDependable trigger) { if (trigger == battle) { Destroy(); DependencyManager.DisconnectAll(this); } }
public Listing(IGUIComplete obj, bool lazy) { this.obj = obj; this.lazy = lazy; DependencyManager.Connect(obj, this); DependencyManager.Connect(Game.UIKey, this); Destroyed += (o, a) => DependencyManager.DisconnectAll(this); SetSizeRequest(1, 300); LabelXalign = 1; Reload(); }
public SmartCell(Context context, IGUIComplete obj, bool lazy) : base(obj, context) { //Basic setup this.obj = obj; this.lazy = lazy; frame = new Frame(); Child = frame; prelight = false; MyDragDrop.SourceSet(this, obj); // "Removing by dragging away to nothing" functionality should be... [see Cell comment] DependencyManager.Connect(obj, this); DependencyManager.Connect(Game.UIKey, this); Destroyed += (o, a) => DependencyManager.DisconnectAll(this); Reload(); }
public ObjectField(PropertyInfo property, object obj, Context context, DisplayableAttribute attribute) : base(0, 0, 1, 1) { this.property = property; this.obj = (IGUIComplete)property.GetValue(obj); this.context = context; title = attribute.overrideLabel ?? UIFactory.ToReadable(property.Name); if (this.obj != null) { DependencyManager.Connect(this.obj, this); Destroyed += (o, a) => DependencyManager.DisconnectAll(this); Reload(); } else { Label label = new Label(title + ": None"); label.SetAlignment(0, 0); Add(label); } }
public void Inspect(IGUIComplete obj) { // Clean up prior attachments if (Child != null) { Child.Destroy(); } DependencyManager.DisconnectAll(this); ShowAll(); // Handle inspection request this.obj = obj; if (obj == null) { Hide(); } else { DependencyManager.Connect(obj, this); DependencyManager.Connect(Game.UIKey, this); if (Child != null) { Child.Destroy(); } VBox mainbox = new VBox(false, 0); mainbox.PackStart(obj.GetHeader(new Context(obj)), false, false, 10); mainbox.PackStart(new HSeparator(), false, false, 0); mainbox.PackStart(UIFactory.GenerateVertical(obj), true, true, 5); AddWithViewport(mainbox); if (!Visible) { Unhidden.Invoke(this, new EventArgs()); } ShowAll(); } }
public DependableShell(int order) : base(0, 0, 1, 1) { this.order = order; Destroyed += (o, a) => DependencyManager.DisconnectAll(this); //Theoretically we could Delete(obj), but that's unnecessary }