Nokia N97 SDK
Example Applications Guide

ListboxAppUi.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : ListboxAppUi.cpp
00004 *  Part of     : Listbox example
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2007 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 #include <avkon.hrh>
00017 #include <aknnotewrappers.h>
00018 #include <stringloader.h>
00019 #include <Listbox.rsg>
00020 
00021 #include "ListboxAppUi.h"
00022 #include "ListboxNumberContainer.h"
00023 #include "ListboxGraphicContainer.h"
00024 #include "ListboxSettingView.h"
00025 #include "Listbox.hrh"
00026 
00027 
00028 // ============================ MEMBER FUNCTIONS ===============================
00029 
00030 
00031 // -----------------------------------------------------------------------------
00032 // CListboxAppUi::ConstructL()
00033 // Symbian 2nd phase constructor can leave.
00034 // -----------------------------------------------------------------------------
00035 //
00036 void CListboxAppUi::ConstructL()
00037     {
00038     // Enable skin and MSK.
00039     BaseConstructL(EAknEnableSkin | EAknEnableMSK );
00040     
00041     // Create view objects.
00042     iSingleNumberStyleView = CViewTemplate<CListboxNumberContainer>::NewL( 
00043         R_LISTBOX_NUMBER_VIEW, 
00044         0, 
00045         TUid::Uid( EListboxNumberView ) );    
00046     iSingleNumberStyleView->MenuItemToDimm( EListboxCommandToNumberStyle );
00047         
00048     iSingleGraphicStyleView = CViewTemplate<CListboxGraphicContainer>::NewL(
00049         R_LISTBOX_GRAPHIC_VIEW, 
00050         R_LISTBOX_GRAPHICVIEW_MSK_MENUBAR, 
00051         TUid::Uid( EListboxGraphicView ) );
00052     iSingleGraphicStyleView->MenuItemToDimm( EListboxCommandToGraphicStyle );
00053         
00054     iSettingView = CListboxSettingView::NewL();
00055 
00056     AddViewL( iSingleNumberStyleView );
00057     AddViewL( iSingleGraphicStyleView );
00058     AddViewL( iSettingView );
00059     
00060     SetDefaultViewL( *iSingleNumberStyleView );    
00061     }
00062     
00063 // -----------------------------------------------------------------------------
00064 // CListboxAppUi::CListboxAppUi()
00065 // C++ default constructor can NOT contain any code, that might leave.
00066 // -----------------------------------------------------------------------------
00067 //
00068 CListboxAppUi::CListboxAppUi()
00069     {
00070     // No implementation required
00071     }
00072 
00073 // -----------------------------------------------------------------------------
00074 // CListboxAppUi::~CListboxAppUi()
00075 // Destructor.
00076 // -----------------------------------------------------------------------------
00077 //
00078 CListboxAppUi::~CListboxAppUi()
00079     {
00080     }
00081 
00082 // -----------------------------------------------------------------------------
00083 // CListboxAppUi::HandleCommandL()
00084 // Takes care of command handling.
00085 // -----------------------------------------------------------------------------
00086 //
00087 void CListboxAppUi::HandleCommandL( TInt aCommand )
00088     {
00089     switch( aCommand )
00090         {
00091         case EListboxCommandToNumberStyle:
00092             {
00093                 ActivateLocalViewL( TUid::Uid( EListboxNumberView ) );  
00094                 }
00095             break;
00096         case EListboxCommandToGraphicStyle:
00097                 {                       
00098                 ActivateLocalViewL( TUid::Uid( EListboxGraphicView ) );
00099                 }
00100             break;
00101         case EListboxCommandToSetting:
00102                 {
00103                 ActivateLocalViewL( TUid::Uid( EListboxSettingView ) );
00104                 }
00105             break;
00106         case EEikCmdExit:
00107         case EAknSoftkeyExit:
00108             Exit();
00109             break;
00110         default:
00111             break;
00112         }
00113     }
00114 
00115 // -----------------------------------------------------------------------------
00116 // CListboxAppUi::HandleResourceChangeL()
00117 // Handles a change to the control's resources.
00118 // -----------------------------------------------------------------------------
00119 //
00120 void CListboxAppUi::HandleResourceChangeL( TInt aType )
00121     {
00122     CAknAppUi::HandleResourceChangeL( aType );
00123        
00124     if ( aType==KEikDynamicLayoutVariantSwitch )
00125         {
00126         iSingleNumberStyleView->HandleSizeChange(aType);   
00127         iSingleGraphicStyleView->HandleSizeChange(aType); 
00128         iSettingView->HandleSizeChange(aType); 
00129         }           
00130     }
00131 
00132 // End of File
00133 

© Nokia 2009

Back to top