examples/SFExamples/RecipeEx/src/SensorView.cpp

00001 // Symbian Foundation Example Code
00002 // 
00003 // This software is in the public domain. No copyright is claimed, and you 
00004 // may use it for any purpose without license from the Symbian Foundation.
00005 // No warranty for any purpose is expressed or implied by the authors or
00006 // the Symbian Foundation. 
00007 
00008 
00009 // Includes
00010 #include <aknviewappui.h>
00011 #include <avkon.hrh>
00012 #include <RecipeEx_0xE8FAA390.rsg>
00013 #include "SensorView.h"
00014 #include "SensorListener.h"
00015 #include "LogContainer.h" 
00016 #include "RecipeEx.hrh"
00017 #include "MainView.h" // KMainViewId
00018 
00019 
00020 // ================= MEMBER FUNCTIONS =======================
00021 
00023 CSensorView* CSensorView::NewL()
00024         {
00025         CSensorView* self = CSensorView::NewLC();
00026         CleanupStack::Pop( self );
00027         return self;
00028         }
00029 
00031 CSensorView* CSensorView::NewLC()
00032         {
00033         CSensorView* self = new ( ELeave ) CSensorView;
00034         CleanupStack::PushL( self );
00035         self->ConstructL();
00036         return self;
00037         }
00038 
00040 void CSensorView::ConstructL()
00041     {
00042     BaseConstructL( R_SENSOR_VIEW );
00043     }
00044 
00046 CSensorView::~CSensorView()
00047     {
00048         if (iSensorListener)
00049                 {
00050                 delete iSensorListener;
00051                 }
00052         
00053     if (iLogContainer)
00054         {
00055         AppUi()->RemoveFromViewStack(*this, iLogContainer);
00056         }
00057 
00058     delete iLogContainer;
00059     }
00060 
00062 TUid CSensorView::Id() const
00063     {
00064     return KSensorViewId;
00065     }
00066 
00073 void CSensorView::HandleCommandL(TInt aCommand)
00074     {   
00075     switch ( aCommand )
00076         {
00077         case EAknSoftkeyBack:
00078                 {
00079             AppUi()->ActivateLocalViewL(KMainViewId);
00080                 break;
00081                 }       
00082         default:
00083             {
00084             AppUi()->HandleCommandL( aCommand );
00085             break;
00086             }
00087         }
00088     }
00089 
00100 void CSensorView::DoActivateL(
00101    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
00102    const TDesC8& /*aCustomMessage*/)
00103         {
00104     if (!iLogContainer)
00105         {
00106         iLogContainer = CLogContainer::NewL(ClientRect());
00107         iLogContainer->SetMopParent(this);
00108         AppUi()->AddToStackL( *this, iLogContainer );
00109         } 
00110     if (!iSensorListener)
00111         {
00112         iSensorListener = CSensorListener::NewL(iLogContainer);
00113         }
00114         }
00115 
00121 void CSensorView::DoDeactivate()
00122     {
00123     if ( iLogContainer )
00124         {
00125         AppUi()->RemoveFromViewStack( *this, iLogContainer );
00126         }
00127     
00128     delete iLogContainer;
00129     iLogContainer = NULL;
00130     
00131     delete iSensorListener;
00132     iSensorListener = NULL;
00133     }
00134 
00135 
00136 // End of File
00137 

Generated by  doxygen 1.6.2