www.pudn.com > SystemSounds_Example_v1_0.zip > SystemSoundsAppUi.cpp
/* * ============================================================================ * Name : CSystemSoundsAppUi from SystemSoundsAppUi.cpp * Part of : SystemSounds * Created : 06/12/2003 by Forum Nokia * Implementation notes: * Initial content was generated by Nokia Series 60 AppWizard. * Version : 1.0 * Copyright: Nokia * ============================================================================ */ // INCLUDE FILES #include "SystemSoundsAppUi.h" #include "SystemSoundsView.h" #include "SystemSoundsView2.h" #include#include "systemsounds.hrh" #include // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- // CSystemSoundsAppUi::ConstructL() // ?implementation_description // ---------------------------------------------------------- // void CSystemSoundsAppUi::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)); // 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(); } CSystemSoundsView* view1 = new (ELeave) CSystemSoundsView; CleanupStack::PushL( view1 ); view1->ConstructL(); AddViewL( view1 ); // transfer ownership to CAknViewAppUi CleanupStack::Pop(); // view1 CSystemSoundsView2* view2 = new (ELeave) CSystemSoundsView2; CleanupStack::PushL( view2 ); view2->ConstructL(); AddViewL( view2 ); // transfer ownership to CAknViewAppUi CleanupStack::Pop(); // view2 SetDefaultViewL(*view1); } // ---------------------------------------------------- // CSystemSoundsAppUi::~CSystemSoundsAppUi() // Destructor // Frees reserved resources // ---------------------------------------------------- // CSystemSoundsAppUi::~CSystemSoundsAppUi() { delete iDecoratedTabGroup; } // ------------------------------------------------------------------------------ // CSystemSoundsAppUi::::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 CSystemSoundsAppUi::DynInitMenuPaneL( TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) { } // ---------------------------------------------------- // CSystemSoundsAppUi::HandleKeyEventL( // const TKeyEvent& aKeyEvent,TEventCode /*aType*/) // ?implementation_description // ---------------------------------------------------- // TKeyResponse CSystemSoundsAppUi::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; } return EKeyWasConsumed; } // ---------------------------------------------------- // CSystemSoundsAppUi::HandleCommandL(TInt aCommand) // ---------------------------------------------------- // void CSystemSoundsAppUi::HandleCommandL(TInt aCommand) { switch ( aCommand ) { case EEikCmdExit: { Exit(); break; } default: break; } } // End of File