S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CLandmarksCategoriesDialog Class Reference

#include <LandmarksCategoriesDialog.h>

List of all members.

Public Member Functions

 ~CLandmarksCategoriesDialog ()

Static Public Member Functions

static TInt RunDialogL (CLandmarksLmCategoriesModel &aLmCategoriesModel)

Protected Member Functions

void PostLayoutDynInitL ()
TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)

Private Member Functions

 CLandmarksCategoriesDialog (TInt &aSelectedItem, CArrayFixFlat< TInt > *aMarkedItems, CDesCArray *aListItems)

Private Attributes

CAknTitlePane * iTitlePane
 The title pane that is dynamically updated.
HBufC * iOriginalTitle
 The original title that the title pane displayed before modified.


Detailed Description

CLandmarksCategoriesDialog is a dilog for selecting which categories a landmark belongs to.

Definition at line 37 of file LandmarksCategoriesDialog.h.


Constructor & Destructor Documentation

CLandmarksCategoriesDialog::~CLandmarksCategoriesDialog (   ) 
 

Destructor.

Definition at line 46 of file LandmarksCategoriesDialog.cpp.

References iOriginalTitle, and iTitlePane.

00047         {
00048     // Restore title pane. Ownership of iOriginalTitle transferred.
00049     if (iOriginalTitle && iTitlePane)
00050         {
00051         iTitlePane->SetText(iOriginalTitle);
00052         }
00053         }

CLandmarksCategoriesDialog::CLandmarksCategoriesDialog (  TInt &  aSelectedItem,
CArrayFixFlat< TInt > *  aMarkedItems,
CDesCArray *  aListItems
)  [private]
 

C++ constructor.

Parameters:
aSelectedItem the selected item.
aMarkedItems an array of selected categories.
aListItems array of items to display.

Definition at line 36 of file LandmarksCategoriesDialog.cpp.

00040     : 
00041     CAknMarkableListDialog(aSelectedItem, aMarkedItems, aListItems, -1, -1, NULL)
00042         {
00043         }


Member Function Documentation

TInt CLandmarksCategoriesDialog::RunDialogL (  CLandmarksLmCategoriesModel &  aLmCategoriesModel  )  [static]
 

Creates, executes and destroys the dialog after dismissed.

Parameters:
aLmCategoriesModel landmark categories
Returns:
EFalse if dialog was cancelled

Definition at line 60 of file LandmarksCategoriesDialog.cpp.

References CLandmarksCategoriesDialog(), CLandmarksLmCategoriesModel::FormattedCategoryNamesL(), CLandmarksLmCategoriesModel::SelectCategoriesL(), and CLandmarksLmCategoriesModel::SelectedCategoriesL().

00062     {
00063     // Create array of marked indeces
00064     CArrayFixFlat<TInt>* markedItems = aLmCategoriesModel.SelectedCategoriesL();
00065     CleanupStack::PushL(markedItems);
00066 
00067     // Create name array
00068     CDesCArray* listItems = aLmCategoriesModel.FormattedCategoryNamesL();
00069     CleanupStack::PushL(listItems);
00070 
00071     // Create the dialog
00072     TInt selectedItem = 0;
00073 
00074     CLandmarksCategoriesDialog* dialog = 
00075         new (ELeave) CLandmarksCategoriesDialog(
00076             selectedItem, markedItems, listItems);
00077     
00078         dialog->PrepareLC(R_LMREFAPP_EDIT_CATEGORIES_DIALOG);
00079 
00080         // pre-mark currently selected categories 
00081     CEikListBox* listBox = (CEikListBox*) dialog->Control(ESelectionListControl);
00082     for (TInt i = 0; i < markedItems->Count(); i++)
00083     {
00084         listBox->View()->SelectItemL((*markedItems)[i]);
00085     }
00086 
00087     TInt res = dialog->RunLD();
00088     if (res)
00089         {
00090         aLmCategoriesModel.SelectCategoriesL(*markedItems);
00091         }
00092         
00093     CleanupStack::PopAndDestroy(2, markedItems);
00094     return res;
00095     }

void CLandmarksCategoriesDialog::PostLayoutDynInitL (   )  [protected]
 

Called after the dialog is layed out.

Definition at line 103 of file LandmarksCategoriesDialog.cpp.

References iOriginalTitle, and iTitlePane.

00104     {
00105     CAknMarkableListDialog::PostLayoutDynInitL();
00106     
00107     // Save original title
00108     CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
00109     iTitlePane = (CAknTitlePane*) statusPane->ControlL(
00110         TUid::Uid(EEikStatusPaneUidTitle));
00111     iOriginalTitle = iTitlePane->Text()->AllocL();
00112 
00113     // Update title
00114     HBufC* title = iCoeEnv->AllocReadResourceAsDes16L(
00115         R_LMREFAPP_EDIT_CAT_TITLE);
00116     iTitlePane->SetText(title);
00117     }

TKeyResponse CLandmarksCategoriesDialog::OfferKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [protected]
 

OfferKeyEventL handles key events.

Parameters:
aKeyEvent the key event
aType the type of key event
Returns:
EKeyWasConsumed if keyevent was handled, EKeyWasNotConsumed otherwise

Definition at line 125 of file LandmarksCategoriesDialog.cpp.

00128     {
00129     if (aKeyEvent.iCode == EKeyDevice3)
00130         {
00131         // An item should be marked/unmarked.
00132         CEikListBox* listBox = (CEikListBox*) Control(ESelectionListControl);
00133         listBox->View()->ToggleItemL(listBox->View()->CurrentItemIndex());
00134         listBox->DrawDeferred();
00135         return EKeyWasConsumed;
00136         }
00137 
00138     return CAknMarkableListDialog::OfferKeyEventL(aKeyEvent, aType);
00139     }


© Nokia 2006

Back to top