examples/SFExamples/RecipeEx/src/MainView.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 "MainView.h"
00014 #include "MainViewContainer.h" 
00015 #include "RecipeEx.hrh"
00016 #include "DeviceCapsView.h" // KDeviceCapsViewId
00017 #include "SensorView.h" // KSensorViewId
00018 #include "MobilityView.h" // KMobilityViewId
00019 
00020 
00021 
00022 
00023 // ================= MEMBER FUNCTIONS =======================
00024 
00026 CMainView* CMainView::NewL()
00027         {
00028         CMainView* self = CMainView::NewLC();
00029         CleanupStack::Pop( self );
00030         return self;
00031         }
00032 
00034 CMainView* CMainView::NewLC()
00035         {
00036         CMainView* self = new ( ELeave ) CMainView;
00037         CleanupStack::PushL( self );
00038         self->ConstructL();
00039         return self;
00040         }
00041 
00043 void CMainView::ConstructL()
00044     {
00045     BaseConstructL( R_MAIN_VIEW );
00046     }
00047 
00049 CMainView::~CMainView()
00050     {
00051     if (iContainer)
00052         {
00053         AppUi()->RemoveFromViewStack(*this, iContainer);
00054         }
00055 
00056     delete iContainer;
00057     }
00058 
00060 TUid CMainView::Id() const
00061     {
00062     return KMainViewId;
00063     }
00064 
00071 void CMainView::HandleCommandL(TInt aCommand)
00072     {   
00073     switch ( aCommand )
00074         {
00075                 case EDeviceCapabilities:
00076                         {
00077             AppUi()->ActivateLocalViewL(KDeviceCapsViewId);
00078                         break;
00079                         }
00080                 case ESensorListener:
00081                         {
00082             AppUi()->ActivateLocalViewL(KSensorViewId);
00083                         break;
00084                         }       
00085                 case EMobility:
00086                         {
00087             AppUi()->ActivateLocalViewL(KMobilityViewId);
00088                         break;
00089                         }                       
00090         default:
00091             {
00092             AppUi()->HandleCommandL( aCommand );
00093             break;
00094             }
00095         }
00096     }
00097 
00108 void CMainView::DoActivateL(
00109    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
00110    const TDesC8& /*aCustomMessage*/)
00111     {
00112     if (!iContainer)
00113         {
00114         iContainer = CMainViewContainer::NewL(ClientRect());
00115         iContainer->SetMopParent(this);
00116         AppUi()->AddToStackL( *this, iContainer );
00117         } 
00118    }
00119 
00125 void CMainView::DoDeactivate()
00126     {
00127     if ( iContainer )
00128         {
00129         AppUi()->RemoveFromViewStack( *this, iContainer );
00130         }
00131     
00132     delete iContainer;
00133     iContainer = NULL;
00134     }
00135 
00136 
00137 // End of File
00138 

Generated by  doxygen 1.6.2