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