Example #1
0
/*
========================
idMenuWidget::SetFocusIndex
========================
*/
void idMenuWidget::SetFocusIndex( const int index, bool skipSound )
{

	if( GetChildren().Num() == 0 )
	{
		return;
	}
	
	const int oldIndex = focusIndex;
	
	assert( index >= 0 && index < GetChildren().Num() ); //&& oldIndex >= 0 && oldIndex < GetChildren().Num() );
	
	focusIndex = index;
	
	if( oldIndex != focusIndex && !skipSound )
	{
		if( menuData != NULL )
		{
			menuData->PlaySound( GUI_SOUND_FOCUS );
		}
	}
	
	idSWFParmList parms;
	parms.Append( oldIndex );
	parms.Append( index );
	
	// need to mark the widget as having lost focus
	if( oldIndex != index && oldIndex >= 0 && oldIndex < GetChildren().Num() && GetChildByIndex( oldIndex ).GetState() != WIDGET_STATE_HIDDEN )
	{
		GetChildByIndex( oldIndex ).ReceiveEvent( idWidgetEvent( WIDGET_EVENT_FOCUS_OFF, 0, NULL, parms ) );
	}
	
	//assert( GetChildByIndex( index ).GetState() != WIDGET_STATE_HIDDEN );
	GetChildByIndex( index ).ReceiveEvent( idWidgetEvent( WIDGET_EVENT_FOCUS_ON, 0, NULL, parms ) );
}
Example #2
0
/*
========================
idMenuScreen::HandleMenu

NOTE: This is holdover from the way the menu system was setup before.  It should be able to
be removed when the old way is fully replaced, and instead events will just be sent directly
to the screen.
========================
*/
void idMenuScreen::HandleMenu( const mainMenuTransition_t type )
{
	if( type == MENU_TRANSITION_ADVANCE )
	{
		ReceiveEvent( idWidgetEvent( WIDGET_EVENT_PRESS, 0, NULL, idSWFParmList() ) );
	}
	else if( type == MENU_TRANSITION_BACK )
	{
		ReceiveEvent( idWidgetEvent( WIDGET_EVENT_BACK, 0, NULL, idSWFParmList() ) );
	}
	
	transition = type;
}
Example #3
0
/*
========================
idMenuScreen::ObserveEvent
========================
*/
void idMenuScreen::ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event )
{
	if( event.type == WIDGET_EVENT_COMMAND )
	{
		switch( event.arg )
		{
			case idMenuWidget_CommandBar::BUTTON_JOY1:
			{
				ReceiveEvent( idWidgetEvent( WIDGET_EVENT_PRESS, 0, event.thisObject, event.parms ) );
				break;
			}
			case idMenuWidget_CommandBar::BUTTON_JOY2:
			{
				ReceiveEvent( idWidgetEvent( WIDGET_EVENT_BACK, 0, event.thisObject, event.parms ) );
				break;
			}
		}
	}
}