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

📄 sysinfo60appui.cpp

📁 基于SYMBIAN OS 的Moblile硬件管理器. 支持series 70平台
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSYSINFO60AppUi from SYSINFO60AppUi.cpp
*  Part of  : SYSINFO60
*  Created  : 10.05.2003 by Petri-Veikko Alaj鋜vi OH1GIU
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: (c) 2003, Petri-Veikko Alaj鋜vi OH1GIU
* ============================================================================
*/

// INCLUDE FILES
#include "SYSINFO60AppUi.h"
#include "SYSINFO60View.h"
#include "SYSINFO60View2.h"
#include "SYSINFO60View3.h"
#include "SYSINFO60View4.h"
#include <SYSINFO60.rsg>
#include "sysinfo60.hrh"
#include "GenFuncs.h"

#include <avkon.hrh>
#include <akntitle.h>
#include <eikspane.h>

using namespace NGenFuncs;

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CSYSINFO60AppUi::ConstructL()
// ?implementation_description
// ----------------------------------------------------------
//
void CSYSINFO60AppUi::ConstructL()
    {
    BaseConstructL();

    // Show tabs for main views from resources
    CEikStatusPane* sp = StatusPane();
	CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
	tp->SetTextL(KSystem);

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

    // Tabgroup has been read from resource and it were pushed to the navi pane. 
    // Get pointer to the navigation decorator with the ResourceDecorator() function. 
    // Application owns the decorator and it has responsibility to delete the object.
    iDecoratedTabGroup = iNaviPane->ResourceDecorator();
    if (iDecoratedTabGroup)
        {
        iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
        }

    CSYSINFO60View* view1 = new (ELeave) CSYSINFO60View;

    CleanupStack::PushL( view1 );
    view1->ConstructL();
    AddViewL( view1 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view1

    CSYSINFO60View2* view2 = new (ELeave) CSYSINFO60View2;

    CleanupStack::PushL( view2 );
    view2->ConstructL();
    AddViewL( view2 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view2

    CSYSINFO60View3* view3 = new (ELeave) CSYSINFO60View3;

    CleanupStack::PushL( view3 );
    view3->ConstructL();
    AddViewL( view3 );      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();    // view3

    CSYSINFO60View4* view4 = new (ELeave) CSYSINFO60View4;

    CleanupStack::PushL( view4 );
    view4->ConstructL();
    AddViewL( view4);      // transfer ownership to CAknViewAppUi
    CleanupStack::Pop();   // view4

	iAboutText = iEikonEnv->AllocReadResourceL(R_ABOUT_TXT);
    SetDefaultViewL(*view1);
    }

// ----------------------------------------------------
// CSYSINFO60AppUi::~CSYSINFO60AppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CSYSINFO60AppUi::~CSYSINFO60AppUi()
	{
	delete iAboutText;
    delete iDecoratedTabGroup;
	}

// ------------------------------------------------------------------------------
// CSYSINFO60AppUi::::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 CSYSINFO60AppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// CSYSINFO60AppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// ?implementation_description
// ----------------------------------------------------
//
TKeyResponse CSYSINFO60AppUi::HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
    {
    if ( iTabGroup == NULL )
        {
        return EKeyWasNotConsumed;
        }

    TInt active = iTabGroup->ActiveTabIndex();
    TInt count = iTabGroup->TabCount();

    switch ( aKeyEvent.iCode )
        {
        case EKeyLeftArrow:
            if ( active > 0 )
                {
                active--;
                iTabGroup->SetActiveTabByIndex( active );
                ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
                }
            break;
        case EKeyRightArrow:
            if( (active + 1) < count )
                {
                active++;
                iTabGroup->SetActiveTabByIndex( active );
                ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
                }
            break;
        default:
            return EKeyWasNotConsumed;
            break;
        }

	TBuf<16> titleText(KSystem);
	switch (++active)
	{
	case ESYSINFO60View1Tab:
		titleText.Copy(KSystem);
		break;
	case ESYSINFO60View2Tab:
		titleText.Copy(KIrLAP);
		break;
	case ESYSINFO60View3Tab:
		titleText.Copy(KBluetooth);
		break;
	case ESYSINFO60View4Tab:
		titleText.Copy(KNetMon);
		break;
	default:
		break;
	}
	CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
	CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
	tp->SetTextL(titleText);

    return EKeyWasConsumed;
    }

// ----------------------------------------------------
// CSYSINFO60AppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CSYSINFO60AppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EEikCmdExit:
            {
			Exit();
            break;
            }
        case ESYSINFO60CmdAppTest:
            {
#ifdef __WINS__
			NShowInfoMsgL(*iAboutText);
#else
			NShowStaticMsgL(*iAboutText);
#endif
            break;
            }
        default:
            break;      
        }
    }

// End of File  

⌨️ 快捷键说明

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