|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : FilelistContainer.h 00004 * Part of : Filelist 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2005-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 FILELISTCONTAINER_H 00017 #define FILELISTCONTAINER_H 00018 00019 // INCLUDES 00020 #include <coecntrl.h> 00021 #include <eiklbo.h> // MEikListBoxObserver 00022 #include <akngrid.h> // CAknGrid 00023 00024 // CONSTANTS 00025 00026 //Folder IDs 00027 enum TFilelistFolderID 00028 { 00029 EPrivateFolder1 = 1, 00030 EPrivateFolder2 00031 }; 00032 //Grid text length 00033 const TInt KLengthOfItemResourceString = 40; 00034 // In a cell, the area of graphics 00035 const TInt KTextAreaRatio = 3; 00036 // Index of a graphic and text in the resource 00037 const TInt KIndexOfGraphic = 0; 00038 const TInt KIndexOfText = 1; 00039 // The default text color is black. 00040 const TInt KDefaultTextColor = 215; 00041 // The initial number of items to be created. 00042 const TInt KInitialNumOfItemsInSelection = 1; 00043 //Folder path name length 00044 const TInt KPathNameLength = 100; 00045 //Folder name length 00046 const TInt KFolderNameLength = 20; 00047 //Columns in grid 00048 const TInt KGridColumns = 3; 00049 //Rows in grid 00050 const TInt KGridRows = 3; 00051 //Length of empty grid text 00052 const TInt KEmptyGridText = 5; 00053 //Length of error note 00054 const TInt KErrorNoteLength = 100; 00055 00056 00057 // The location of the folders changes in the emulator 00058 // and target builds. 00059 // paths format to private folder 00060 #if defined( __WINS__ ) 00061 _LIT(KPrivateFolderPath1, "Z:%Sfolder1\\*.*"); 00062 _LIT(KPrivateFolderPath2, "Z:%Sfolder2\\*.*"); 00063 _LIT(KProtectedFolderPath, "Z:\\sys\\bin\\*.*"); 00064 #else 00065 // drive-neutral path (MMC-installations safe) 00066 _LIT(KPrivateFolderPath1, "%Sfolder1\\*.*"); 00067 _LIT(KPrivateFolderPath2, "%Sfolder2\\*.*"); 00068 _LIT(KProtectedFolderPath, "\\sys\\bin\\*.*"); 00069 #endif 00070 //icon file 00071 _LIT(KIconName, "\\resource\\apps\\filelist.mif"); 00072 00073 // FORWARD DECLARATIONS 00074 class CAknNavigationDecorator; 00075 class CAknNavigationControlContainer; 00076 class CDir; 00077 00078 // CLASS DECLARATION 00079 /** 00080 * CFilelistContainer container control class. 00081 * 00082 */ 00083 class CFilelistContainer : public CCoeControl, MEikListBoxObserver 00084 { 00085 public: // Constructors and destructor 00086 00087 /** 00088 * NewL. 00089 * Two-phased constructor. 00090 * Construct a CFilelistContainer using two phase construction, 00091 * and return a pointer to the created object 00092 * @return A pointer to the created instance of CFilelistContainer 00093 */ 00094 static CFilelistContainer* NewL( const TRect& aRect ); 00095 00096 /** 00097 * NewLC. 00098 * Two-phased constructor. 00099 * Construct a CFilelistContainer using two phase construction, 00100 * and return a pointer to the created object 00101 * @return A pointer to the created instance of CFilelistContainer 00102 */ 00103 static CFilelistContainer* NewLC( const TRect& aRect ); 00104 00105 00106 /** 00107 * Destructor. 00108 */ 00109 ~CFilelistContainer(); 00110 00111 public: // New functions 00112 00113 /** 00114 * SetGridInitialParameters. 00115 * Sets initial parameters for the grid. 00116 */ 00117 void SetGridInitialParametersL(); 00118 00119 /** 00120 * CreateGridResourceL. 00121 * Prepares resources for the grid. 00122 */ 00123 void CreateGridResourceL(); 00124 00125 /** 00126 * LoadGraphicsL. 00127 * Loads graphic resources. 00128 */ 00129 void LoadGraphicsL(); 00130 00131 /** 00132 * AddDataL. 00133 * Adds data to the grid. 00134 */ 00135 void AddDataL(); 00136 00137 /** 00138 * ApplySelGridGraphicStyle. 00139 * Applies the layout to cells in the grid. 00140 */ 00141 void ApplySelGridGraphicStyle(); 00142 00143 /** 00144 * SetIconSizes. 00145 * Sets size of the icon in iconarray. 00146 * @param aIconArray Iconarray 00147 */ 00148 void SetIconSizes( CArrayPtr<CGulIcon>* aIconArray ); 00149 00150 /** 00151 * CreateFilelist 00152 * Read files in folder and save them to iFilelist 00153 */ 00154 void CreateFilelist( ); 00155 00156 /** 00157 * ChangePrivateFolderL. 00158 * Retrieves data from another private folder. 00159 * @param aDestFolder ID for the target folder 00160 */ 00161 void ChangePrivateFolderL( TInt aDestFolder ); 00162 00163 /** 00164 * ChangeProtectedFolderL. 00165 * Changes to protected folder. 00166 */ 00167 void ChangeProtectedFolderL(); 00168 00169 /** 00170 * ShowErrorNoteL. 00171 * Shows error dialog 00172 * @param aErr System error code 00173 */ 00174 void ShowErrorNoteL( TInt aErr ); 00175 00176 public: // Functions from base classes 00177 00178 private: // Functions from base classes 00179 /** 00180 * From MEikListBoxObserver,HandleListBoxEventL. 00181 */ 00182 void HandleListBoxEventL( CEikListBox* aListBox, 00183 TListBoxEvent aListBoxEvent ); 00184 00185 /** 00186 * From CCoeControl,ConstructL. 00187 * Symbian default constructor. 00188 * @param aRect Frame rectangle for container. 00189 */ 00190 void ConstructL( const TRect& aRect ); 00191 00192 /** 00193 * From CoeControl,SizeChanged. 00194 */ 00195 void SizeChanged(); 00196 00197 /** 00198 * From CCoeControl,Draw. 00199 */ 00200 void Draw( const TRect& aRect ) const; 00201 00202 /** 00203 * From CCoeControl,CountComponentControls. 00204 */ 00205 TInt CountComponentControls() const; 00206 00207 /** 00208 * From CCoeControl,ComponentControl. 00209 */ 00210 CCoeControl* ComponentControl( TInt aIndex ) const; 00211 00212 /** 00213 * From CCoeControl,OfferKeyEventL. 00214 */ 00215 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 00216 TEventCode aType ); 00217 00218 /** 00219 * From CoeControl, HandleResourceChange. 00220 * Called by framework when the view layout is changed. 00221 */ 00222 // virtual void HandleResourceChange( TInt aType ); 00223 00224 private: // New functions 00225 /** 00226 * SetFolderID. 00227 * Sets folderID. 00228 * @param aFolderID FolderID 00229 */ 00230 void SetFolderID( TInt aFolderID ); 00231 00232 /** 00233 * GetFolderID. 00234 * Returns folder ID 00235 * @return The ID of the current folder. 00236 */ 00237 TInt FolderID() const; 00238 00239 /** 00240 * SetEmptyTextL. 00241 * Sets text to empty grid 00242 */ 00243 void SetEmptyTextL(); 00244 00245 /** 00246 * SetNaviPaneTextL. 00247 * Sets text to Navigation Pane 00248 */ 00249 void SetNaviPaneTextL(); 00250 00251 private: //data 00252 /** 00253 * iGrid, the grid shown in this view. 00254 */ 00255 CAknGrid* iGrid; 00256 00257 /** 00258 * iGridM, model for iGrid 00259 */ 00260 CAknGridM* iGridM; 00261 00262 /** 00263 * iVerticalOrientation, vertical orietation status 00264 */ 00265 TBool iVerticalOrientation; 00266 00267 /** 00268 * iLeftToRight, fill order status 00269 */ 00270 TBool iLeftToRight; 00271 00272 /** 00273 * iTopToBottom, fill order status 00274 */ 00275 TBool iTopToBottom; 00276 00277 /** 00278 * iNumOfColumns, number of grid columns 00279 */ 00280 TInt iNumOfColumns; 00281 00282 /** 00283 * iNumOfRows, number of grid rows 00284 */ 00285 TInt iNumOfRows; 00286 00287 /** 00288 * iContentType, type of content 00289 */ 00290 TInt iContentType; 00291 00292 /** 00293 * iSizeOfCell, size of grid cell 00294 */ 00295 TSize iSizeOfCell; 00296 00297 /** 00298 * iNumOfItems, number of grid items 00299 */ 00300 TInt iNumOfItems; 00301 00302 /** 00303 * iVerticalScrollingType, scrolling type 00304 */ 00305 CAknGridView::TScrollingType iVerticalScrollingType; 00306 00307 /** 00308 * iHorizontalScrollingType, scrolling type 00309 */ 00310 CAknGridView::TScrollingType iHorizontalScrollingType; 00311 00312 /** 00313 * iFilelist, file list 00314 */ 00315 CDir* iFilelist; 00316 00317 /** 00318 * iBitmap, grid icon 00319 */ 00320 CFbsBitmap* iBitmap; 00321 00322 /** 00323 * iMask, mask of grid icon 00324 */ 00325 CFbsBitmap* iMask; 00326 00327 /** 00328 * iFolderID, ID to current private folder 00329 */ 00330 TInt iFolderID; 00331 00332 /** 00333 * iNaviDecorator 00334 */ 00335 CAknNavigationDecorator* iNaviDecorator; 00336 00337 /** 00338 * iNaviPane 00339 */ 00340 CAknNavigationControlContainer* iNaviPane; 00341 00342 /** 00343 * iSession file server session 00344 */ 00345 RFs iSession; 00346 }; 00347 00348 #endif 00349 00350 // End of File
|
© Nokia 2006 |