# examples/ForumNokia/Symbian_OS_Basics_Lab_Exercises_v3_1/Lab_04307.cb1/solution/src/S60ResourceLabAppUi.cpp

    00001 // Copyright (c) 2006 Nokia Corporation.
    00002
    00003 // INCLUDE FILES
    00004 #include "S60ResourceLabAppUi.h"
    00005 #include "S60ResourceLabContainer.h"
    00006 #include <S60ResourceLab.rsg>
    00007 #include "S60Resourcelab.hrh"
    00008
    00009 #include <avkon.hrh>
    00010
    00011 // ================= MEMBER FUNCTIONS =======================
    00012 //
    00013 // ----------------------------------------------------------
    00014 // CS60ResourceLabAppUi::ConstructL()
    00015 // ?implementation_description
    00016 // ----------------------------------------------------------
    00017 //
    00018 void CS60ResourceLabAppUi::ConstructL()
    00019     {
    00020     BaseConstructL();
    00021     iAppContainer = new (ELeave) CS60ResourceLabContainer;
    00022     iAppContainer->SetMopParent(this);
    00023     iAppContainer->ConstructL( ClientRect() );
    00024     AddToStackL( iAppContainer );
    00025     }
    00026
    00027 // ----------------------------------------------------
    00028 // CS60ResourceLabAppUi::~CS60ResourceLabAppUi()
    00029 // Destructor
    00030 // Frees reserved resources
    00031 // ----------------------------------------------------
    00032 //
    00033 CS60ResourceLabAppUi::~CS60ResourceLabAppUi()
    00034     {
    00035     if (iAppContainer)
    00036         {
    00037         RemoveFromStack( iAppContainer );
    00038         delete iAppContainer;
    00039         }
    00040     }
    00041
    00042
    00043 // ------------------------------------------------------------------------------
    00044 // CS60ResourceLabAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
    00045 //  This function is called by the EIKON framework just before it displays
    00046 //  a menu pane. Its default implementation is empty, and by overriding it,
    00047 //  the application can set the state of menu items dynamically according
    00048 //  to the state of application data.
    00049 // ------------------------------------------------------------------------------
    00050 //
    00051 void CS60ResourceLabAppUi::DynInitMenuPaneL(
    00052     TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    00053     {
    00054     }
    00055
    00056 // ----------------------------------------------------
    00057 // CS60ResourceLabAppUi::HandleKeyEventL(
    00058 //     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
    00059 // ?implementation_description
    00060 // ----------------------------------------------------
    00061 //
    00062 TKeyResponse CS60ResourceLabAppUi::HandleKeyEventL(
    00063     const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    00064     {
    00065     return EKeyWasNotConsumed;
    00066     }
    00067
    00068 // ----------------------------------------------------
    00069 // CS60ResourceLabAppUi::HandleCommandL(TInt aCommand)
    00070 // ?implementation_description
    00071 // ----------------------------------------------------
    00072 //
    00073 void CS60ResourceLabAppUi::HandleCommandL(TInt aCommand)
    00074     {
    00075     switch ( aCommand )
    00076         {
    00077         case EAknSoftkeyBack:
    00078         case EEikCmdExit:
    00079             {
    00080             Exit();
    00081             break;
    00082             }
    00083
    00084         case ES60ResourceLabCmdAppTest:
    00085             {
    00086             HBufC* helloworld = iCoeEnv->AllocReadResourceL(R_S60RESOURCELAB_TEXT_HELLO_WORLD);
    00087             iEikonEnv->InfoMsg(*helloworld);
    00088             delete helloworld;
    00089             break;
    00090             }
    00091
    00092         case ES60ResourceLabCmdGoodbye:
    00093             {
    00094             iAppContainer->GoodbyeL();
    00095             break;
    00096             }
    00097
    00098         default:
    00099             break;
    00100         }
    00101     }
    00102
    00103 // End of File