コード例 #1
0
int	OptionsXScreen::handleMessage( unsigned long message, unsigned long who)
{
	if ( aMSG_LEFTMOUSEDOWN == message )
	{
		switch ( who )
		{

		case MSB_TAB0:
		case MSB_TAB1:
		case MSB_TAB2:
		case MSB_TAB3:
		{
			for ( int i = MSB_TAB0; i < MSB_TAB3+1; i++ )
				getButton( i )->press( 0 );
			getButton( who )->press( true );
			curTab = who - MSB_TAB0;
		}
			break;

		case YES:
			{
				int oldRes = prefs.resolution;
				int oldDepth = prefs.bitDepth;
				for ( int i = 0; i < 4; i++ )
					tabAreas[i]->end();

				prefs.save();
				prefs.applyPrefs(0);
				LoadScreenWrapper::changeRes();

				int newRes = prefs.resolution;
				int newDepth = prefs.bitDepth;

				if ( newRes != oldRes || newDepth != oldDepth )
				{
					LogisticsOneButtonDialog::instance()->setText( IDS_SWAP_RESOLUTION_WARNING, IDS_DIALOG_OK, IDS_DIALOG_OK );
					LogisticsOneButtonDialog::instance()->begin();
					bShowWarning = true;
				}
				else
					bDone = true;

				return 1;
			}
			break;
		case NO:
			{
				(dynamic_cast<OptionsGamePlay *>(tabAreas[2]))->resetCamera();
				prefs.load();
				prefs.applyPrefs(0);
				bDone = true;
				return 1;
			}
			break;

		}
	}

	return 0;

}