public bool MouseUp(int x, int y)
{
if (Enabled)
{
if (!Dropped)
{
if (_buttons[0].MouseUp(x, y))
{
Dropped = true;
_dropBackground.Resize(_width + 30, _height * (_items.Count + 1) + 20);
_dropBackground.MoveTo(_xPos - 10, _yPos - 10);
return true;
}
}
else
{
for (int i = 0; i < _buttons.Count; i++)
{
if (_buttons[i].MouseUp(x, y))
{
if (i > 0)
{
_selectedIndex = i + _scrollBar.TopIndex - 1;
_buttons[0].SetText(_buttons[i].Text);
}
Dropped = false;
_dropBackground.Resize(_width, _height);
_dropBackground.MoveTo(_xPos, _yPos);
return true;
}
}
if (_scrollBar.MouseUp(x, y))
{
RefreshLabels();
return true;
}
//At this point, even if the mouse is not over the UI, we want to capture the mouse up so the user don't click on something else
Dropped = false;
return true;
}
}
return false;
}