|
Nokia N97 SDK Example Applications Guide |
#include <aknexpoplistview.h>
Inheritance diagram for CAknExPopListView:

Definition at line 45 of file aknexpoplistview.h.
Public Member Functions |
|
| void | ConstructL () |
| virtual | ~CAknExPopListView () |
| TUid | Id () const |
| void | HandleCommandL (TInt aCommand) |
| void | HandleViewRectChange () |
Private Member Functions |
|
| void | DoActivateL (const TVwsViewId &aPrevViewId, TUid aCustomMessageId, const TDesC8 &aCustomMessage) |
| void | DoDeactivate () |
| void | AutoTestL () |
| void | ShowSingleItemPopupListL () |
| void | ShowSingleItemPopupListWithGraphicsL () |
| void | ShowDoubleItemPopupListWithGraphicsL () |
Private Attributes |
|
| CAknExPopListContainer * | iContainer |
| RFs | iFsSession |
| CIconFileProvider * | iIconProvider |
|
|
~CAknExPopListView Virtual Destructor. Definition at line 75 of file aknexpoplistview.cpp. References iContainer, iFsSession, and iIconProvider. 00076 { 00077 if ( iContainer ) 00078 { 00079 AppUi()->RemoveFromStack( iContainer ); 00080 } 00081 delete iContainer; 00082 00083 iFsSession.Close(); 00084 delete iIconProvider; 00085 }
|
|
|
ConstructL 2nd phase constructor. Definition at line 45 of file aknexpoplistview.cpp. References iFsSession, and iIconProvider. 00046 { 00047 BaseConstructL( R_AKNEXPOPLIST_VIEW1 ); 00048 00049 // create and open file server session 00050 User::LeaveIfError(iFsSession.Connect()); 00051 iFsSession.ShareProtected(); 00052 00053 TFileName filePath; 00054 00055 // set path of the bitmap file 00056 User::LeaveIfError(iFsSession.PrivatePath(filePath)); 00057 00058 // append the MBM file name to the private path 00059 filePath.Append(KPathAppMbm); 00060 00061 // insert the drive to the private path 00062 TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName()); 00063 filePath.Insert(0, parse.Drive()); 00064 00065 // with the help of icon-provider AknIconUtils can get get the file 00066 // from this application's private folder 00067 iIconProvider = CIconFileProvider::NewL(iFsSession, filePath); 00068 }
|
|
|
Id From CAknView
Definition at line 92 of file aknexpoplistview.cpp.
|
|
|
HandleCommandL From CAknView, HandleCommandL. Takes care of command handling.
Definition at line 102 of file aknexpoplistview.cpp. References AutoTestL(), ShowDoubleItemPopupListWithGraphicsL(), ShowSingleItemPopupListL(), and ShowSingleItemPopupListWithGraphicsL(). 00103 { 00104 switch ( aCommand ) 00105 { 00106 case EAknSoftkeyBack: 00107 AppUi()->HandleCommandL( EAknCmdExit ); 00108 break; 00109 00110 case EAknExPopListCmdAuto: 00111 case EAKnTaPopListSoftkeyNext: 00112 AutoTestL(); 00113 break; 00114 00115 case EAknExPopListCmdView1Menu2: 00116 ShowSingleItemPopupListL(); 00117 break; 00118 00119 case EAknExPopListCmdView1Menu5: 00120 ShowSingleItemPopupListWithGraphicsL(); 00121 break; 00122 00123 case EAknExPopListCmdView1Menu9: 00124 ShowDoubleItemPopupListWithGraphicsL(); 00125 break; 00126 00127 default: 00128 AppUi()->HandleCommandL( aCommand ); 00129 break; 00130 00131 } 00132 }
|
|
|
HandleViewRectChange From CAknView, handles client rectangle is changed. Definition at line 139 of file aknexpoplistview.cpp. References iContainer. 00140 { 00141 if ( iContainer ) 00142 { 00143 iContainer->SetRect( ClientRect() ); 00144 } 00145 }
|
|
||||||||||||||||
|
DoActivateL From AknView, Creates the container class object.
Definition at line 152 of file aknexpoplistview.cpp. References CAknExPopListContainer::ConstructL(), and iContainer. 00155 { 00156 00157 iContainer = new( ELeave ) CAknExPopListContainer; 00158 iContainer->SetMopParent( this ); 00159 iContainer->ConstructL( ClientRect() ); 00160 AppUi()->AddToStackL( *this, iContainer ); 00161 }
|
|
|
DoDeactivate From AknView, Deletes the container class object. Definition at line 169 of file aknexpoplistview.cpp. References iContainer. 00170 { 00171 if ( iContainer ) 00172 { 00173 AppUi()->RemoveFromStack( iContainer ); 00174 } 00175 00176 delete iContainer; 00177 iContainer = NULL; 00178 }
|
|
|
AutoTestL Show all kinds of popup-windows except list_single_number_pane, list_single_heading_pane and list_single_number_heading_pane automatically. Definition at line 188 of file aknexpoplistview.cpp. References ShowDoubleItemPopupListWithGraphicsL(), ShowSingleItemPopupListL(), and ShowSingleItemPopupListWithGraphicsL(). Referenced by HandleCommandL(). 00189 { 00190 ShowSingleItemPopupListL(); 00191 ShowSingleItemPopupListWithGraphicsL(); 00192 ShowDoubleItemPopupListWithGraphicsL(); 00193 }
|
|
|
ShowSingleItemPopupListL Show "List pane for single item" popup list. Definition at line 201 of file aknexpoplistview.cpp. Referenced by AutoTestL(), and HandleCommandL(). 00202 { 00203 00204 // Create CEikTextListBox instance, list 00205 CEikTextListBox* list = new( ELeave ) CAknSinglePopupMenuStyleListBox; 00206 00207 // Push list'pointer to CleanupStack. 00208 CleanupStack::PushL( list ); 00209 00210 // Create CAknPopupList instance, popupList 00211 CAknPopupList* popupList = CAknPopupList::NewL( list, 00212 R_AVKON_SOFTKEYS_SELECT_CANCEL, 00213 AknPopupLayouts::EMenuWindow ); 00214 // Push popupList'pointer to CleanupStack. 00215 CleanupStack::PushL( popupList ); 00216 00217 00218 // Initialize listbox. 00219 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); 00220 list->CreateScrollBarFrameL( ETrue ); 00221 list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 00222 CEikScrollBarFrame::EAuto ); 00223 00224 // Create CDesCArrayFlat instance, items 00225 CDesCArrayFlat* items = iCoeEnv->ReadDesCArrayResourceL( 00226 R_AKNEXPOPLIST_MENU_ITEMS_TEST1 ); 00227 // Push items'pointer to CleanupStack. 00228 CleanupStack::PushL( items ); 00229 00230 // Set listitems. 00231 CTextListBoxModel* model = list->Model(); 00232 model->SetItemTextArray( items ); 00233 model->SetOwnershipType( ELbmOwnsItemArray ); 00234 00235 CleanupStack::Pop(); 00236 00237 // Show popup list and then show return value. 00238 TInt popupOk = popupList->ExecuteLD(); 00239 00240 // Pop the popupList's pointer from CleanupStack 00241 CleanupStack::Pop(); 00242 00243 if ( popupOk ) 00244 { 00245 TInt index = list->CurrentItemIndex(); 00246 TBuf<KMessageLength> msg; 00247 TBuf<KMessageLength> format; 00248 iCoeEnv->ReadResource( format, R_AKNEXPOPLIST_SELECT_MESSAGE ); 00249 msg.Format( format, index + 1 ); 00250 CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog( 00251 CAknNoteDialog::ENoTone, 00252 CAknNoteDialog::ENoTimeout ); 00253 00254 dlg->PrepareLC( R_AKNEXPOPLIST_SELECT_MESSAGE_NOTE ); 00255 dlg->SetTextPluralityL( EFalse ); 00256 dlg->SetTextL( msg ); 00257 dlg->RunLD(); 00258 } 00259 // Pop and Destroy the list's pointer from CleanupStack 00260 CleanupStack::PopAndDestroy(); 00261 }
|
|
|
ShowSingleItemPopupListWithHeadingAndGraphicsL Show "List pane for single item with heading and graphic" popup list. Definition at line 267 of file aknexpoplistview.cpp. References iIconProvider. Referenced by AutoTestL(), and HandleCommandL(). 00268 { 00269 00270 // Create CAknSingleGraphicPopupMenuStyleListBox instance, list 00271 CAknSingleGraphicPopupMenuStyleListBox* list = 00272 new( ELeave ) CAknSingleGraphicPopupMenuStyleListBox; 00273 00274 // Push list'pointer to CleanupStack. 00275 CleanupStack::PushL( list ); 00276 00277 // Create CAknPopupList instance, popupList 00278 CAknPopupList* popupList = CAknPopupList::NewL( 00279 list, R_AVKON_SOFTKEYS_SELECT_CANCEL, 00280 AknPopupLayouts::EMenuGraphicWindow ); 00281 // Push popupList'pointer to CleanupStack. 00282 CleanupStack::PushL( popupList ); 00283 00284 // Initialize list. 00285 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); 00286 list->CreateScrollBarFrameL( ETrue ); 00287 list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 00288 CEikScrollBarFrame::EAuto ); 00289 // Reads a resource into a descriptor. 00290 CDesCArrayFlat* items = iCoeEnv->ReadDesCArrayResourceL( 00291 R_AKNEXPOPLIST_MENU_ITEMS_TEST2 ); 00292 // Push items'pointer to CleanupStack. 00293 CleanupStack::PushL( items ); 00294 00295 // Set listitems. 00296 CTextListBoxModel* model = list->Model(); 00297 model->SetItemTextArray( items ); 00298 model->SetOwnershipType( ELbmOwnsItemArray ); 00299 CleanupStack::Pop(); 00300 00301 // Create Icon object 00302 CArrayPtr<CGulIcon>* icons = new( ELeave ) CAknIconArray( KMaxIcons ); 00303 00304 // Push icons'pointer to CleanupStack. 00305 CleanupStack::PushL( icons ); 00306 00307 CFbsBitmap* bitmap = AknIconUtils::CreateIconL( *iIconProvider, 00308 EMbmAknexpoplistCard ); 00309 CleanupStack::PushL( bitmap ); 00310 00311 CFbsBitmap* mask = AknIconUtils::CreateIconL( *iIconProvider, 00312 EMbmAknexpoplistCard_mask ); 00313 CleanupStack::PushL( mask ); 00314 icons->AppendL( CGulIcon::NewL( bitmap, mask ) ); 00315 00316 CleanupStack::Pop(); // mask 00317 CleanupStack::Pop(); // bitmap 00318 00319 CFbsBitmap* bitmap2 = AknIconUtils::CreateIconL( *iIconProvider, 00320 EMbmAknexpoplistTel ); 00321 CleanupStack::PushL( bitmap2 ); 00322 00323 CFbsBitmap* mask2 = AknIconUtils::CreateIconL( *iIconProvider, 00324 EMbmAknexpoplistTel_mask ); 00325 CleanupStack::PushL( mask2 ); 00326 icons->AppendL( CGulIcon::NewL( bitmap2, mask2 ) ); 00327 00328 CleanupStack::Pop(); // mask2 00329 CleanupStack::Pop(); // bitmap2 00330 00331 list->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); 00332 00333 // Pop the Icon's pointer from CleanupStack 00334 CleanupStack::Pop(); 00335 00336 list->ClearSelection(); 00337 CArrayFixFlat<TInt>* array1 = new( ELeave ) 00338 CArrayFixFlat<TInt>( KIndexArraySize ); 00339 00340 CleanupStack::PushL( array1 ); 00341 array1->AppendL( 1 ); 00342 array1->AppendL( 2 ); 00343 00344 list->SetSelectionIndexesL( array1 ); 00345 00346 // Pop and Destroy the array1's pointer from CleanupStack 00347 CleanupStack::PopAndDestroy(); 00348 00349 list->ItemDrawer()->SetItemMarkPosition( KInitPos ); 00350 TPtrC blank( KInitPosString ); 00351 list->ItemDrawer()->SetItemMarkReplacement( blank ); 00352 00353 // Set title 00354 // Allocate TBuf with constant length. 00355 TBuf<KMaxTitleLength> title; 00356 00357 // Reads a resource into a descriptor. 00358 iCoeEnv->ReadResource( title, R_AKNEXPOPLIST_MENU_TITLE_TEST2 ); 00359 00360 popupList->SetTitleL( title ); 00361 00362 // Show popup list and then show return value. 00363 TInt popupOk = popupList->ExecuteLD(); 00364 00365 // Pop the popupList's pointer from CleanupStack 00366 CleanupStack::Pop(); 00367 if ( popupOk ) 00368 { 00369 TInt index = list->CurrentItemIndex(); 00370 //Allocate TBuf with constant length. 00371 TBuf<KMessageLength> msg; 00372 00373 //Allocate TBuf with constant length. 00374 TBuf<KMessageLength> format; 00375 00376 // Reads a resource into a descriptor. 00377 iCoeEnv->ReadResource( format, R_AKNEXPOPLIST_SELECT_MESSAGE ); 00378 00379 msg.Format( format, index + 1 ); 00380 CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog( 00381 CAknNoteDialog::ENoTone, 00382 CAknNoteDialog::ENoTimeout ); 00383 00384 dlg->PrepareLC( R_AKNEXPOPLIST_SELECT_MESSAGE_NOTE ); 00385 dlg->SetTextPluralityL( EFalse ); 00386 dlg->SetTextL( msg ); 00387 dlg->RunLD(); 00388 } 00389 00390 // Pop and Destroy the list's pointer from CleanupStack 00391 CleanupStack::PopAndDestroy(); 00392 }
|
|
|
ShowDoubleItemPopupListWithGraphicsL Show "List pane for Double item with large image" popup list. Definition at line 399 of file aknexpoplistview.cpp. References iIconProvider. Referenced by AutoTestL(), and HandleCommandL(). 00400 { 00401 00402 CAknDoubleLargeGraphicPopupMenuStyleListBox* list = 00403 new( ELeave ) CAknDoubleLargeGraphicPopupMenuStyleListBox; 00404 00405 CleanupStack::PushL( list ); 00406 CAknPopupList* popupList = CAknPopupList::NewL( 00407 list, R_AVKON_SOFTKEYS_SELECT_CANCEL, 00408 AknPopupLayouts::EMenuDoubleLargeGraphicWindow ); 00409 CleanupStack::PushL( popupList ); 00410 00411 TInt flags = 0; // Initialize flag 00412 list->ConstructL( popupList, flags ); 00413 list->CreateScrollBarFrameL( ETrue ); 00414 list->ScrollBarFrame()->SetScrollBarVisibilityL( 00415 CEikScrollBarFrame::EOff, 00416 CEikScrollBarFrame::EAuto ); 00417 00418 // Set Item text 00419 CDesCArrayFlat* items = 00420 iCoeEnv->ReadDesCArrayResourceL( R_AKNEXPOPLIST_MENU_ITEMS_TEST5 ); 00421 CleanupStack::PushL( items ); 00422 00423 // Set listitems. 00424 CTextListBoxModel* model = list->Model(); 00425 model->SetItemTextArray( items ); 00426 model->SetOwnershipType( ELbmOwnsItemArray ); 00427 CleanupStack::Pop(); 00428 00429 // Create Icon object 00430 CArrayPtr<CGulIcon>* icons = new( ELeave ) CAknIconArray( KMaxIcons ); 00431 00432 CleanupStack::PushL( icons ); 00433 00434 // Load bitmap and append them to "icons" array. 00435 CFbsBitmap* bitmap = AknIconUtils::CreateIconL( *iIconProvider, 00436 EMbmAknexpoplistFinflag ); 00437 CleanupStack::PushL( bitmap ); 00438 00439 CFbsBitmap* mask = AknIconUtils::CreateIconL( *iIconProvider, 00440 EMbmAknexpoplistFinflag_mask ); 00441 CleanupStack::PushL( mask ); 00442 icons->AppendL( CGulIcon::NewL( bitmap, mask ) ); 00443 00444 CleanupStack::Pop(); // mask 00445 CleanupStack::Pop(); // bitmap 00446 00447 CFbsBitmap* bitmap2 = AknIconUtils::CreateIconL( *iIconProvider, 00448 EMbmAknexpoplistJpnflag ); 00449 CleanupStack::PushL( bitmap2 ); 00450 00451 CFbsBitmap* mask2 = AknIconUtils::CreateIconL( *iIconProvider, 00452 EMbmAknexpoplistJpnflag_mask ); 00453 CleanupStack::PushL( mask2 ); 00454 icons->AppendL( CGulIcon::NewL( bitmap2, mask2 ) ); 00455 00456 CleanupStack::Pop(); // mask2 00457 CleanupStack::Pop(); // bitmap2 00458 00459 list->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); 00460 00461 // Pop the icons's pointer from CleanupStack 00462 CleanupStack::Pop(); 00463 00464 list->ClearSelection(); 00465 CArrayFixFlat<TInt>* array1 = 00466 new( ELeave ) CArrayFixFlat<TInt>( KIndexArraySize ); 00467 00468 CleanupStack::PushL( array1 ); 00469 array1->AppendL( 1 ); 00470 array1->AppendL( 2 ); 00471 00472 list->SetSelectionIndexesL( array1 ); 00473 00474 // Pop and Destroy the array1's pointer from CleanupStack 00475 CleanupStack::PopAndDestroy(); 00476 00477 list->ItemDrawer()->SetItemMarkPosition( KInitPos ); 00478 TPtrC blank( KInitPosString ); 00479 list->ItemDrawer()->SetItemMarkReplacement( blank ); 00480 00481 // Show popup list and then show return value. 00482 TInt popupOk = popupList->ExecuteLD(); 00483 00484 // Pop the popupList's pointer from CleanupStack 00485 CleanupStack::Pop(); 00486 00487 if ( popupOk ) 00488 { 00489 TInt index = list->CurrentItemIndex(); 00490 TBuf<KMessageLength> msg; 00491 TBuf<KMessageLength> format; 00492 iCoeEnv->ReadResource( format, R_AKNEXPOPLIST_SELECT_MESSAGE ); 00493 msg.Format( format, index + 1 ); 00494 00495 CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog( 00496 CAknNoteDialog::ENoTone, CAknNoteDialog::ENoTimeout ); 00497 00498 dlg->PrepareLC( R_AKNEXPOPLIST_SELECT_MESSAGE_NOTE ); 00499 dlg->SetTextPluralityL( EFalse ); 00500 dlg->SetTextL( msg ); 00501 dlg->RunLD(); 00502 } 00503 00504 // Pop and Destroy the list's pointer from CleanupStack 00505 CleanupStack::PopAndDestroy(); 00506 00507 }
|
|
|
iContainer Owned by CAknExPopListView object. Definition at line 142 of file aknexpoplistview.h. Referenced by DoActivateL(), DoDeactivate(), HandleViewRectChange(), and ~CAknExPopListView(). |
|
|
iFSSession, a handle to a file server session. Definition at line 147 of file aknexpoplistview.h. Referenced by ConstructL(), and ~CAknExPopListView(). |
|
© Nokia 2009 |