当前位置: 首页>>代码示例>>C++>>正文


C++ idWidgetAction类代码示例

本文整理汇总了C++中idWidgetAction的典型用法代码示例。如果您正苦于以下问题:C++ idWidgetAction类的具体用法?C++ idWidgetAction怎么用?C++ idWidgetAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了idWidgetAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: StartWidgetActionRepeater

/*
========================
idMenuHandler::StartWidgetActionRepeater
========================
*/
void idMenuHandler::StartWidgetActionRepeater( idMenuWidget* widget, const idWidgetAction& action, const idWidgetEvent& event )
{
	if( actionRepeater.isActive && actionRepeater.action == action )
	{
		return;	// don't attempt to reactivate an already active repeater
	}
	
	actionRepeater.isActive = true;
	actionRepeater.action = action;
	actionRepeater.widget = widget;
	actionRepeater.event = event;
	actionRepeater.numRepetitions = 0;
	actionRepeater.nextRepeatTime = 0;
	actionRepeater.screenIndex = activeScreen;	// repeaters are cleared between screens
	
	if( action.GetParms().Num() == 2 )
	{
		actionRepeater.repeatDelay = action.GetParms()[ 1 ].ToInteger();
	}
	else
	{
		actionRepeater.repeatDelay = DEFAULT_REPEAT_TIME;
	}
	
	// do the first event immediately
	PumpWidgetActionRepeater();
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:32,代码来源:MenuHandler.cpp

示例2: HandleAction

/*
========================
idMenuScreen_Shell_ModeSelect::HandleAction h
========================
*/
bool idMenuScreen_Shell_ModeSelect::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_MODE_SELECT ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_PARTY_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( options == NULL ) {
				return true;
			}
			int selectionIndex = options->GetViewIndex();
			if ( parms.Num() == 1 ) {
				selectionIndex = parms[0].ToInteger();
			}	

			if ( options->GetFocusIndex() != selectionIndex ) {
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}

			idMatchParameters matchParameters = idMatchParameters( session->GetPartyLobbyBase().GetMatchParms() );
			matchParameters.gameMap = GAME_MAP_RANDOM;
			matchParameters.gameMode = selectionIndex;

			// Always a public match.
			matchParameters.matchFlags &= ~MATCH_INVITE_ONLY;

			session->UpdatePartyParms( matchParameters );

			// Update flags for game lobby.
			matchParameters.matchFlags = DefaultPartyFlags | DefaultPublicGameFlags;
			
			cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO, matchParameters.serverInfo );

			// Force a default value for the si_timelimit and si_fraglimit for quickmatch
			matchParameters.serverInfo.SetInt( "si_timelimit", 15 );
			matchParameters.serverInfo.SetInt( "si_fraglimit", 10 );

			session->FindOrCreateMatch( matchParameters );

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:63,代码来源:MenuScreen_Shell_ModeSelect.cpp

示例3: HandleAction

/*
========================
idMenuScreen_Shell_GameBrowser::HandleAction h
========================
*/
bool idMenuScreen_Shell_GameBrowser::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandle ) {
	idMenuHandler_Shell * const mgr = dynamic_cast< idMenuHandler_Shell * >( menuData );

	if ( mgr == NULL ) {
		return false;
	}

	if ( mgr->ActiveScreen() != SHELL_AREA_BROWSER ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_PARTY_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_COMMAND: {
			switch ( parms[ 0 ].ToInteger() ) {
				case BROWSER_COMMAND_REFRESH_SERVERS: {
					UpdateServerList();
					break;
				}
				case BROWSER_COMMAND_SHOW_GAMERTAG: {
					int index = listWidget->GetServerIndex();
					if ( index != -1 ) {
						session->ShowServerGamerCardUI( index );
					}
					break;
				}
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			int selectionIndex = listWidget->GetFocusIndex();
			if ( parms.Num() > 0 ) {
				selectionIndex = parms[0].ToInteger();
			}

			if ( selectionIndex != listWidget->GetFocusIndex() ) {
				listWidget->SetViewIndex( listWidget->GetViewOffset() + selectionIndex );
				listWidget->SetFocusIndex( selectionIndex );
				return true;
			}

			int index = listWidget->GetServerIndex();
			if ( index != -1 ) {
				session->ConnectToServer( index );
			}
			return true;
		}
	}

	return idMenuScreen::HandleAction( action, event, widget, forceHandle );
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:62,代码来源:MenuScreen_Shell_Browser.cpp

示例4: HandleAction

/*
========================
idMenuScreen_Shell_Playstation::HandleAction h
========================
*/
bool idMenuScreen_Shell_Playstation::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_PLAYSTATION )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( options->GetFocusIndex() != selectionIndex )
			{
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}
			
			if( selectionIndex == 0 )
			{
			
			
			}
			else if( selectionIndex == 1 )
			{
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:62,代码来源:MenuScreen_Shell_Playstation.cpp

示例5: switch

/*
================================================
idMenuHandler::Update
================================================
*/
bool idMenuHandler::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_ADJUST_FIELD: {
			if ( widget != NULL && widget->GetDataSource() != NULL ) {
				widget->GetDataSource()->AdjustField( widget->GetDataSourceFieldIndex(), parms[ 0 ].ToInteger() );
				widget->Update();
			}
			return true;
		}
		case WIDGET_ACTION_FUNCTION: {
			if ( verify( action.GetScriptFunction() != NULL ) ) {
				action.GetScriptFunction()->Call( event.thisObject, event.parms );
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			idMenuScreen * const screen = menuScreens[ activeScreen ];
			if ( screen != NULL ) {
				idWidgetEvent pressEvent( WIDGET_EVENT_PRESS, 0, event.thisObject, idSWFParmList() );
				screen->ReceiveEvent( pressEvent );
			}
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() >= 2 );
			int repeatDelay = DEFAULT_REPEAT_TIME;
			if ( parms.Num() >= 3 ) {
				repeatDelay = parms[2].ToInteger();
			} 
			repeatAction.Set( repeatActionType, parms[ 1 ], repeatDelay );
			StartWidgetActionRepeater( widget, repeatAction, event );
			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER: {
			ClearWidgetActionRepeater();
			return true;
		}
	}

	if ( !widget->GetHandlerIsParent() ) {
		for ( int index = 0; index < children.Num(); ++index ) {
			if ( children[index] != NULL ) {
				if ( children[index]->HandleAction( action, event, widget, forceHandled ) ) {
					return true;
				}
			}
		}
	}

	return false;
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:62,代码来源:MenuHandler.cpp

示例6: HandleAction

/*
========================
idMenuScreen_Shell_Settings::HandleAction h
========================
*/
bool idMenuScreen_Shell_Settings::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_SETTINGS ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_COMMAND: {
			switch ( parms[0].ToInteger() ) {
				case SETTING_CMD_CONTROLS: {
					menuData->SetNextScreen( SHELL_AREA_CONTROLS, MENU_TRANSITION_SIMPLE );
					break;	
				}
				case SETTING_CMD_GAMEPLAY: {
					menuData->SetNextScreen( SHELL_AREA_GAME_OPTIONS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case SETTING_CMD_SYSTEM: {
					menuData->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case SETTING_CMD_3D: {
					menuData->SetNextScreen( SHELL_AREA_STEREOSCOPICS, MENU_TRANSITION_SIMPLE );
					break;
				}
			}

			if ( options != NULL ) {
				int selectionIndex = options->GetViewIndex();
				if ( parms.Num() == 1 ) {
					selectionIndex = parms[0].ToInteger();
				}	

				if ( options->GetFocusIndex() != selectionIndex ) {
					options->SetFocusIndex( selectionIndex );
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				}
			}

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:61,代码来源:MenuScreen_Shell_Settings.cpp

示例7: HandleAction

/*
========================
idMenuScreen_Shell_NewGame::HandleAction h
========================
*/
bool idMenuScreen_Shell_NewGame::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData != NULL )
	{
		if( menuData->ActiveScreen() != SHELL_AREA_NEW_GAME )
		{
			return false;
		}
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			if( menuData != NULL )
			{
				menuData->SetNextScreen( SHELL_AREA_CAMPAIGN, MENU_TRANSITION_SIMPLE );
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			idMenuHandler_Shell* shell = dynamic_cast< idMenuHandler_Shell* >( menuData );
			if( shell != NULL )
			{
				shell->SetNewGameType( selectionIndex );
				menuData->SetNextScreen( SHELL_AREA_DIFFICULTY, MENU_TRANSITION_SIMPLE );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:61,代码来源:MenuScreen_Shell_NewGame.cpp

示例8: HandleAction

/*
========================
idMenuScreen_Shell_Dev::HandleAction h
========================
*/
bool idMenuScreen_Shell_Dev::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_DEV )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( options->GetFocusIndex() != selectionIndex - options->GetViewOffset() )
			{
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}
			
			int mapIndex = options->GetViewIndex();
			if( ( mapIndex < devOptions.Num() ) && ( devOptions[ mapIndex ].map != NULL ) )
			{
				cmdSystem->AppendCommandText( va( "devmap %s\n", devOptions[ mapIndex ].map ) );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:59,代码来源:MenuScreen_Shell_Dev.cpp

示例9: switch

/*
========================
idMenuScreen_PDA_VideoDisks::HandleAction
========================
*/
bool idMenuScreen_PDA_VideoDisks::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != PDA_AREA_VIDEO_DISKS )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() == 2 );
			repeatAction.Set( repeatActionType, parms[ 1 ] );
			if( menuData != NULL )
			{
				menuData->StartWidgetActionRepeater( widget, repeatAction, event );
			}
			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER:
		{
			if( menuData != NULL )
			{
				menuData->ClearWidgetActionRepeater();
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			ToggleVideoDiskPlay();
			Update();
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:58,代码来源:MenuScreen_PDA_VideoDisks.cpp

示例10: HandleAction

/*
========================
idMenuWidget_InfoBox::ObserveEvent
========================
*/
bool idMenuWidget_InfoBox::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	const idSWFParmList & parms = action.GetParms();

	if ( action.GetType() == WIDGET_ACTION_SCROLL_VERTICAL ) {
		const scrollType_t scrollType = static_cast< scrollType_t >( event.arg );
		if ( scrollType == SCROLL_SINGLE ) {
			Scroll( parms[ 0 ].ToInteger() );
		}
		return true;
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:19,代码来源:MenuWidget_InfoBox.cpp

示例11: HandleAction

/*
========================
idMenuWidget_ScrollBar::HandleAction
========================
*/
bool idMenuWidget_ScrollBar::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	widgetAction_t actionType = action.GetType();

	switch ( actionType ) {
		case WIDGET_ACTION_SCROLL_DRAG: {

			if ( event.parms.Num() != 3 ) {
				return true;
			}

			dragging = true;

			float x = event.parms[0].ToFloat();
			float y = event.parms[1].ToFloat();
			bool initial = event.parms[2].ToBool();
			if ( initial ) {
				CalcTopAndBottom();
			}

			CalculatePosition( x, y );
			return true;
		}
		case WIDGET_ACTION_EVENT_DRAG_STOP: {
			dragging = false;
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:36,代码来源:MenuWidget_Scrollbar.cpp

示例12: HandleAction

/*
========================
idMenuScreen_Shell_Singleplayer::HandleAction
========================
*/
bool idMenuScreen_Shell_Singleplayer::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_CAMPAIGN ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( options == NULL ) {
				return true;
			}

			int selectionIndex = options->GetViewIndex();
			if ( parms.Num() == 1 ) {
				selectionIndex = parms[0].ToInteger();
			}			

			canContinue = false;
			const saveGameDetailsList_t & saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames();
			canContinue = ( saveGameInfo.Num() > 0 );
			if ( canContinue ) {
				if ( selectionIndex == 0 ) {
					ContinueGame();

				} else if ( selectionIndex == 1 ) {
					class idSWFScriptFunction_NewGame : public idSWFScriptFunction_RefCounted {
					public:
						idSWFScriptFunction_NewGame( idMenuHandler * _menuData, bool _accept ) {
							menuData = _menuData;
							accept = _accept;
						}
						idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
							common->Dialog().ClearDialog( GDM_DELETE_AUTOSAVE );
							if ( accept ) {
								menuData->SetNextScreen( SHELL_AREA_NEW_GAME, MENU_TRANSITION_SIMPLE );
							}
							return idSWFScriptVar();
						}
					private:
						idMenuHandler * menuData;
						bool accept;
					};
					common->Dialog().AddDialog( GDM_DELETE_AUTOSAVE, DIALOG_ACCEPT_CANCEL, new idSWFScriptFunction_NewGame( menuData, true ), new idSWFScriptFunction_NewGame( menuData, false ), true );
				} else if ( selectionIndex == 2 ) {
					menuData->SetNextScreen( SHELL_AREA_LOAD, MENU_TRANSITION_SIMPLE );
				}
			} else {
				if ( selectionIndex == 0 ) {
					menuData->SetNextScreen( SHELL_AREA_NEW_GAME, MENU_TRANSITION_SIMPLE );
				} else if ( selectionIndex == 1 ) {
					menuData->SetNextScreen( SHELL_AREA_LOAD, MENU_TRANSITION_SIMPLE );
				}	
			}
			
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:76,代码来源:MenuScreen_Shell_Singleplayer.cpp

示例13: HandleAction

/*
========================
idMenuScreen_Shell_Save::HandleAction
========================
*/
bool idMenuScreen_Shell_Save::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_SAVE )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_JOY4_ON_PRESS:
		{
			return true;
		}
		case WIDGET_ACTION_JOY3_ON_PRESS:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			DeleteGame( options->GetViewIndex() );
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			if( session->GetSaveGameManager().IsWorking() )
			{
				return true;
			}
			
			if( parms.Num() == 1 )
			{
				int selectionIndex = parms[0].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
					return true;
				}
			}
			
			SaveGame( options->GetViewIndex() );
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL:
		{
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:77,代码来源:MenuScreen_Shell_Save.cpp

示例14: switch

/*
========================
idMenuScreen_PDA_Inventory::HandleAction
========================
*/
bool idMenuScreen_PDA_Inventory::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != PDA_AREA_INVENTORY ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_JOY3_ON_PRESS: {
			EquipWeapon();
			return true;
		}
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() == 2 );
			repeatAction.Set( repeatActionType, parms[ 1 ] );
			menuData->StartWidgetActionRepeater( widget, repeatAction, event );
			return true;
		}
		case WIDGET_ACTION_SELECT_PDA_ITEM: {

			if ( itemList.GetMoveDiff() > 0 ) {
				itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
			}

			int index = parms[0].ToInteger();
			if ( index != 0 ) {
				itemList.MoveToIndex( index );
				Update();
			}

			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER: {
			menuData->ClearWidgetActionRepeater();
			return true;
		}
		case WIDGET_ACTION_SCROLL_HORIZONTAL: {
			
			if ( itemList.GetTotalNumberOfOptions() <= 1 ) {
				return true;
			}

			if ( itemList.GetMoveDiff() > 0 ) {
				itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
			}

			int direction = parms[0].ToInteger();
			if ( direction == 1 ) {					
				if ( itemList.GetViewIndex() == itemList.GetTotalNumberOfOptions() - 1 ) {
					return true;
				} else {
					itemList.MoveToIndex( 1 );
				}
			} else {
				if ( itemList.GetViewIndex() == 0 ) {
					return true;
				} else {
					itemList.MoveToIndex( ( itemList.GetNumVisibleOptions() / 2 ) + 1 );
				}
			}	
			Update();

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:85,代码来源:MenuScreen_PDA_Inventory.cpp

示例15: HandleAction

/*
========================
idMenuScreen_PDA_UserEmails::HandleAction
========================
*/
bool idMenuScreen_PDA_UserEmails::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != PDA_AREA_USER_EMAIL )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_PDA_CLOSE:
		{
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			if( readingEmails )
			{
				ShowEmail( false );
			}
			else
			{
				menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			}
			return true;
		}
		case WIDGET_ACTION_REFRESH:
		{
			UpdateEmail();
			return true;
		}
		case WIDGET_ACTION_PDA_SELECT_EMAIL:
		{
		
			if( widget->GetParent() != NULL )
			{
				idMenuWidget_DynamicList* emailList = dynamic_cast< idMenuWidget_DynamicList* >( widget->GetParent() );
				int index = parms[0].ToInteger();
				if( emailList != NULL )
				{
					emailList->SetViewIndex( emailList->GetViewOffset() + index );
					emailList->SetFocusIndex( index );
				}
			}
			
			ShowEmail( true );
			
			return true;
		}
		case WIDGET_ACTION_EMAIL_HOVER:
		{
			scrollEmailInfo = parms[0].ToBool();
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL:
		{
			if( ScrollCorrectList( action, event, widget ) )
			{
				return true;
			}
			UpdateEmail();
			break;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:81,代码来源:MenuScreen_PDA_UserEmails.cpp


注:本文中的idWidgetAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。