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

📄 aknexeditorview.cpp

📁 国内著名嵌入式培训机构内部资料,内含一些实例代码,包括技术专题书籍
💻 CPP
字号:
/*
* ==============================================================================
*  Name        : aknexeditorview.cpp
*  Part of     : Editor example
*  Interface   :
*  Description :
*  Version     :
*
*  Copyright (c) 2004 - 2006 Nokia Corporation.
*  This material, including documentation and any related
*  computer programs, is protected by copyright controlled by
*  Nokia Corporation.
* ==============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>

#include <AknExEditor.rsg>
#include "AknExEditor.hrh"
#include "AknExEditorView.h"
#include "AknExEditorContainer.h"

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

// ----------------------------------------------------------------------------
// CAknExEditorView::CAknExEditorView()
// C++ default constructor can NOT contain any code, that
// might leave.
//-----------------------------------------------------------------------------
//
CAknExEditorView::CAknExEditorView()
    {
    }

// ----------------------------------------------------------------------------
// CAknExEditorView::ConstructL()
// Symbian default constructor can leave.
//-----------------------------------------------------------------------------
//
void CAknExEditorView::ConstructL()
    {
    BaseConstructL( R_AKNEXEDITOR_VIEW );
    }

// ----------------------------------------------------------------------------
// CAknExEditorView::~CAknExEditorView()
// Destructor
//-----------------------------------------------------------------------------
//
CAknExEditorView::~CAknExEditorView()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromStack( iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CAknExEditorView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CAknExEditorView::Id() const
    {
    return KViewId;
    }

// ---------------------------------------------------------
// CAknExEditorView::HandleCommandL( TInt aCommand )
// Handles commands
// ---------------------------------------------------------
void CAknExEditorView::HandleCommandL( TInt aCommand )
    {   
    switch ( aCommand )
        {
        
        case EAknExEditorClearText:
            iContainer->ClearTextL();
            break;

        case EAknExEditorCmdLatinBold13:
            iContainer->SetSystemFontL( ELatinBold13 );
            break;
        case EAknExEditorCmdLatinBold17:
            iContainer->SetSystemFontL( ELatinBold17 );
            break;
        case EAknExEditorCmdLatinBold19:
            iContainer->SetSystemFontL( ELatinBold19 );
            break;

        case EAknExEditorSelectText:
        case EAknExEditorClearSelection:
        case EAknExEditorCut:
        case EAknExEditorCopy:
        case EAknExEditorPaste:
            iContainer->TestSelectedCase( aCommand );
            break;
            
        case EAknExEditorScrollUp:
        case EAknExEditorScrollDown:
            iContainer->ScrollTextL( aCommand );
            break;
    
        case EAknExEditorSaveToFile:
            iContainer->SaveToFileL();
            break;
    
        case EAknExEditorOpenFile:
            iContainer->OpenFileL();
            break;

        default:
            AppUi()->HandleCommandL( aCommand );
            break;
        }
    }

// ---------------------------------------------------------
// CAknExEditorView::HandleViewRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CAknExEditorView::HandleViewRectChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// ---------------------------------------------------------
// CAknExEditorView::DoActivateL()
// Creates the Container class object.
// ---------------------------------------------------------
void CAknExEditorView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
                                     TUid /*aCustomMessageId*/,
                                     const TDesC8& /*aCustomMessage*/ )
    {
    iContainer = new ( ELeave ) CAknExEditorContainer;
    iContainer->SetMopParent( this );
    iContainer->ConstructL( ClientRect() );
    AppUi()->AddToStackL( *this, iContainer );
    }

// ---------------------------------------------------------
// CAknExEditorView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CAknExEditorView::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromStack( iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }

// End of File

⌨️ 快捷键说明

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