|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <LandmarksCategoriesView.h>
Public Member Functions | |
| ~CLandmarksCategoriesView () | |
| TUid | Id () const |
| void | HandleCommandL (TInt aCommand) |
| void | DoActivateL (const TVwsViewId &aPrevViewId, TUid aCustomMessageId, const TDesC8 &aCustomMessage) |
| void | DoDeactivate () |
| void | DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane) |
Static Public Member Functions | |
| static CLandmarksCategoriesView * | NewLC (CLandmarksApplicationEngine *aEngine) |
Private Member Functions | |
| CLandmarksCategoriesView (CLandmarksApplicationEngine *aEngine) | |
| void | ConstructL () |
| void | AddCategoryL () |
| void | RenameCategoryL () |
Private Attributes | |
| CLandmarksCategoriesContainer * | iContainer |
| The container containing the graphical components of the view. | |
| CLandmarksApplicationEngine * | iEngine |
| The application engine used for modifying categories. | |
Definition at line 33 of file LandmarksCategoriesView.h.
|
|
Destructor. Definition at line 70 of file LandmarksCategoriesView.cpp. References iContainer, and iEngine. 00071 { 00072 delete iContainer; 00073 00074 // This object is responsible for deleting the application engine instance. 00075 delete iEngine; 00076 }
|
|
|
C++ constructor.
Definition at line 37 of file LandmarksCategoriesView.cpp. 00039 : iEngine(aEngine) 00040 { 00041 // No implementation required 00042 }
|
|
|
Two-phased constructor.
Definition at line 59 of file LandmarksCategoriesView.cpp. References CLandmarksCategoriesView(). 00061 { 00062 CLandmarksCategoriesView* self = 00063 new (ELeave) CLandmarksCategoriesView(aEngine); 00064 CleanupStack::PushL(self); 00065 self->ConstructL(); 00066 return self; 00067 }
|
|
|
Id Identity of this view to the system
Definition at line 84 of file LandmarksCategoriesView.cpp.
|
|
|
HandleCommandL handles user menu selections.
Definition at line 95 of file LandmarksCategoriesView.cpp. References AddCategoryL(), CLandmarksCategoriesContainer::DeleteCategoryL(), iContainer, and RenameCategoryL(). 00096 { 00097 switch (aCommand) 00098 { 00099 case ELandmarksDelete: 00100 iContainer->DeleteCategoryL(); 00101 break; 00102 00103 case ELandmarksRename: 00104 RenameCategoryL(); 00105 break; 00106 00107 case ELandmarksAddCategory: 00108 AddCategoryL(); 00109 break; 00110 00111 default: 00112 AppUi()->HandleCommandL(aCommand); 00113 break; 00114 } 00115 }
|
|
||||||||||||||||
|
DoActivateL Responsible for activating this view.
Definition at line 123 of file LandmarksCategoriesView.cpp. References CLandmarksCategoriesContainer::ConstructL(), iContainer, Id(), iEngine, and CLandmarksApplicationEngine::NotifyViewActivated(). 00127 { 00128 if (!iContainer) 00129 { 00130 iContainer = new (ELeave) CLandmarksCategoriesContainer( 00131 *this, *iEngine, *(MenuBar())); 00132 iContainer->SetMopParent(this); 00133 iContainer->ConstructL(ClientRect()); 00134 } 00135 00136 // Enable receiving of keyboard events. 00137 AppUi()->AddToStackL(*this, iContainer); 00138 00139 // Make view visible. 00140 iContainer->MakeVisible(ETrue); 00141 00142 // Notify that this view is active. 00143 TBool isActive = ETrue; 00144 iEngine->NotifyViewActivated(Id(), isActive); 00145 }
|
|
|
DoDeactivate Responsible for deactivating this view. Definition at line 153 of file LandmarksCategoriesView.cpp. References iContainer, Id(), iEngine, and CLandmarksApplicationEngine::NotifyViewActivated(). 00154 { 00155 // Hide view. 00156 iContainer->MakeVisible(EFalse); 00157 00158 // Notify that this view is inactive. 00159 TBool isActive = EFalse; 00160 iEngine->NotifyViewActivated(Id(), isActive); 00161 00162 // Disable receiving keyboard events. 00163 AppUi()->RemoveFromStack(iContainer); 00164 }
|
|
||||||||||||
|
DynInitMenuPaneL initializes the menu pane before it is displayed.
Definition at line 172 of file LandmarksCategoriesView.cpp. References iContainer, CLandmarksCategoriesContainer::IsGlobalL(), and CLandmarksContainerBase::IsItemSelected(). 00175 { 00176 CAknView::DynInitMenuPaneL(aResourceId, aMenuPane); 00177 if (aResourceId == R_LMREFAPP_CATEGORIES_MENU) 00178 { 00179 // If none or a global cat. is selected we need to hide some commands. 00180 TBool dimmed = 00181 !iContainer->IsItemSelected() || iContainer->IsGlobalL(); 00182 aMenuPane->SetItemDimmed(ELandmarksDelete, dimmed); 00183 aMenuPane->SetItemDimmed(ELandmarksRename, dimmed); 00184 } 00185 }
|
|
|
By default Symbian 2nd phase constructor is private. Definition at line 49 of file LandmarksCategoriesView.cpp.
|
|
|
Launches a text query dialog and adds a category to the database. Definition at line 193 of file LandmarksCategoriesView.cpp. References CLandmarksApplicationEngine::AddCategoryL(), and iEngine. 00194 { 00195 // Create and initialize dialog 00196 TBuf<KPosLmMaxCategoryNameLength> categoryName; 00197 CAknTextQueryDialog* queryDialog = CAknTextQueryDialog::NewL(categoryName); 00198 queryDialog->SetMaxLength(KPosLmMaxCategoryNameLength); 00199 CleanupStack::PushL(queryDialog); 00200 00201 // Create and set title 00202 HBufC* title = 00203 iCoeEnv->AllocReadResourceAsDes16LC(R_LMREFAPP_NEW_CATEGORY); 00204 queryDialog->SetPromptL(*title); 00205 CleanupStack::PopAndDestroy(title); 00206 00207 // Launch dialog 00208 TBool dialogDismissed = queryDialog->ExecuteLD(R_LMREFAPP_RENAME_QUERY); 00209 CleanupStack::Pop(queryDialog); 00210 if (dialogDismissed) 00211 { 00212 // Create and add a new category with user defined name. 00213 CPosLandmarkCategory* newCategory = CPosLandmarkCategory::NewLC(); 00214 newCategory->SetCategoryNameL(categoryName); 00215 iEngine->AddCategoryL(*newCategory); 00216 CleanupStack::PopAndDestroy(newCategory); 00217 } 00218 }
|
|
|
Launches a text query dialog and renames a category in the database. Definition at line 226 of file LandmarksCategoriesView.cpp. References CLandmarksApplicationEngine::CategoryLC(), CLandmarksCategoriesContainer::CurrentCategoryId(), iContainer, iEngine, and CLandmarksApplicationEngine::UpdateCategoryL(). 00227 { 00228 // Fetch existing category name 00229 CPosLandmarkCategory* category = 00230 iEngine->CategoryLC(iContainer->CurrentCategoryId()); 00231 TPtrC categoryName; 00232 category->GetCategoryName(categoryName); 00233 TBuf<KPosLmMaxCategoryNameLength> newCategoryName; 00234 newCategoryName.Insert(0, categoryName); 00235 00236 // Create and initialize dialog 00237 CAknTextQueryDialog* queryDialog = 00238 CAknTextQueryDialog::NewL(newCategoryName); 00239 queryDialog->SetMaxLength(KPosLmMaxCategoryNameLength); 00240 CleanupStack::PushL(queryDialog); 00241 00242 // Create and set title 00243 HBufC* title = 00244 iCoeEnv->AllocReadResourceAsDes16LC(R_LMREFAPP_CATEGORY_NAME); 00245 queryDialog->SetPromptL(*title); 00246 CleanupStack::PopAndDestroy(title); 00247 00248 // Launch dialog 00249 TBool dialogAccepted = queryDialog->ExecuteLD(R_LMREFAPP_RENAME_QUERY); 00250 CleanupStack::Pop(queryDialog); 00251 if (dialogAccepted) 00252 { 00253 // Update category name 00254 category->SetCategoryNameL(newCategoryName); 00255 iEngine->UpdateCategoryL(*category); 00256 } 00257 00258 CleanupStack::PopAndDestroy(category); 00259 }
|
|
© Nokia 2006 |