- // Copyright (c) 2006 Nokia Corporation.
- // INCLUDE FILES
- #include "S60MMFLabAppUi.h"
- #include "S60MMFLabContainer.h"
- #include <S60mmflab.rsg>
- #include "s60mmflab.hrh"
- #include <avkon.hrh>
- #include <eikmenup.h>
- #include <S60MMFLab.rsg>
- // ================= MEMBER FUNCTIONS =======================
- //
- // ----------------------------------------------------------
- // CS60MMFLabAppUi::ConstructL()
- //
- // ----------------------------------------------------------
- //
- void CS60MMFLabAppUi::ConstructL()
- {
- BaseConstructL(EAknEnableSkin);
- iAppContainer = new (ELeave) CS60MMFLabContainer;
- iAppContainer->SetMopParent( this );
- iToneUtility = CS60MMFLabToneUtility::NewL();
- iPlayerUtility = CS60MMFLabPlayerUtility::NewL();
- // start with tone utility
- iCurrentUtility = EToneUtility;
- iAppContainer->ConstructL( ClientRect(), iToneUtility->GetLabel());
- AddToStackL( iAppContainer );
- }
- // ----------------------------------------------------
- // CS60MMFLabAppUi::~CS60MMFLabAppUi()
- // Destructor
- // Frees reserved resources
- // ----------------------------------------------------
- //
- CS60MMFLabAppUi::~CS60MMFLabAppUi()
- {
- if (iAppContainer)
- {
- RemoveFromStack( iAppContainer );
- delete iAppContainer;
- }
- delete iToneUtility;
- delete iPlayerUtility;
- }
- // ------------------------------------------------------------------------------
- // CS60MMFLabAppUi::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 CS60MMFLabAppUi::DynInitMenuPaneL(
- TInt aResourceId, CEikMenuPane* aMenuPane)
- {
- if (aResourceId == R_S60MMFLAB_MENU)
- {
- if (iCurrentUtility == EToneUtility)
- {
- iToneUtility->SetOptionsMenuL(aMenuPane);
- }
- else if (iCurrentUtility == EPlayerUtility)
- {
- iPlayerUtility->SetOptionsMenuL(aMenuPane);
- }
- }
- }
- // ----------------------------------------------------
- // CS60MMFLabAppUi::HandleCommandL(TInt aCommand)
- // takes care of command handling
- // ----------------------------------------------------
- //
- void CS60MMFLabAppUi::HandleCommandL(TInt aCommand)
- {
- switch ( aCommand )
- {
- case EAknSoftkeyBack:
- case EEikCmdExit:
- {
- Exit();
- break;
- }
- case ES60MMFLabCmdAppChange:
- {
- break;
- }
- case ES60MMFLabCmdAppPlay:
- {
- if (iCurrentUtility==EToneUtility)
- iToneUtility->Play();
- else if (iCurrentUtility==EPlayerUtility)
- iPlayerUtility->Play();
- break;
- }
- case ES60MMFLabCmdAppStop:
- {
- if (iCurrentUtility==EToneUtility)
- iToneUtility->CancelPlay();
- else if (iCurrentUtility==EPlayerUtility)
- iPlayerUtility->Stop();
- break;
- }
- case ES60MMFLabCmdAppTonePlayer:
- {
- iCurrentUtility = EToneUtility;
- iAppContainer->SetLabelL(iToneUtility->GetLabel());
- iAppContainer->DrawNow();
- break;
- }
- case ES60MMFLabCmdAppAudioPlayer:
- {
- iCurrentUtility = EPlayerUtility;
- iAppContainer->SetLabelL(iPlayerUtility->GetLabel());
- iAppContainer->DrawNow();
- break;
- }
- default:
- break;
- }
- }
- // -----------------------------------------------------------------------------
- // CS60MMFLabAppUi::HandleScreenDeviceChangedL
- // Handle change in screen resolution.
- // -----------------------------------------------------------------------------
- //
- void CS60MMFLabAppUi::HandleScreenDeviceChangedL()
- {
- CAknAppUi::HandleScreenDeviceChangedL();
- // Reposition the view
- if ( iAppContainer )
- {
- iAppContainer->SetRect(ClientRect());
- }
- }
- // End of File