Ejemplo n.º 1
0
/**
*  @brief
*    Get item that belongs to a certain shortcut
*/
int32 Menu::GetShortcutItem(char nShortcut) const
{
	// Check all items
	for (uint32 i=0; i<m_lstItems.GetNumOfElements(); i++) {
		// Get item
		MenuItem *pItem = m_lstItems[i];

		// Is this the shortcut we search for?
		char nItemShortcut = pItem->GetShortcut();
		if (nItemShortcut != '\0' && nItemShortcut == nShortcut) {
			// Yes!
			return i;
		}
	}

	// No item with that shortcut found
	return -1;
}