|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : PickSelectAppUi.cpp 00004 * Part of : OpenGLEx / PickSelect 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 "PickSelectAppUi.h" 00015 #include "PickSelectContainer.h" 00016 #include <PickSelect.rsg> 00017 #include "pickselect.hrh" 00018 00019 #include <avkon.hrh> 00020 00021 // ================= MEMBER FUNCTIONS ======================= 00022 // 00023 // ---------------------------------------------------------- 00024 // CPickSelectAppUi::ConstructL 00025 // Symbian 2nd phase constructor can leave. 00026 // ---------------------------------------------------------- 00027 // 00028 void CPickSelectAppUi::ConstructL() 00029 { 00030 BaseConstructL(); 00031 iAppContainer = new (ELeave) CPickSelectContainer; 00032 iAppContainer->SetMopParent(this); 00033 iAppContainer->ConstructL( ClientRect(), this ); 00034 AddToStackL( iAppContainer ); 00035 } 00036 00037 // Destructor 00038 CPickSelectAppUi::~CPickSelectAppUi() 00039 { 00040 if ( iAppContainer ) 00041 { 00042 RemoveFromStack( iAppContainer ); 00043 delete iAppContainer; 00044 } 00045 } 00046 00047 // ------------------------------------------------------------------------------ 00048 // CPickSelectAppUi::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 CPickSelectAppUi::DynInitMenuPaneL( 00056 TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) 00057 { 00058 } 00059 00060 // ---------------------------------------------------- 00061 // CPickSelectAppUi::HandleKeyEventL 00062 // Key event handler 00063 // ---------------------------------------------------- 00064 // 00065 TKeyResponse CPickSelectAppUi::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(EStdKeyUpArrow): 00075 iAppContainer->iPickSelect->MoveUp(ETrue); 00076 return EKeyWasConsumed; 00077 case(EStdKeyDownArrow): 00078 iAppContainer->iPickSelect->MoveDown(ETrue); 00079 return EKeyWasConsumed; 00080 case(EStdKeyLeftArrow): 00081 iAppContainer->iPickSelect->MoveLeft(ETrue); 00082 return EKeyWasConsumed; 00083 case(EStdKeyRightArrow): 00084 iAppContainer->iPickSelect->MoveRight(ETrue); 00085 return EKeyWasConsumed; 00086 case(EStdKeyDevice3): // Rocker Middle Button 00087 iAppContainer->iPickSelect->SelectObject(); 00088 return EKeyWasConsumed; 00089 default: 00090 return EKeyWasNotConsumed; 00091 } 00092 } 00093 else if ( aType == EEventKeyUp ) 00094 { 00095 TUint scan = aKeyEvent.iScanCode; 00096 00097 switch ( scan ) 00098 { 00099 case(16): 00100 iAppContainer->iPickSelect->MoveUp(EFalse); 00101 return EKeyWasConsumed; 00102 case(17): 00103 iAppContainer->iPickSelect->MoveDown(EFalse); 00104 return EKeyWasConsumed; 00105 case(14): 00106 iAppContainer->iPickSelect->MoveLeft(EFalse); 00107 return EKeyWasConsumed; 00108 case(15): 00109 iAppContainer->iPickSelect->MoveRight(EFalse); 00110 return EKeyWasConsumed; 00111 default: 00112 return EKeyWasNotConsumed; 00113 } 00114 } 00115 else 00116 { 00117 return EKeyWasNotConsumed; 00118 } 00119 } 00120 00121 // ---------------------------------------------------- 00122 // CPickSelectAppUi::HandleCommandL(TInt aCommand) 00123 // Command handler 00124 // ---------------------------------------------------- 00125 // 00126 void CPickSelectAppUi::HandleCommandL(TInt aCommand) 00127 { 00128 switch ( aCommand ) 00129 { 00130 case EAknSoftkeyBack: 00131 case EEikCmdExit: 00132 { 00133 Exit(); 00134 break; 00135 } 00136 case EPickSelectPolygon: 00137 { 00138 iAppContainer->iPickSelect->SetPolygonSelection(); 00139 break; 00140 } 00141 case EPickSelectObject: 00142 { 00143 iAppContainer->iPickSelect->SetObjectSelection(); 00144 break; 00145 } 00146 default: 00147 break; 00148 } 00149 } 00150 00151 // End of File
|
© Nokia 2009 |