|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <LandmarksAppUi.h>
Inheritance diagram for CLandmarksAppUi:

Public Member Functions | |
| CLandmarksAppUi () | |
| void | ConstructL () |
| ~CLandmarksAppUi () | |
| void | HandleCommandL (TInt aCommand) |
| TKeyResponse | HandleKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| void | NotifyOperationProgressL (TOperation aOperation, TInt aProgress, TInt aErrorCode) |
| void | TabChangedL (TInt aIndex) |
| void | DialogDismissedL (TInt aButtonId) |
Private Member Functions | |
| void | PostConstructL () |
| void | LaunchProgressDialogL () |
Private Attributes | |
| CAknNavigationDecorator * | iNaviDecorator |
| decorates the navi pane (with navigation arrows etc) | |
| CLandmarksApplicationEngine * | iEngine |
| the application engine | |
| CAknProgressDialog * | iProgressDialog |
| TBool | iDelayedExit |
Definition at line 38 of file LandmarksAppUi.h.
|
|
C++ default constructor. This needs to be public due to the way the framework constructs the AppUi. Definition at line 40 of file LandmarksAppUi.cpp.
|
|
|
Destructor. Definition at line 83 of file LandmarksAppUi.cpp. References iEngine, and iNaviDecorator. 00084 { 00085 delete iNaviDecorator; 00086 00087 // Cannot delete iEngine here since it is needed when deactivating views. 00088 iEngine = NULL; 00089 }
|
|
|
Symbian 2nd phase constructor. This needs to be public due to the way the framework constructs the AppUi. Definition at line 49 of file LandmarksAppUi.cpp. References iEngine, iNaviDecorator, LaunchProgressDialogL(), CLandmarksApplicationEngine::NewL(), and CLandmarksApplicationEngine::StartInitializeDbIfNecessaryL(). 00050 { 00051 BaseConstructL(EAknEnableSkin); 00052 00053 // Fetch pointer to the status pane. 00054 CEikStatusPane* statusPane = StatusPane(); 00055 00056 // Fetch pointer to the default navi pane control. 00057 CAknNavigationControlContainer* naviPane = 00058 (CAknNavigationControlContainer*) statusPane->ControlL( 00059 TUid::Uid(EEikStatusPaneUidNavi)); 00060 00061 // Initialise the nave decorator that visualizes the tabs and navi arrows. 00062 iNaviDecorator = naviPane->ResourceDecorator(); 00063 CAknTabGroup* tabGroup = 00064 static_cast<CAknTabGroup*>(iNaviDecorator->DecoratedControl()); 00065 tabGroup->SetObserver(this); 00066 00067 // Create and init the application engine. 00068 iEngine = CLandmarksApplicationEngine::NewL(); 00069 00070 // Initialize the default landmark database if necessary. 00071 if (iEngine->StartInitializeDbIfNecessaryL(this)) 00072 { 00073 LaunchProgressDialogL(); 00074 } 00075 else 00076 { 00077 // Db is already initialized - OK to construct views. 00078 PostConstructL(); 00079 } 00080 }
|
|
|
HandleCommandL handles user menu selections.
Definition at line 97 of file LandmarksAppUi.cpp. References iProgressDialog. 00098 { 00099 switch(aCommand) 00100 { 00101 case EEikCmdExit: 00102 case EAknSoftkeyExit: 00103 if (iProgressDialog) 00104 { 00105 // The progress dialog has been dismissed but not yet deleted. 00106 // iProgressDialog->ProcessFinishedL() deletes the progress 00107 // dialog asynchronously. If the app is exited before the 00108 // dialog is deleted, a Cone 8 panic will occur. 00109 // Thus, iProgressDialog must be deleted explicitely here. 00110 delete iProgressDialog; 00111 iProgressDialog = NULL; 00112 } 00113 Exit(); 00114 break; 00115 default: 00116 break; 00117 } 00118 }
|
|
||||||||||||
|
HandleKeyEventL handles key events.
Definition at line 126 of file LandmarksAppUi.cpp. References iNaviDecorator. 00128 { 00129 // Offer arrow keys to CAknTabGroup, it then calculates new active tab 00130 // and later calls our TabChangedL() -method with correct new tab index. 00131 00132 CAknTabGroup* tabGroup = 00133 static_cast <CAknTabGroup*> (iNaviDecorator->DecoratedControl()); 00134 00135 if (tabGroup && 00136 (aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow)) 00137 { 00138 return tabGroup->OfferKeyEventL(aKeyEvent, aType); 00139 } 00140 00141 return EKeyWasNotConsumed; 00142 }
|
|
||||||||||||||||
|
NotifyOperationProgressL notifies the progress and status of an asynchronous operation.
Implements MLandmarksOperationObserver. Definition at line 165 of file LandmarksAppUi.cpp. References iProgressDialog, and PostConstructL(). 00169 { 00170 if (aOperation == EInitializeDb) 00171 { 00172 // Update Progressbar 00173 CEikProgressInfo* progressBar = iProgressDialog->GetProgressInfoL(); 00174 progressBar->SetAndDraw(aProgress); 00175 00176 if (aErrorCode == KErrNone) // Db initialization ready. 00177 { 00178 // Dismiss dialog. 00179 iProgressDialog->ProcessFinishedL(); 00180 00181 // Continue with construction 00182 PostConstructL(); 00183 } 00184 } 00185 }
|
|
|
Called by NaviDecorator when tab is changed
Definition at line 144 of file LandmarksAppUi.cpp. 00145 { 00146 switch (aIndex) 00147 { 00148 case 0: 00149 ActivateLocalViewL(TUid::Uid(ELandmarksViewId)); 00150 break; 00151 case 1: 00152 ActivateLocalViewL(TUid::Uid(ELandmarksCategoriesViewId)); 00153 break; 00154 default: 00155 break; 00156 } 00157 }
|
|
|
Called when the dialog has been dismissed.
Definition at line 223 of file LandmarksAppUi.cpp. References iProgressDialog. 00224 { 00225 iProgressDialog = NULL; 00226 }
|
|
|
Performs the construction phase of this object that is dependent that the application engine is initialized. Definition at line 193 of file LandmarksAppUi.cpp. References iEngine, iNaviDecorator, CLandmarksInfoView::NewLC(), CLandmarksCategoriesView::NewLC(), and CLandmarksView::NewLC(). 00194 { 00195 // Create landmarks view 00196 CLandmarksView* landmarksView = 00197 CLandmarksView::NewLC(iNaviDecorator, *iEngine); 00198 AddViewL(landmarksView); // Transfer ownership to base class 00199 CleanupStack::Pop(landmarksView); 00200 00201 // Create categories view 00202 CLandmarksCategoriesView* categoriesView = 00203 CLandmarksCategoriesView::NewLC(iEngine); // ownership is transferred 00204 AddViewL(categoriesView); // Transfer ownership to base class 00205 CleanupStack::Pop(categoriesView); 00206 00207 // Create landmark info view 00208 CLandmarksInfoView* infoView = 00209 CLandmarksInfoView::NewLC(iNaviDecorator, *iEngine); 00210 AddViewL(infoView); // Transfer ownership to base class 00211 CleanupStack::Pop(infoView); 00212 00213 // Activate landmarks view 00214 landmarksView->ActivateViewL(landmarksView->ViewId()); 00215 }
|
|
|
Launches a progress dialog displayed when the default landmark database is initialized. Definition at line 234 of file LandmarksAppUi.cpp. References iProgressDialog. 00235 { 00236 // Initialize dialog 00237 TBool showImmediately(ETrue); 00238 iProgressDialog = new (ELeave) CAknProgressDialog( 00239 reinterpret_cast <CEikDialog**> (&iProgressDialog), showImmediately); 00240 iProgressDialog->PrepareLC(R_LMREFAPP_INIT_DB_PROGRESS_DIALOG); 00241 iProgressDialog->SetCallback(this); 00242 00243 // Initialize progress bar. 00244 CEikProgressInfo* progressBar = iProgressDialog->GetProgressInfoL(); 00245 const TInt KFinalProgressValue = 100; // 100% done when ready 00246 progressBar->SetFinalValue(KFinalProgressValue); 00247 00248 // Launch the prepared dialog. 00249 iProgressDialog->RunLD(); 00250 00251 // Draw the progress bar 00252 progressBar->IncrementAndDraw(0); 00253 }
|
|
|
displays a progress bar when initializing the default landmark database. Definition at line 140 of file LandmarksAppUi.h. |
|
|
indicates if exit has been pressed before the progressDialog is fully deleted Definition at line 144 of file LandmarksAppUi.h. |
|
© Nokia 2006 |