|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : HierarchyAppUi.cpp 00004 * Part of : OpenGLEx / Hierarchy 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 "HierarchyAppUi.h" 00015 #include "HierarchyContainer.h" 00016 #include <Hierarchy.rsg> 00017 #include "hierarchy.hrh" 00018 00019 #include <avkon.hrh> 00020 00021 // EXTERNAL DATA STRUCTURES 00022 00023 // EXTERNAL FUNCTION PROTOTYPES 00024 00025 // CONSTANTS 00026 00027 // MACROS 00028 00029 // LOCAL CONSTANTS AND MACROS 00030 00031 // MODULE DATA STRUCTURES 00032 00033 // LOCAL FUNCTION PROTOTYPES 00034 00035 // FORWARD DECLARATIONS 00036 00037 // ================= MEMBER FUNCTIONS ======================= 00038 // 00039 // ---------------------------------------------------------- 00040 // CHierarchyAppUi::ConstructL 00041 // Symbian 2nd phase constroctor can leave 00042 // ---------------------------------------------------------- 00043 // 00044 void CHierarchyAppUi::ConstructL() 00045 { 00046 BaseConstructL(); 00047 iAppContainer = new (ELeave) CHierarchyContainer; 00048 iAppContainer->SetMopParent(this); 00049 iAppContainer->ConstructL( ClientRect(), this ); 00050 AddToStackL( iAppContainer ); 00051 } 00052 00053 // ---------------------------------------------------- 00054 // CHierarchyAppUi::~CHierarchyAppUi 00055 // Destructor 00056 // ---------------------------------------------------- 00057 // 00058 CHierarchyAppUi::~CHierarchyAppUi() 00059 { 00060 if ( iAppContainer ) 00061 { 00062 RemoveFromStack( iAppContainer ); 00063 delete iAppContainer; 00064 } 00065 } 00066 00067 // ------------------------------------------------------------------------------ 00068 // CHierarchyAppUi::DynInitMenuPaneL 00069 // This function is called by the EIKON framework just before it displays 00070 // a menu pane. Its default implementation is empty, and by overriding it, 00071 // the application can set the state of menu items dynamically according 00072 // to the state of application data. 00073 // ------------------------------------------------------------------------------ 00074 // 00075 void CHierarchyAppUi::DynInitMenuPaneL( 00076 TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) 00077 { 00078 } 00079 00080 // ---------------------------------------------------- 00081 // CHierarchyAppUi::HandleKeyEventL 00082 // Key event handler 00083 // ---------------------------------------------------- 00084 // 00085 TKeyResponse CHierarchyAppUi::HandleKeyEventL( 00086 const TKeyEvent& aKeyEvent, TEventCode aType ) 00087 { 00088 if ( aType == EEventKeyDown ) 00089 { 00090 TUint scan = aKeyEvent.iScanCode; 00091 00092 switch ( scan ) 00093 { 00094 case(EStdKeyUpArrow): 00095 iAppContainer->iHierarchy->RotateObjectUp(ETrue); 00096 return EKeyWasConsumed; 00097 case(EStdKeyDownArrow): 00098 iAppContainer->iHierarchy->RotateObjectDown(ETrue); 00099 return EKeyWasConsumed; 00100 case(EStdKeyDevice3): 00101 iAppContainer->iHierarchy->SwitchRotateMode(); 00102 return EKeyWasConsumed; 00103 default: 00104 return EKeyWasNotConsumed; 00105 } 00106 } 00107 else if ( aType == EEventKeyUp ) 00108 { 00109 TUint scan = aKeyEvent.iScanCode; 00110 00111 switch ( scan ) 00112 { 00113 case(EStdKeyUpArrow): 00114 iAppContainer->iHierarchy->RotateObjectUp(EFalse); 00115 return EKeyWasConsumed; 00116 case(EStdKeyDownArrow): 00117 iAppContainer->iHierarchy->RotateObjectDown(EFalse); 00118 return EKeyWasConsumed; 00119 default: 00120 return EKeyWasNotConsumed; 00121 } 00122 } 00123 else 00124 { 00125 return EKeyWasNotConsumed; 00126 } 00127 } 00128 00129 // ---------------------------------------------------- 00130 // CHierarchyAppUi::HandleCommandL 00131 // Command handler 00132 // ---------------------------------------------------- 00133 // 00134 void CHierarchyAppUi::HandleCommandL(TInt aCommand) 00135 { 00136 switch ( aCommand ) 00137 { 00138 case EAknSoftkeyBack: 00139 case EEikCmdExit: 00140 { 00141 Exit(); 00142 break; 00143 } 00144 default: 00145 break; 00146 } 00147 } 00148 00149 // End of File
|
© Nokia 2009 |