//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CommandButton::cursorExited( void )
{
	// only clear ourselves if we have do not have a containing menu
	// only stay armed if we have a sub menu
	// the buttons only unarm themselves when another button is armed instead
	if ( !getParentMenu() || !GetSubMenu() )
	{
		setArmed( false );
	}
}
Пример #2
0
Menu* MenuItem::getTopLevelMenu(void) const
{
    MenuRefPtr c(getParentMenu());
    while(c != NULL)
    {
        if(c->getTopLevelMenu())
        {
            return c;
        }
        c = c->getParentMenu();
    }
    return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Highlights the current button, and all it's parent menus
//-----------------------------------------------------------------------------
void CommandButton::cursorEntered( void )
{
	// unarm all the other buttons in this menu
	CCommandMenu *containingMenu = getParentMenu();
	if ( containingMenu )
	{
		containingMenu->ClearButtonsOfArmedState();

		// make all our higher buttons armed
		CCommandMenu *pCParent = containingMenu->GetParentMenu();
		if ( pCParent )
		{
			CommandButton *pParentButton = pCParent->FindButtonWithSubmenu( containingMenu );

			pParentButton->cursorEntered();
		}
	}

	// arm ourselves
	setArmed( true );
}