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

📄 dirscraccview2.cpp

📁 symbian平台上如何在屏幕上快速的显示图片
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CDirScrAccView2 from DirScrAccView2.h
*  Part of  : DirScrAcc
*  Created  : 20.11.2002 by Forum Nokia
*  Implementation notes:
*        This class defines the view 2, which demonstrates full screen Direct Screen Access with Graphics Context. 
*        Initial content was generated by Nokia Series 60 AppWizard.
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <DirScrAcc.rsg>
#include  "DirScrAccView2.h"
#include  "DirScrAccContainer2.h" 
#include  "dirscracc.hrh"


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

// ---------------------------------------------------------
// CDirScrAccView2::ConstructL(const TRect& aRect)
// Symbiantwo-phased constructor
// ---------------------------------------------------------
//
void CDirScrAccView2::ConstructL()
    {
    BaseConstructL( R_DIRSCRACC_VIEW2 );
    }

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

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CDirScrAccView2::Id()
// This returns the view ID
// ---------------------------------------------------------
//
TUid CDirScrAccView2::Id() const
    {
    return KView2Id;
    }

// ---------------------------------------------------------
// CDirScrAccView2::HandleCommandL(TInt aCommand)
// Here we handle commands for this view. 
// Each view has their own HandleCommandL()
// ---------------------------------------------------------
//
void CDirScrAccView2::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {        
        case EAknSoftkeyBack:
            {
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
            }
        case EDirScrAccCmdView2Cmd1:
            {   
            if(!iContainer->IsDrawing())
                iContainer->StartDrawingL();
          
            break;
            }
        case EDirScrAccCmdView2Cmd2:
            {
            if(iContainer->IsDrawing())
               iContainer->StopDrawing();
           break;            
            }
        case EDirScrAccCmdView2Cmd3:
            {   
            AppUi()->ActivateLocalViewL(TUid::Uid(1));
            break;
            }
        case EDirScrAccCmdView2Cmd4:
            {
            AppUi()->ActivateLocalViewL(TUid::Uid(3));
            break;
            }
            
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

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

// ---------------------------------------------------------
// CDirScrAccView2::DoActivateL(...)
// This is called when a view needs to be activated. 
// This creates container with its controls.
// ---------------------------------------------------------
//
void CDirScrAccView2::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
   
    // Create Container
    if (!iContainer)
        {
        iContainer = new (ELeave) CDirScrAccContainer2;
        iContainer->SetMopParent(this);
        // use the applicationrect (fullscreen) for drawing
        iContainer->ConstructL( AppUi()->ApplicationRect() );
        AppUi()->AddToStackL( *this, iContainer );
        }    
   }

// ---------------------------------------------------------
// CDirScrAccView2::HandleCommandL(TInt aCommand)
// This is called when a view needs to be deactivated. 
// This destroys container with its controls.
// ---------------------------------------------------------
//
void CDirScrAccView2::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }

// End of File

⌨️ 快捷键说明

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