1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

Small fixes for ComboBox items and AudioThumbnail. Reorganisation of all the RelativeCoordinate classes into their own folder. New RelativeCoordinatePositionerBase class and internal work on DrawablePath.

This commit is contained in:
Julian Storer 2011-01-03 18:08:28 +00:00
parent 2a8cf6f75f
commit e0ca6d6ca4
42 changed files with 3722 additions and 2632 deletions

View file

@ -289,6 +289,19 @@ void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMess
}
}
bool ComboBox::selectIfEnabled (const int index)
{
const ItemInfo* const item = getItemForIndex (index);
if (item != 0 && item->isEnabled)
{
setSelectedItemIndex (index);
return true;
}
return false;
}
void ComboBox::valueChanged (Value&)
{
if (lastCurrentId != (int) currentId.getValue())
@ -438,12 +451,20 @@ bool ComboBox::keyPressed (const KeyPress& key)
{
if (key.isKeyCode (KeyPress::upKey) || key.isKeyCode (KeyPress::leftKey))
{
setSelectedItemIndex (jmax (0, getSelectedItemIndex() - 1));
int index = getSelectedItemIndex() - 1;
while (index >= 0 && ! selectIfEnabled (index))
--index;
return true;
}
else if (key.isKeyCode (KeyPress::downKey) || key.isKeyCode (KeyPress::rightKey))
{
setSelectedItemIndex (jmin (getSelectedItemIndex() + 1, getNumItems() - 1));
int index = getSelectedItemIndex() + 1;
while (index < getNumItems() && ! selectIfEnabled (index))
++index;
return true;
}
else if (key.isKeyCode (KeyPress::returnKey))