Ejemplo n.º 1
0
        public Widget AddChild(Widget child)
        {
            if (!Constructed)
            {
                throw new InvalidOperationException("Widget must be constructed before children can be added.");
            }

            if (!child.Constructed)
            {
                child._Construct(Root);
            }

            if (!Object.ReferenceEquals(child.Root, Root))
            {
                throw new InvalidOperationException("Can't add UIItem to different heirarchy");
            }

            Children.Add(child);
            child.Parent = this;
            Invalidate();

            return(child);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Widgets must be constructed or some operations will fail. Use this function to construct a widget
 /// when the widget is not being immediately added to its parent.
 /// </summary>
 /// <param name="NewWidget"></param>
 /// <returns></returns>
 public Widget ConstructWidget(Widget NewWidget)
 {
     NewWidget._Construct(this);
     return(NewWidget);
 }