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

📄 imagecapturerappui.cpp

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CImageCapturerAppUi from ImageCapturerAppui.cpp
*  Part of  : ImageCapturer
*  Created  : 02.02.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include "ImageCapturerAppui.h"
#include "ImageCapturerContainer.h" 
#include <ImageCapturer.rsg>
#include "ImageCapturer.hrh"

#include <avkon.hrh>

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CImageCapturerAppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void CImageCapturerAppUi::ConstructL()
    {
    BaseConstructL();

    iAppContainer = new (ELeave) CImageCapturerContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );

    iImageCapturerEngine = CImageCapturerEngine::NewL(*this);

    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// CImageCapturerAppUi::~CImageCapturerAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CImageCapturerAppUi::~CImageCapturerAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
    delete iImageCapturerEngine;
    }

// from CCameraWrapper::MObserver
void CImageCapturerAppUi::OnFrame(const CFbsBitmap& aFrame)
    {
    iAppContainer->DrawFrame(aFrame);
    }

void CImageCapturerAppUi::OnImage(CFbsBitmap* aBitmap)
    {
    _LIT(KMbmBitmapFace, "c:\\image.mbm");
    aBitmap->Save(KMbmBitmapFace);
    delete aBitmap; // must delete it
    TRAPD(err, iImageCapturerEngine->StartViewFinderL());
    }

void CImageCapturerAppUi::OnError(TInt/* aError*/)
    {
    }

// ----------------------------------------------------
// CImageCapturerAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CImageCapturerAppUi::HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    if(aType == EEventKey)
        {
        if(aKeyEvent.iScanCode == EStdKeyDevice3) // OK button
            {   // equals to press "Start"
            CaptureImageL();
            }
        }
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CImageCapturerAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CImageCapturerAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case EImageCapturerCmdCapture:
            {
            CaptureImageL();
            break;
            }
        default:
            break;      
        }
    }


void CImageCapturerAppUi::CaptureImageL()
    {
    iImageCapturerEngine->StopViewFinder();
    iImageCapturerEngine->CaptureImage();
    }

// End of File  

⌨️ 快捷键说明

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