private void onMouseLeave(MenuButton b)
 {
     if (MouseLeave != null)
         MouseLeave(this, new ButtonMouseEventArgs { Button = b });
 }
        public override void update(Utilities.GameTime time)
        {
            Vector2i mouse = Game1.getMousePosition();

            foreach (MenuButton b in buttons)
            {
                if (currentButton != null)
                {
                    if (Utils.checkMouseCollision(mouse.X, mouse.Y, b.TextBox) && !b.Equals(currentButton))
                    {
                        onMouseLeave(currentButton);
                        onMouseEnter(b);
                        currentButton = b;
                    }
                }
                else if (Utils.checkMouseCollision(mouse.X, mouse.Y, b.TextBox))
                {
                    onMouseEnter(b);
                    currentButton = b;
                }
            }

            if (currentButton != null && !Utils.checkMouseCollision(mouse.X, mouse.Y, currentButton.TextBox))
            {
                onMouseLeave(currentButton);
                currentButton = null;
            }
        }
 private void onMouseEnter(MenuButton b)
 {
     if (MouseEnter != null)
         MouseEnter(this, new ButtonMouseEventArgs { Button = b });
 }
 public void addButtons(MenuButton[] buttons)
 {
     foreach (MenuButton b in buttons)
         this.buttons.Add(b);
     setButtons();
 }