Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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;
     }
 }
Пример #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);
     }
 }