# examples/ForumNokia/Symbian_OS_Basics_Lab_Exercises_v3_1/Lab_04309.cb1/starter/src/AOLabTextFlashAppUi.cpp

    00001 // Copyright (c) 2006 Nokia Corporation.
    00002
    00003 #include <avkon.hrh>
    00004 #include <aknnotewrappers.h>
    00005 #include <stringloader.h>
    00006 #include <AOLabTextFlash.rsg>
    00007 #include <f32file.h>
    00008 #include <s32file.h>
    00009 #include "AOLabTextFlashAppUi.h"
    00010 #include "AOLabTextFlashContainer.h"
    00011 #include "AOLabTextFlash.hrh"
    00012
    00013
    00014 // Symbian 2nd phase constructor
    00015 void CAOLabTextFlashAppUi::ConstructL()
    00016     {
    00017     BaseConstructL();
    00018         iAppContainer = CAOLabTextFlashContainer::NewL(ClientRect());
    00019         }
    00020
    00021
    00022 // C++ constructor
    00023 CAOLabTextFlashAppUi::CAOLabTextFlashAppUi()
    00024     {
    00025     // No implementation
    00026     }
    00027
    00028
    00029 // C++ destructor
    00030 CAOLabTextFlashAppUi::~CAOLabTextFlashAppUi()
    00031     {
    00032     delete iAppContainer;
    00033     }
    00034
    00035
    00036 //  This function is called by the EIKON framework just before it displays
    00037 //  a menu pane. Its default implementation is empty, and by overriding it,
    00038 //  the application can set the state of menu items dynamically according
    00039 //  to the state of application data.
    00040 void CAOLabTextFlashAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
    00041     {
    00042     if (aResourceId == R_MENU)
    00043         {
    00044         if (iAppContainer->IsFlashing())
    00045             {
    00046             aMenuPane->SetItemTextL(ECommandFlashText, R_COMMAND_STOPFLASHING);
    00047             }
    00048         else
    00049                 {
    00050                 aMenuPane->SetItemTextL(ECommandFlashText, R_COMMAND_STARTFLASHING);
    00051                 }
    00052         }
    00053     }
    00054
    00055
    00056 // Takes care of command handling.
    00057 void CAOLabTextFlashAppUi::HandleCommandL( TInt aCommand )
    00058     {
    00059     switch ( aCommand )
    00060         {
    00061         case EAknSoftkeyExit:
    00062         case EEikCmdExit:
    00063             Exit();
    00064             break;
    00065
    00066         case ECommandFlashText:
    00067                 {
    00068             if (iAppContainer->IsFlashing())
    00069                 {
    00070                 iAppContainer->StopFlashing();
    00071                 }
    00072             else
    00073                 {
    00074                 iAppContainer->FlashingText();
    00075                 }
    00076
    00077             break;
    00078                 }
    00079
    00080         default:
    00081             break;
    00082         }
    00083     }
    00084
    00085
    00086 //  Called by the framework when the application status pane
    00087 //  size is changed.
    00088 void CAOLabTextFlashAppUi::HandleStatusPaneSizeChange()
    00089         {
    00090         iAppContainer->SetRect( ClientRect() );
    00091         }
    00092
    00093 // End of File