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