|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <LandmarksInfoContainer.h>
Public Member Functions | |
| CLandmarksInfoContainer (CAknView &aView, CLandmarksApplicationEngine &aEngine, CAknNavigationDecorator *aNaviDecorator) | |
| void | ConstructL (const TRect &aRect) |
| ~CLandmarksInfoContainer () | |
| void | MakeNaviPaneVisibleL (TBool aVisible) |
| void | StoreTitlePaneL () |
| void | RestoreTitlePane () |
| void | LoadLandmarkL (TPosLmItemId aLandmarkId) |
| void | EditLandmarkL () |
| TInt | CountComponentControls () const |
| CCoeControl * | ComponentControl (TInt aIndex) const |
| void | SizeChanged () |
| TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| void | HandleResourceChange (TInt aType) |
Private Member Functions | |
| void | CreateListBoxL () |
| void | UpdateTitleBarL () |
| void | UpdateL () |
Private Attributes | |
| CEikTextListBox * | iListBox |
| The control used to display landmark info. | |
| CAknView & | iView |
| The parent view. | |
| CLandmarksApplicationEngine & | iEngine |
| iEngine the application engine used for accessing landmarks | |
| CAknNavigationDecorator * | iNaviDecorator |
| Decorates the navi pane (with navigation arrows etc). | |
| CLandmarksInfoModel * | iModel |
| The data model for the listbox. | |
| CPosLandmark * | iLandmark |
| The landmark being viewed. | |
| CAknTitlePane * | iTitlePane |
| The title pane that is dynamically updated. | |
| HBufC * | iOriginalTitle |
| The original title that the title pane displayed before modified. | |
| RArray< TInt > | iFields |
| Fields used in the list. | |
Definition at line 39 of file LandmarksInfoContainer.h.
|
||||||||||||||||
|
C++ constructor.
Definition at line 40 of file LandmarksInfoContainer.cpp. 00044 : iView(aView), 00045 iEngine(aEngine), 00046 iNaviDecorator(aNaviDecorator) 00047 { 00048 }
|
|
|
Destructor. Definition at line 68 of file LandmarksInfoContainer.cpp. References iFields, iLandmark, iListBox, and iModel. 00069 { 00070 iFields.Close(); 00071 delete iListBox; 00072 delete iLandmark; 00073 delete iModel; 00074 }
|
|
|
Symbian 2nd phase constructor. Should be called after constructor to fully construct the object.
Definition at line 55 of file LandmarksInfoContainer.cpp. References CreateListBoxL(), iEngine, and iModel. 00056 { 00057 CreateWindowL(); 00058 CreateListBoxL(); 00059 00060 // Create data model. 00061 iModel = new (ELeave) CLandmarksInfoModel(iEngine); 00062 00063 SetRect(aRect); 00064 ActivateL(); 00065 }
|
|
|
Enables/disables the navi pane.
Definition at line 188 of file LandmarksInfoContainer.cpp. References iNaviDecorator. 00189 { 00190 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); 00191 CAknNavigationControlContainer* naviPane = 00192 (CAknNavigationControlContainer*) statusPane-> 00193 ControlL(TUid::Uid(EEikStatusPaneUidNavi)); 00194 00195 if (!aVisible) 00196 { 00197 // Remove tabs from this view's navi pane 00198 naviPane->Pop(iNaviDecorator); 00199 } 00200 else 00201 { 00202 // Recreate tabs to this view's navi pane 00203 naviPane->PushL(*iNaviDecorator); 00204 } 00205 }
|
|
|
Stores title pane Definition at line 154 of file LandmarksInfoContainer.cpp. References iOriginalTitle, and iTitlePane. 00155 { 00156 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); 00157 iTitlePane = (CAknTitlePane*) statusPane->ControlL( 00158 TUid::Uid(EEikStatusPaneUidTitle)); 00159 00160 iOriginalTitle = iTitlePane->Text()->AllocL(); 00161 }
|
|
|
Retores title pane Definition at line 169 of file LandmarksInfoContainer.cpp. References iOriginalTitle, and iTitlePane. 00170 { 00171 if (iTitlePane && iOriginalTitle) 00172 { 00173 iTitlePane->SetText(iOriginalTitle); // ownership is transferred 00174 } 00175 else 00176 { 00177 delete iOriginalTitle; 00178 } 00179 iOriginalTitle = NULL; 00180 }
|
|
|
Loads specified landmark into the container
Definition at line 259 of file LandmarksInfoContainer.cpp. References iEngine, iLandmark, iListBox, CLandmarksApplicationEngine::LandmarkLC(), and UpdateL(). 00260 { 00261 delete iLandmark; 00262 iLandmark = NULL; 00263 00264 iLandmark = iEngine.LandmarkLC(aLandmarkId); 00265 CleanupStack::Pop(iLandmark); 00266 00267 UpdateL(); 00268 iListBox->View()->SetCurrentItemIndex(0); 00269 }
|
|
|
Launches a dialog for editing the current landmark. Removes tabs on the navi pane before launching the dialog. Restores the navi pane after the dialog is dismissed. Definition at line 277 of file LandmarksInfoContainer.cpp. References CLandmarksApplicationEngine::CommitLandmarkL(), iEngine, iFields, iLandmark, iListBox, CLandmarksEditDialog::NewLC(), and UpdateL(). 00278 { 00279 // Create editor 00280 TBool isEdited = EFalse; 00281 00282 TInt selectedLine = iListBox->View()->CurrentItemIndex(); 00283 TInt activeField = 0; 00284 if (selectedLine >= 0 && selectedLine < iFields.Count()) 00285 { 00286 activeField = iFields[selectedLine]; 00287 } 00288 00289 CLandmarksEditDialog* editDialog = CLandmarksEditDialog::NewLC( 00290 *iLandmark, EFalse, isEdited, iEngine, activeField); 00291 00292 TInt err = editDialog->ExecuteLD(R_LMREFAPP_EDIT_DIALOG); 00293 CleanupStack::Pop(editDialog); 00294 User::LeaveIfError(err); 00295 00296 // Commit if edited 00297 if (isEdited) 00298 { 00299 iEngine.CommitLandmarkL(*iLandmark); 00300 UpdateL(); 00301 00302 // move to first field 00303 iListBox->View()->SetCurrentItemIndex(0); 00304 } 00305 }
|
|
|
Gets the number of controls contained in a compound control
Definition at line 82 of file LandmarksInfoContainer.cpp. References iListBox. 00083 { 00084 TInt count = 0; 00085 if (iListBox) 00086 { 00087 count++; 00088 } 00089 00090 return count; // Return the number of controls inside this container. 00091 }
|
|
|
Gets the specified component
Definition at line 99 of file LandmarksInfoContainer.cpp. References iListBox. 00100 { 00101 switch (aIndex) 00102 { 00103 case 0: 00104 return iListBox; // Returns the pointer to listbox object. 00105 default: 00106 return NULL; // Exception : Returns NULL. 00107 } 00108 }
|
|
|
Called by framework when the view size is changed. Definition at line 232 of file LandmarksInfoContainer.cpp. References iListBox. 00233 { 00234 // Set list box size. 00235 iListBox->SetRect(Rect()); 00236 }
|
|
||||||||||||
|
Handles key events.
Definition at line 116 of file LandmarksInfoContainer.cpp. References EditLandmarkL(), and iListBox. 00118 { 00119 TKeyResponse response = EKeyWasNotConsumed; 00120 00121 switch (aKeyEvent.iCode) 00122 { 00123 case EKeyUpArrow: 00124 case EKeyDownArrow: 00125 // Scrolling the listbox. Forward to iListBox. 00126 response = iListBox->OfferKeyEventL(aKeyEvent, aType); 00127 break; 00128 00129 case EKeyLeftArrow: 00130 case EKeyRightArrow: 00131 // Eat these to disable switching views 00132 response = EKeyWasConsumed; 00133 break; 00134 00135 case EKeyDevice3: 00136 EditLandmarkL(); 00137 response = EKeyWasConsumed; 00138 break; 00139 00140 default: 00141 // menu keys should be handled 00142 break; 00143 } 00144 00145 return response; 00146 }
|
|
|
Reacts to screen size change Definition at line 244 of file LandmarksInfoContainer.cpp. References iView. 00245 { 00246 CCoeControl::HandleResourceChange(aType); 00247 if ( aType == KEikDynamicLayoutVariantSwitch ) 00248 { 00249 SetRect(iView.ClientRect()); 00250 } 00251 }
|
|
|
Creates the listbox. Definition at line 213 of file LandmarksInfoContainer.cpp. References iListBox. 00214 { 00215 // Create a control to display a list of descriptors 00216 iListBox = new (ELeave) CAknSingleHeadingStyleListBox(); 00217 iListBox->SetContainerWindowL(*this); 00218 iListBox->ConstructL(this, 0); 00219 00220 // Create scrollbars 00221 CEikScrollBarFrame* scrollBar = iListBox->CreateScrollBarFrameL(); 00222 scrollBar->SetScrollBarVisibilityL( 00223 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); 00224 }
|
|
|
Updates the title bar from landmark name. Definition at line 331 of file LandmarksInfoContainer.cpp. References iLandmark, iOriginalTitle, and iTitlePane. 00332 { 00333 TPtrC ptr; 00334 if (iLandmark) 00335 { 00336 iLandmark->GetLandmarkName(ptr); 00337 iTitlePane->SetTextL(ptr); 00338 } 00339 else 00340 { 00341 iTitlePane->SetTextL(*iOriginalTitle); 00342 } 00343 }
|
|
|
Updates the view. Definition at line 313 of file LandmarksInfoContainer.cpp. References CLandmarksInfoModel::GetLandmarkInfoL(), iFields, iLandmark, iListBox, iModel, and UpdateTitleBarL(). 00314 { 00315 CDesCArray* infoArray = iModel->GetLandmarkInfoL(*iLandmark, iFields); 00316 00317 CTextListBoxModel* model = iListBox->Model(); 00318 model->SetItemTextArray(infoArray); 00319 model->SetOwnershipType(ELbmOwnsItemArray); 00320 iListBox->HandleItemAdditionL(); 00321 00322 UpdateTitleBarL(); 00323 }
|
|
© Nokia 2006 |