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

📄 helloworld2view2.cpp

📁 《基于symbian手机开发与应用》一书的源代码
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CHelloWorld2View2 from HelloWorld2View2.h
*  Part of  : HelloWorld2
*  Created  : 2006-3-14 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <HelloWorld2.rsg>
#include  "HelloWorld2View2.h"
#include  "HelloWorld2Container2.h" 

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CHelloWorld2View2::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CHelloWorld2View2::ConstructL()
    {
    BaseConstructL( R_HELLOWORLD2_VIEW2 );
    }

// ---------------------------------------------------------
// CHelloWorld2View2::~CHelloWorld2View2()
// destructor
// ---------------------------------------------------------
//
CHelloWorld2View2::~CHelloWorld2View2()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CHelloWorld2View2::Id()
// 
// ---------------------------------------------------------
//
TUid CHelloWorld2View2::Id() const
    {
    return KView2Id;
    }

// ---------------------------------------------------------
// CHelloWorld2View2::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CHelloWorld2View2::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {
        case EAknSoftkeyOk:
            {
            iEikonEnv->InfoMsg( _L("view2 ok") );
            break;
            }
        case EAknSoftkeyBack:
            {
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
            }
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

// ---------------------------------------------------------
// CHelloWorld2View2::HandleClientRectChange()
// ---------------------------------------------------------
//
void CHelloWorld2View2::HandleClientRectChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// ---------------------------------------------------------
// CHelloWorld2View2::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CHelloWorld2View2::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CHelloWorld2Container2;
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        }
   }

// ---------------------------------------------------------
// CHelloWorld2View2::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CHelloWorld2View2::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }

// End of File

⌨️ 快捷键说明

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