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