examples/sfexamples/Wikipedia/src/SqlSrvDemoAppUi.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 
00018 
00019 // INCLUDE FILES
00020 #include <e32std.h>
00021 
00022 #include "SqlSrvDemo.pan"
00023 #include "SqlSrvDemoAppUi.h"
00024 #include "AboutView.h"
00025 #include "SearchView.h"
00026 #include "DetailView.h"
00027 #include "WikiDb.h"
00028 
00029 // ========================= MEMBER FUNCTIONS ==================================
00030 
00031 // -----------------------------------------------------------------------------
00032 // CSqlSrvDemoAppUi::ConstructL()
00033 // Symbian 2nd phase constructor can leave.
00034 // -----------------------------------------------------------------------------
00035 //
00036 void CSqlSrvDemoAppUi::ConstructL()
00037     {    
00038     iWikiEngine = CWikiDb::NewL();    
00039     
00040     // Initialise app UI
00041     BaseConstructL(EAknEnableSkin);
00042 
00043     iSearchView = CSearchView::NewL();
00044     iDetailView = CDetailView::NewL();
00045     iAboutView = CAboutView::NewL();
00046 
00047     // Transfer ownership to base class
00048     AddViewL( iSearchView );
00049     AddViewL( iDetailView );
00050     AddViewL( iAboutView );
00051 
00052     SetDefaultViewL( *iSearchView );
00053     }
00054 
00055 // -----------------------------------------------------------------------------
00056 // CSqlSrvDemoAppUi::~CSqlSrvDemoAppUi()
00057 // Destructor
00058 // -----------------------------------------------------------------------------
00059 //
00060 CSqlSrvDemoAppUi::~CSqlSrvDemoAppUi()
00061     {
00062     delete iWikiEngine;
00063     }
00064 
00065 // -----------------------------------------------------------------------------
00066 // CSqlSrvDemoAppUi::HandleCommandL()
00067 // Takes care of command handling.
00068 // -----------------------------------------------------------------------------
00069 //
00070 void CSqlSrvDemoAppUi::HandleCommandL( TInt aCommand )
00071     {
00072     switch ( aCommand )
00073         {
00074         case EEikCmdExit:
00075         case EAknSoftkeyExit:
00076             Exit();
00077             break;
00078             
00079         case EAknSoftkeyEmpty:
00080                 // Do Nothing
00081                 break;
00082         
00083         default:
00084             Panic( ESqlSrvDemoBasicUi );
00085             break;
00086         }
00087     }
00088 
00089 // -----------------------------------------------------------------------------
00090 // CSqlSrvDemoAppUi::HandleResourceChangeL()
00091 // Called by framework when layout is changed.
00092 // -----------------------------------------------------------------------------
00093 //
00094 void CSqlSrvDemoAppUi::HandleResourceChangeL( TInt aType )
00095     {
00096     CAknAppUi::HandleResourceChangeL( aType );
00097        
00098     if ( aType==KEikDynamicLayoutVariantSwitch )
00099         {
00100         iSearchView->HandleSizeChange(aType);
00101         iDetailView->HandleSizeChange(aType);
00102         iAboutView->HandleSizeChange(aType);
00103         }           
00104     }
00105 
00106 // -----------------------------------------------------------------------------
00107 // CSqlSrvDemoAppUi::WikiEngine()
00108 // The application's engine to the wikipedia DB
00109 // -----------------------------------------------------------------------------
00110 //
00111 CWikiDb& CSqlSrvDemoAppUi::WikiEngine()
00112         {
00113         CSqlSrvDemoAppUi* appUi = static_cast< CSqlSrvDemoAppUi* >( CCoeEnv::Static()->AppUi() );
00114         return *appUi->iWikiEngine;
00115         }
00116     
00117 // End of File

Generated by  doxygen 1.6.2