Beispiel #1
0
 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();
 }
Beispiel #2
0
        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();
        }