|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : LandmarksModel.h 00004 * Part of : Landmark Reference Application 00005 * Interface : - 00006 * Description : See class description below 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 #ifndef __LANDMARKS_MODEL_H__ 00017 #define __LANDMARKS_MODEL_H__ 00018 00019 // INCLUDES 00020 #include <e32base.h> 00021 #include <badesca.h> 00022 00023 #include <EPos_Landmarks.h> 00024 00025 // FORWARD DECLARATIONS 00026 class CPosLandmark; 00027 00028 // CLASS DECLARATION 00029 00030 /** 00031 * Contains the data model of the landmarks view. 00032 * 00033 */ 00034 class CLandmarksModel : public CBase 00035 { 00036 public: // Constructors and destructor 00037 00038 /** 00039 * Two-phased constructor. 00040 */ 00041 static CLandmarksModel* NewL(); 00042 00043 /** 00044 * Destructor. 00045 */ 00046 ~CLandmarksModel(); 00047 00048 public: // New functions 00049 00050 /** 00051 * Sets the data member iItemIds 00052 * 00053 * @param aItemIds a pointer to an array of item ids 00054 */ 00055 void SetItemIds(RArray<TPosLmItemId>* aItemIds); 00056 00057 /** 00058 * Returns a pointer to an array to be used for a list box. 00059 * 00060 * @return an array of descriptors formatted to fit a CEikColumnListBox 00061 * with one icon column to the left and one descriptor column to the 00062 * right. 00063 */ 00064 CDesCArraySeg* ItemList(); 00065 00066 /** 00067 * Sets current item in the model. The current item should match the 00068 * current selected one in the listbox displaying this model. 00069 * 00070 * @param aIndex the index of the current item in the list. 00071 */ 00072 void SetCurrentItem(TInt aIndex); 00073 00074 /** 00075 * Returns the item id of the current item in the model. 00076 * 00077 * @return the item id of the current item in the model. 00078 * KPosLmNullItemId if no item is set as current 00079 */ 00080 TPosLmItemId CurrentItemId(); 00081 00082 /** 00083 * Creates an array of icons that should be displayed be the listbox 00084 * displaying the data of this model. 00085 * 00086 * @return an array of icons. Ownership of CIconList* is tranferred to 00087 * caller 00088 */ 00089 CIconList* CreateIconListL(); 00090 00091 /** 00092 * Repopulates a part of the model. 00093 * 00094 * @param aLandmarks the landmarks to insert to the model 00095 */ 00096 void RepopulateModelL( 00097 CArrayPtr<CPosLandmark>* aLandmarks); 00098 00099 private: 00100 00101 /** 00102 * Formats a list item to fit a CEikColumnistBox with one graphic 00103 * column and one descriptor column. 00104 * 00105 * @param aLandmark the landmarks this list item will represent 00106 * @return a formatted descriptor buffer 00107 */ 00108 HBufC* FormatListItemLC(CPosLandmark& aLandmark); 00109 00110 /** 00111 * Appends an icen to the icon array. 00112 * 00113 * @param aMbmFile the multi bitmap file containing the icon to add 00114 * @param aIconOffset the offset in the mbm-file where the icon is 00115 * located 00116 * @param aMaskOffset the offset in the mbm-file where the icon mask is 00117 * located 00118 */ 00119 void AppendIconL( 00120 const TDesC& aMbmFile, 00121 TInt aIconOffset, 00122 TInt aMaskOffset); 00123 00124 private: 00125 00126 /** 00127 * C++ constructor. 00128 */ 00129 CLandmarksModel(); 00130 00131 /** 00132 * By default Symbian 2nd phase constructor is private. 00133 */ 00134 void ConstructL(); 00135 00136 private: 00137 00138 //! contains the current item in the model 00139 TInt iCurrentItem; 00140 00141 //! an array of formatted descriptors 00142 CDesCArraySeg* iListItems; 00143 00144 //! an array of item ids matching the landmarks represented by iListItems 00145 RArray<TPosLmItemId>* iItemIds; 00146 00147 //! an array of landmark icons 00148 CIconList* iIconList; 00149 00150 //! the next index to repopulate 00151 TInt iIndexToPopulate; 00152 00153 }; 00154 00155 #endif // __LANDMARKS_MODEL_H__ 00156 00157 // End of File 00158
|
© Nokia 2006 |