examples/ForumNokia/Symbian_OS_Basics_Lab_Exercises_v3_1/Lab_04309.cb2/solution/src/AOLabBubbleSortAppUi.cpp

00001 // Copyright (c) 2006 Nokia Corporation.
00002 
00003 #include <avkon.hrh>
00004 #include <aknnotewrappers.h>
00005 #include <stringloader.h>
00006 #include <AOLabBubbleSort.rsg>
00007 #include <f32file.h>
00008 #include <s32file.h>
00009 #include "AOLabBubbleSortAppUi.h"
00010 #include "AOLabBubbleSortContainer.h"
00011 #include "AOLabBubbleSort.hrh"
00012 
00013 
00014 // Symbian 2nd phase constructor
00015 void CAOLabBubbleSortAppUi::ConstructL()
00016     {
00017     BaseConstructL();
00018         iAppContainer = CAOLabBubbleSortContainer::NewL(ClientRect());
00019         }
00020 
00021 
00022 // C++  constructor
00023 CAOLabBubbleSortAppUi::CAOLabBubbleSortAppUi()
00024     {
00025     // No implementation required
00026     }
00027 
00028 
00029 // C++ Destructor
00030 CAOLabBubbleSortAppUi::~CAOLabBubbleSortAppUi()
00031     {
00032     delete iAppContainer;
00033     }
00034 
00035 
00036 // 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 CAOLabBubbleSortAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
00041     {
00042     if (aResourceId == R_MENU)
00043         {
00044         if (iAppContainer->IsSorting())
00045             {
00046             aMenuPane->SetItemTextL(ECommandSort, R_COMMAND_CANCELSORTING);
00047             }
00048         else
00049                 {
00050                 aMenuPane->SetItemTextL(ECommandSort,R_COMMAND_STARTSORTING);
00051                 }
00052         }
00053     }
00054     
00055 
00056 // Takes care of command handling
00057 void CAOLabBubbleSortAppUi::HandleCommandL( TInt aCommand )
00058     {
00059     switch( aCommand )
00060         {
00061         case EEikCmdExit:
00062         case EAknSoftkeyExit:
00063                 {       
00064             Exit();
00065             break;
00066                 }
00067 
00068         case ECommandSort:
00069             {
00070             if (iAppContainer->IsSorting())
00071                 {
00072                 iAppContainer->CancelSortL();
00073                 }
00074             else
00075                 {
00076                 iAppContainer->SortL();
00077                 }
00078             break;
00079             }
00080             
00081         default:
00082             break;
00083         }
00084     }
00085 
00086 
00087 //  Called by the framework when the application status pane size is changed.
00088 void CAOLabBubbleSortAppUi::HandleStatusPaneSizeChange()
00089 {
00090         iAppContainer->SetRect( ClientRect() );
00091 } 
00092 
00093 // End of File

Generated by  doxygen 1.6.2