Пример #1
0
        /// <summary>
        /// Initialize the expander.
        /// </summary>
        /// <param name="gui">The GUI that this expander will be a part of.</param>
        /// <param name="position">The position of this expander.</param>
        /// <param name="height">The height of this expander.</param>
        /// <param name="width">The width of this expander.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Button = new Button(GUI, Position, 15, 15);
            _Header = new Label(GUI, Position + new Vector2(20, 0), 75, Height);
            _IsExpanded = true;
            _Layout = new Layout(GUI, Position + new Vector2(0, 15), _Width, _Height);
            _ItemContent = new List<Component>();
            _Header.Text = "Header";

            //Add the items.
            Add(_Header);
            Add(_Button);

            //Hook up some events.
            _Button.MouseClick += OnHeaderClick;
            _Header.MouseClick += OnHeaderClick;
        }
Пример #2
0
        /// <summary>
        /// Initialize the layout grid.
        /// </summary>
        /// <param name="layout">The layout grid that this cell will be a part of.</param>
        /// <param name="component">The component this cell will contain.</param>
        public void Initialize(Layout layout, Component component)
        {
            //Initialize some variables.
            _Layout = layout;
            _Component = component;
            _Position = component.Position;
            _Width = component.Width;
            _Height = component.Height;
            _GoalWidth = _Width;
            _GoalHeight = _Height;
            _CellStyle = CellStyle.Dynamic;

            //Set some boundaries.
            _MinWidth = 0;
            _MaxWidth = 500;
            _MinHeight = 0;
            _MaxHeight = 500;

            //Subscribe to events.
            component.BoundsChange += OnItemBoundsChange;
        }
Пример #3
0
 /// <summary>
 /// Create a layout grid cell.
 /// </summary>
 /// <param name="layout">The layout grid that this cell will be a part of.</param>
 /// <param name="component">The component this cell will contain.</param>
 public LayoutCell(Layout layout, Component component)
 {
     //Initialize some variables.
     Initialize(layout, component);
 }
Пример #4
0
        /// <summary>
        /// Initialize the form.
        /// </summary>
        /// <param name="gui">The GUI that this form will be a part of.</param>
        /// <param name="position">The position of this form.</param>
        /// <param name="height">The height of this form.</param>
        /// <param name="width">The width of this form.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Items = new List<Component>();
            _Layout = new Layout(gui, position, width, height);
            _IsDirty = false;
        }