//----------------------------------------------------------------------------//
bool ListWidget::isItemSelected(const StandardItem* item)
{
    for (SelectionStatesVector::const_iterator itor = getIndexSelectionStates().begin();
        itor != getIndexSelectionStates().end(); ++itor)
    {
        if (item == d_itemModel.getItemForIndex(itor->d_selectedIndex))
        {
            return true;
        }
    }

    return false;
}
Beispiel #2
0
/*************************************************************************
	Handler for cursor activation events
*************************************************************************/
void ComboDropList::onCursorActivate(CursorInputEventArgs& e)
{
    ListWidget::onCursorActivate(e);

    if (e.source == CIS_Left)
	{
		if (d_armed && (getChildAtPosition(e.position) == 0))
		{
            // if something was selected, confirm that selection.
            if (getIndexSelectionStates().size() > 0)
            {
                WindowEventArgs args(this);
                onListSelectionAccepted(args);
            }

            releaseInput();
		}
        // if we are not already armed, in response to a left cursor activation event, we auto-arm.
		else
		{
			d_armed = true;
		}

		++e.handled;
	}

}