Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new UIControl class.
 /// </summary>
 /// <param name="assignedUIManager">The assigned UIManager.</param>
 protected UIControl(UIManager assignedUIManager)
 {
     _position = new Vector2(0, 0);
     _size = new UISize(0, 0);
     UpdateBounds();
     _mouseRectangle = new Rectangle {Width = 1, Height = 1};
     Guid = Guid.NewGuid();
     _inputManager = SGL.Components.Get<InputManager>();
     CanGetFocus = true;
     Enable = true;
     Visible = true;
     _parent = null;
     _lastRelativeMousePostion = new Vector2(0, 0);
     Children = new List<UIControl>();
     UIManager = assignedUIManager;
     UIManager.Add(this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes a new UIControl from the Collection.
 /// </summary>
 /// <param name="control">The Control.</param>
 public void Remove(UIControl control)
 {
     _controls.Remove(control);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a new UIControl to the Collection.
 /// </summary>
 /// <param name="control">The Control.</param>
 public void Add(UIControl control)
 {
     _controls.Add(control);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the Parent.
 /// </summary>
 /// <param name="parent">The Parent.</param>
 internal void SetParent(UIControl parent)
 {
     if (parent != null)
     {
         parent.Children.Add(this);
         _parent = parent;
     }
     else
     {
         _parent.RemoveChild(this);
         _parent = null;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes a UIControl from the Childs.
 /// </summary>
 /// <param name="control">The UIControl.</param>
 public void RemoveChild(UIControl control)
 {
     if (Children.Contains(control))
     {
         Children.Remove(control);
     }
 }