⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorlinezuitwplayview.cpp

📁 使用CarbideC++编程工具
💻 CPP
字号:
/*
========================================================================
 Name        : ColorLinezUITwPlayView.cpp
 Author      : 
 Copyright   : 
 Description : 
========================================================================
*/
// [[[ begin generated region: do not modify [Generated System Includes]
#include <aknviewappui.h>
#include <eikmenub.h>
#include <avkon.hrh>
#include <barsread.h>
#include <eikimage.h>
#include <eikenv.h>
#include <akncontext.h>
#include <akntitle.h>
#include <stringloader.h>
#include <eikbtgpc.h>
#include <ColorLinezUITwo.rsg>
// ]]] end generated region [Generated System Includes]

// [[[ begin generated region: do not modify [Generated User Includes]

#include "ColorLinezUITwo.hrh"
#include "ColorLinezUITwPlayView.h"
#include "ColorLinezUITwoInitial.hrh"
#include "ColorLinezUITwPlay.hrh"
#include "ColorLinezUITwPlay.h"
// ]]] end generated region [Generated User Includes]

// [[[ begin generated region: do not modify [Generated Constants]
// ]]] end generated region [Generated Constants]

/**
 * First phase of Symbian two-phase construction. Should not contain any
 * code that could leave.
 */
CColorLinezUITwPlayView::CColorLinezUITwPlayView(CColorLinezUITwoModel& aModel)
												:iModel(aModel)
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	// ]]] end generated region [Generated Contents]
	iColorLinezUITwPlay = NULL;
	}

/** 
 * The view's destructor removes the container from the control
 * stack and destroys it.
 */
CColorLinezUITwPlayView::~CColorLinezUITwPlayView()
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	delete iColorLinezUITwPlay;
	iColorLinezUITwPlay = NULL;
	// ]]] end generated region [Generated Contents]
	
	}

/**
 * Symbian two-phase constructor.
 * This creates an instance then calls the second-phase constructor
 * without leaving the instance on the cleanup stack.
 * @return new instance of CColorLinezUITwPlayView
 */
CColorLinezUITwPlayView* CColorLinezUITwPlayView::NewL(CColorLinezUITwoModel& aModel)
	{
	CColorLinezUITwPlayView* self = CColorLinezUITwPlayView::NewLC(aModel);
	CleanupStack::Pop( self );
	return self;
	}

/**
 * Symbian two-phase constructor.
 * This creates an instance, pushes it on the cleanup stack,
 * then calls the second-phase constructor.
 * @return new instance of CColorLinezUITwPlayView
 */
CColorLinezUITwPlayView* CColorLinezUITwPlayView::NewLC(CColorLinezUITwoModel& aModel)
	{
	CColorLinezUITwPlayView* self = new ( ELeave ) CColorLinezUITwPlayView(aModel);
	CleanupStack::PushL( self );
	self->ConstructL();
	return self;
	}


/**
 * Second-phase constructor for view.  
 * Initialize contents from resource.
 */ 
void CColorLinezUITwPlayView::ConstructL()
	{
	// [[[ begin generated region: do not modify [Generated Code]
	BaseConstructL( R_COLOR_LINEZUITW_PLAY_COLOR_LINEZUITW_PLAY_VIEW );
				
	// ]]] end generated region [Generated Code]
	
	// add your own initialization code here
	
	}

/**
 * @return The UID for this view
 */
TUid CColorLinezUITwPlayView::Id() const
	{
	return TUid::Uid( EColorLinezUITwPlayViewId );
	}

/**
 * Handle a command for this view (override)
 * @param aCommand command id to be handled
 */
void CColorLinezUITwPlayView::HandleCommandL( TInt aCommand )
	{
	// [[[ begin generated region: do not modify [Generated Code]
	TBool commandHandled = EFalse;
	switch ( aCommand )
		{	// code to dispatch to the AknView's menu and CBA commands is generated here
	
		case EAknSoftkeyBack:
			commandHandled = HandleControlPaneRightSoftKeyPressedL( aCommand );
			break;
		case EColorLinezUITwPlayViewRestart_GameMenuItemCommand:
			commandHandled = HandleRestart_GameMenuItemSelectedL( aCommand );
			break;
		default:
			break;
		}
	
		
	if ( !commandHandled ) 
		{
	
		if ( aCommand == EAknSoftkeyBack )
			{
			AppUi()->HandleCommandL( EEikCmdExit );
			}
	
		}
	// ]]] end generated region [Generated Code]
	
	}

/**
 *	Handles user actions during activation of the view, 
 *	such as initializing the content.
 */
void CColorLinezUITwPlayView::DoActivateL( 
		const TVwsViewId& /*aPrevViewId*/,
		TUid /*aCustomMessageId*/,
		const TDesC8& /*aCustomMessage*/ )
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	SetupStatusPaneL();
	
				
	if ( iColorLinezUITwPlay == NULL )
		{
		iColorLinezUITwPlay = CreateContainerL();
		iColorLinezUITwPlay->SetMopParent( this );
	//	iColorLinezUITwPlay->ThreeColorBallsRandom();
		AppUi()->AddToStackL( *this, iColorLinezUITwPlay );
		} 
	// ]]] end generated region [Generated Contents]
	
	}

/**
 */
void CColorLinezUITwPlayView::DoDeactivate()
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	CleanupStatusPane();
	
	if ( iColorLinezUITwPlay != NULL )
		{
		AppUi()->RemoveFromViewStack( *this, iColorLinezUITwPlay );
		delete iColorLinezUITwPlay;
		iColorLinezUITwPlay = NULL;
		}
	// ]]] end generated region [Generated Contents]
	
	}

/** 
 * Handle status pane size change for this view (override)
 */
void CColorLinezUITwPlayView::HandleStatusPaneSizeChange()
	{
	CAknView::HandleStatusPaneSizeChange();
	
	// this may fail, but we're not able to propagate exceptions here
	TInt result;
	TRAP( result, SetupStatusPaneL() ); 
	
	// [[[ begin generated region: do not modify [Generated Code]
	// ]]] end generated region [Generated Code]
	
	}

// [[[ begin generated function: do not modify
void CColorLinezUITwPlayView::SetupStatusPaneL()
	{
	// reset the context pane
	TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
	CEikStatusPaneBase::TPaneCapabilities subPaneContext = 
		StatusPane()->PaneCapabilities( contextPaneUid );
	if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
		{
		CAknContextPane* context = static_cast< CAknContextPane* > ( 
			StatusPane()->ControlL( contextPaneUid ) );
		context->SetPictureToDefaultL();
		}
	
	// setup the title pane
	TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
	CEikStatusPaneBase::TPaneCapabilities subPaneTitle = 
		StatusPane()->PaneCapabilities( titlePaneUid );
	if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
		{
		CAknTitlePane* title = static_cast< CAknTitlePane* >( 
			StatusPane()->ControlL( titlePaneUid ) );
		TResourceReader reader;
		iEikonEnv->CreateResourceReaderLC( reader, R_COLOR_LINEZUITW_PLAY_TITLE_RESOURCE );
		title->SetFromResourceL( reader );
		CleanupStack::PopAndDestroy(); // reader internal state
		}
				
	}

// ]]] end generated function

// [[[ begin generated function: do not modify
void CColorLinezUITwPlayView::CleanupStatusPane()
	{
	}

// ]]] end generated function

/**
 *	Creates the top-level container for the view.  You may modify this method's
 *	contents and the CColorLinezUITwPlay::NewL() signature as needed to initialize the
 *	container, but the signature for this method is fixed.
 *	@return new initialized instance of CColorLinezUITwPlay
 */
CColorLinezUITwPlay* CColorLinezUITwPlayView::CreateContainerL()
	{
	return CColorLinezUITwPlay::NewL( ClientRect(), NULL, this,iModel );
	}

/** 
 * Handle the rightSoftKeyPressed event.
 * @return ETrue if the command was handled, EFalse if not
 */
TBool CColorLinezUITwPlayView::HandleControlPaneRightSoftKeyPressedL( TInt aCommand )
	{
	// TODO: implement rightSoftKeyPressed event handler
	AppUi()->ActivateLocalViewL(TUid::Uid(EColorLinezUITwoInitialViewId));
	return ETrue;
	}
				
/** 
 * Handle the selected event.
 * @param aCommand the command id invoked
 * @return ETrue if the command was handled, EFalse if not
 */
TBool CColorLinezUITwPlayView::HandleRestart_GameMenuItemSelectedL( TInt aCommand )
	{
	// TODO: implement selected event handler
	iColorLinezUITwPlay->DrawNow();
	iColorLinezUITwPlay->ResumePos();	
	return ETrue;
	}
				

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -