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

📄 sttspanesappui.cpp

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

// INCLUDE FILES
#include "SttsPanesAppui.h"
#include "SttsPanesTitleView.h"
#include "SttsPanesContextView.h"
#include "SttsPanesNavigationView.h"
#include <akntabgrp.h> 
#include <SttsPanes.rsg>
#include "SttsPanes.hrh"

#include <avkon.hrh>

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


    // Show tabs for main views from resources
    CEikStatusPane* sp = StatusPane();

    // Fetch pointer to the default navi pane control
    iNaviPane = (CAknNavigationControlContainer*)sp->ControlL( 
        TUid::Uid(EEikStatusPaneUidNavi));

    CSttsPanesTitleView* view1 = new (ELeave) CSttsPanesTitleView;
    CleanupStack::PushL( view1 );
    view1->ConstructL();
    AddViewL( view1 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view1

    CSttsPanesContextView* view2 = new (ELeave) CSttsPanesContextView;
    CleanupStack::PushL( view2 );
    view2->ConstructL();
    AddViewL( view2 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view2

    CSttsPanesNavigationView* view3 = new (ELeave) CSttsPanesNavigationView;
    CleanupStack::PushL( view3 );
    view3->ConstructL();
    AddViewL( view3 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view3

    SetDefaultViewL(*view1);
    }

// ----------------------------------------------------
// CSttsPanesAppUi::~CSttsPanesAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CSttsPanesAppUi::~CSttsPanesAppUi()
    {
    }

// ------------------------------------------------------------------------------
// CSttsPanesAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void CSttsPanesAppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// CSttsPanesAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CSttsPanesAppUi::HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow )
        {
        CAknNavigationDecorator* curDecorator = iNaviPane->Top();        
        if (curDecorator)
            {
            CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>
                                ( curDecorator->DecoratedControl() );
            if (tabGroup)
                {
                return tabGroup->OfferKeyEventL( aKeyEvent, aType );
                }
            else{
                return EKeyWasNotConsumed;
                }            
            }
        }
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CSttsPanesAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CSttsPanesAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case ESttsPanesCmdAppTitleView:
            ActivateLocalViewL(TUid::Uid( ESttsPanesTitleViewId ));
            break;
        case ESttsPanesCmdAppContextView:
            ActivateLocalViewL(TUid::Uid( ESttsPanesContextViewId ));
            break;
        case ESttsPanesCmdAppNavigationView:
            ActivateLocalViewL(TUid::Uid( ESttsPanesNavigationViewId ));
            break;
        // TODO: Add Your command handling code here

        default:
            break;      
        }
    }

// End of File  

⌨️ 快捷键说明

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