S60UIExampleInitialView.cpp
上传用户:laixiong
上传日期:2007-03-11
资源大小:2994k
文件大小:5k
源码类别:
Symbian
开发平台:
C/C++
- // Copyright (c) 2006 Nokia Corporation.
- #include "S60UIExampleInitialView.h"
- #include "S60UIExampleInitialContainer.h"
- #include "S60UIExampleModel.h"
- #include "S60UIExample.hrh"
- #include <aknviewappui.h>
- #include <S60UIExample.rsg>
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::CS60UIExampleInitialView()
- // C++ default constructor can NOT contain any code, that might leave.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleInitialView::CS60UIExampleInitialView(CS60UIExampleModel& aModel)
- :iModel(aModel)
- {
- // No implementation required
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::NewL()
- // Two-phased constructor.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleInitialView* CS60UIExampleInitialView::NewL(
- CS60UIExampleModel& aModel)
- {
- CS60UIExampleInitialView* self = CS60UIExampleInitialView::NewLC(aModel);
- CleanupStack::Pop(self);
- return self;
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::NewLC()
- // Two-phased constructor.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleInitialView* CS60UIExampleInitialView::NewLC(
- CS60UIExampleModel& aModel)
- {
- CS60UIExampleInitialView* self =
- new (ELeave) CS60UIExampleInitialView(aModel);
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::ConstructL()
- // Symbian 2nd phase constructor can leave.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleInitialView::ConstructL()
- {
- BaseConstructL(R_S60UIEXAMPLE_INITIALVIEW);
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::~CS60UIExampleInitialView()
- // Destructor.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleInitialView::~CS60UIExampleInitialView()
- {
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::Id()
- // Returns View's ID.
- // -----------------------------------------------------------------------------
- //
- TUid CS60UIExampleInitialView::Id() const
- {
- return TUid::Uid(ES60UIExampleInitialViewId);
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::DoActivateL()
- // Activate an InitialView
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleInitialView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
- TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/)
- {
- iContainer = CS60UIExampleInitialContainer::NewL(ClientRect(), iModel);
- AppUi()->AddToViewStackL(*this, iContainer);
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::DoDeactivate()
- // DeActivate an InitialView
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleInitialView::DoDeactivate()
- {
- if (iContainer)
- {
- // Remove InitialView's container from control Stack
- AppUi()->RemoveFromViewStack(*this, iContainer);
- delete iContainer;
- iContainer = NULL;
- }
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleInitialView::HandleCommandL()
- // Takes care of Command handling.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleInitialView::HandleCommandL(TInt aCommand)
- {
- switch (aCommand)
- {
- case ES60UIExampleStartGame:
- {
- iModel.GameStart();
- // Switch to game view
- break;
- }
- case ES60UIExampleContinueGame:
- {
- iModel.GameContinue();
- // Switch to Game view
- break;
- }
- default:
- // Pass any other commands to the AppUi
- AppUi()->HandleCommandL(aCommand);
- }
- }
- // End of File