|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : ShadowsAppUi.cpp 00004 * Part of : OpenGLEx / Shadows 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 // INCLUDE FILES 00017 #include "ShadowsAppUi.h" 00018 #include "ShadowsContainer.h" 00019 #include <Shadows.rsg> 00020 #include "shadows.hrh" 00021 00022 #include <avkon.hrh> 00023 00024 // ================= MEMBER FUNCTIONS ======================= 00025 // 00026 // ---------------------------------------------------------- 00027 // CShadowsAppUi::ConstructL 00028 // Symbian 2nd phase constructor can leave. 00029 // ---------------------------------------------------------- 00030 // 00031 void CShadowsAppUi::ConstructL() 00032 { 00033 BaseConstructL(); 00034 iAppContainer = new (ELeave) CShadowsContainer; 00035 iAppContainer->SetMopParent(this); 00036 iAppContainer->ConstructL( ClientRect() ); 00037 AddToStackL( iAppContainer ); 00038 } 00039 00040 // Destructor 00041 CShadowsAppUi::~CShadowsAppUi() 00042 { 00043 if ( iAppContainer ) 00044 { 00045 RemoveFromStack( iAppContainer ); 00046 delete iAppContainer; 00047 } 00048 } 00049 00050 // ------------------------------------------------------------------------------ 00051 // CShadowsAppUi::DynInitMenuPaneL 00052 // This function is called by the EIKON framework just before it displays 00053 // a menu pane. Its default implementation is empty, and by overriding it, 00054 // the application can set the state of menu items dynamically according 00055 // to the state of application data. 00056 // ------------------------------------------------------------------------------ 00057 // 00058 void CShadowsAppUi::DynInitMenuPaneL( 00059 TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) 00060 { 00061 } 00062 00063 // ---------------------------------------------------- 00064 // CShadowsAppUi::HandleKeyEventL 00065 // Key event handler 00066 // ---------------------------------------------------- 00067 // 00068 TKeyResponse CShadowsAppUi::HandleKeyEventL( 00069 const TKeyEvent& aKeyEvent, TEventCode aType ) 00070 { 00071 if ( aType == EEventKeyDown ) 00072 { 00073 TUint scan = aKeyEvent.iScanCode; 00074 00075 switch ( scan ) 00076 { 00077 case(14): 00078 iAppContainer->iShadows->RotateLightLeft(); 00079 return EKeyWasConsumed; 00080 case(15): 00081 iAppContainer->iShadows->RotateLightRight(); 00082 return EKeyWasConsumed; 00083 default: 00084 return EKeyWasNotConsumed; 00085 } 00086 } 00087 else if ( aType == EEventKeyUp ) 00088 { 00089 TUint scan = aKeyEvent.iScanCode; 00090 00091 switch ( scan ) 00092 { 00093 case(14): 00094 iAppContainer->iShadows->RotateLightLeft(); 00095 return EKeyWasConsumed; 00096 case(15): 00097 iAppContainer->iShadows->RotateLightRight(); 00098 return EKeyWasConsumed; 00099 default: 00100 return EKeyWasNotConsumed; 00101 } 00102 } 00103 else 00104 { 00105 return EKeyWasNotConsumed; 00106 } 00107 } 00108 00109 // ---------------------------------------------------- 00110 // CShadowsAppUi::HandleCommandL 00111 // Command handler 00112 // ---------------------------------------------------- 00113 // 00114 void CShadowsAppUi::HandleCommandL(TInt aCommand) 00115 { 00116 switch ( aCommand ) 00117 { 00118 case EAknSoftkeyBack: 00119 case EEikCmdExit: 00120 { 00121 Exit(); 00122 break; 00123 } 00124 default: 00125 break; 00126 } 00127 } 00128 00129 // End of File
|
© Nokia 2006 |