public void Redraw() { if (frame.Child != null) { frame.Child.Destroy(); } if (frame.LabelWidget != null) { frame.LabelWidget.Destroy(); } frame.Add(obj.GetCellContents(context)); frame.LabelWidget = obj.GetHeader(context); ShowAll(); redrawQueued = false; }
public static Widget GetSmartHeader(Context context, IGUIComplete obj) { DependableShell shell = new DependableShell(obj.order + 1); shell.ReloadEvent += delegate { if (shell.Child != null) { shell.Child.Destroy(); } shell.Add(obj.GetHeader(context)); shell.ShowAll(); }; shell.Reload(); DependencyManager.Connect(obj, shell); return(shell); }
public void Redraw() { SetSizeRequest(-1, -1); if (Child != null) { Child.Destroy(); } if (LabelWidget != null) { LabelWidget.Destroy(); } Add(UIFactory.GenerateHorizontal(obj)); LabelWidget = obj.GetHeader(new Context(obj, Game.player, false, true)); ShowAll(); redrawQueued = false; }
public Cell(Context context, IGUIComplete obj) : base(obj, context) { //Basic setup this.obj = obj; frame = new Frame(); Child = frame; prelight = false; MyDragDrop.SourceSet(this, obj); // "Removing by dragging away to nothing" functionality should be implemented manually when the Cell is created. // It should be implemented via MyDragDrop.SourceSetFailAction // The object should generally be removed from the parent list ONLY in this case. // Rationale for removing only if drag had no target: // - If cellObject is dragged from an aggregative list to another aggregative list, // the Add() function on the second automatically removes it from the first, so calling Remove() is unnecessary. // - If cellObject is dragged from an associative list to an aggregative list or vice versa, // We reasonably assume that user doesn't want it removed from the first list since the concept of "moving" doesn't apply in this context. // - Only if the user has dragged cellObject from any list to *nothing* can it be assumed that they need it manually removed by us. frame.Add(obj.GetCellContents(this.context)); frame.LabelWidget = obj.GetHeader(this.context); InspectableBox inspectableBox = frame.LabelWidget as InspectableBox; ShowAll(); }
public void Reload() { if (Child != null) { Child.Destroy(); } if (context.vertical) { Expander expander = new Expander(title + ": " + obj.name) { Expanded = true }; expander.Add(UIFactory.GenerateVertical(obj)); Add(expander); } else { HBox headerBox = new HBox(false, 0); headerBox.PackStart(new Label(title + ": "), false, false, 0); headerBox.PackStart(obj.GetHeader(context.butCompact), false, false, 0); Add(headerBox); } ShowAll(); }
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(); } }