Nokia N97 SDK
Example Applications Guide

aknexpbarappui.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : aknexpbarappui.cpp
00004 *  Part of     : ProgressBar
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 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 
00017 // INCLUDE FILES
00018 #include <AknExPbar.rsg>
00019 #include <avkon.hrh>
00020 #include <aknutils.h> 
00021 
00022 #include "AknExPbarAppUi.h"
00023 #include "AknExPbar.hrh"
00024 #include "AknExPbarContainer.h"
00025 
00026 
00027 // ========================= MEMBER FUNCTIONS ==================================
00028 
00029 // -----------------------------------------------------------------------------
00030 // CAknExPbarAppUi::CAknExPbarAppUi()
00031 // C++ default constructor can NOT contain any code, that might leave. 
00032 // -----------------------------------------------------------------------------
00033 //
00034 CAknExPbarAppUi::CAknExPbarAppUi() 
00035     {
00036     // No implementation required
00037     }
00038 
00039 // -----------------------------------------------------------------------------
00040 // CAknExPbarAppUi::ConstructL()
00041 // Symbian 2nd phase constructor can leave.
00042 // -----------------------------------------------------------------------------
00043 //
00044 void CAknExPbarAppUi::ConstructL()
00045     {
00046     // Initialise app UI with standard value.
00047     BaseConstructL( EAknEnableSkin );
00048     
00049     iContainer = CAknExPbarContainer::NewL( ClientRect() );
00050     AddToStackL( iContainer );
00051     }
00052 
00053 // -----------------------------------------------------------------------------
00054 // CAknExPbarAppUi::~CAknExPbarAppUi()
00055 // Destructor.
00056 // -----------------------------------------------------------------------------
00057 //
00058 CAknExPbarAppUi::~CAknExPbarAppUi()
00059     {
00060     if ( iContainer )
00061         {
00062         RemoveFromStack( iContainer );
00063         delete iContainer;
00064         iContainer = NULL;
00065         }
00066     }
00067 
00068 // -----------------------------------------------------------------------------
00069 // CAknExPbarAppUi::HandleKeyEventL()
00070 // Takes care of key event handling.
00071 // -----------------------------------------------------------------------------
00072 //
00073 void CAknExPbarAppUi::HandleCommandL( TInt aCommand )
00074     {
00075     TInt increment = KInitIncrement;
00076     
00077     switch ( aCommand )
00078         {
00079         case EAknCmdExit:
00080         case EAknSoftkeyExit:
00081         case EEikCmdExit:
00082             Exit();
00083             return; // returns if exit
00084 
00085         case EProgCmdChangeSetFinalValue1:
00086             iContainer->SetFinalValue();
00087             break;
00088 
00089         case EProgCmdChangeShowInfo0:
00090             iContainer->ShowInfo( EAknExpBarBar0 );
00091             break;
00092 
00093         case EProgCmdChangeShowInfo1:
00094             iContainer->ShowInfo( EAknExpBarBar1 );
00095             break;
00096 
00097         default:
00098             break;
00099         }
00100         
00101     if ( increment )
00102         {
00103         iContainer->IncrementBarsAndDraw( increment );
00104         }
00105    
00106     }
00107 
00108 // -----------------------------------------------------------------------------
00109 // CAknExPbarAppUi::HandleResourceChangeL()
00110 // Called by framework when layout is changed.
00111 // -----------------------------------------------------------------------------
00112 //
00113 void CAknExPbarAppUi::HandleResourceChangeL( TInt aType )
00114     {
00115     CAknAppUi::HandleResourceChangeL( aType );
00116        
00117     if ( aType==KEikDynamicLayoutVariantSwitch )
00118         {
00119         TRect rect;
00120         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
00121         iContainer->SetRect( rect );
00122         iContainer->ReConstructProgressBarsL();
00123         }   
00124     //Controls derived from CCoeControl, handled in container class
00125     iContainer->HandleResourceChange( aType );                   
00126     }
00127 
00128 // End of File  

© Nokia 2009

Back to top