/// <summary> /// Adds an IconButton to the menu. /// If no free slot is available, an error will be thrown. /// </summary> /// <param name="button">The button which should be added</param> public void AddButton(IconButton button) { if (Buttons[1] == null) { button.SetPosition(new Vector2(this.Rectangle.Width - 70, this.Rectangle.Top + 10)); Buttons[1] = button; } else if (Buttons[0] == null) { button.SetPosition(new Vector2(this.Rectangle.Width - 140, this.Rectangle.Top + 10)); Buttons[0] = button; } else { throw new Exception("No free slot available!"); } }