|         |      1 /* | 
|         |      2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). | 
|         |      3 * All rights reserved. | 
|         |      4 * This component and the accompanying materials are made available | 
|         |      5 * under the terms of "Eclipse Public License v1.0"" | 
|         |      6 * which accompanies this distribution, and is available | 
|         |      7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". | 
|         |      8 * | 
|         |      9 * Initial Contributors: | 
|         |     10 * Nokia Corporation - initial contribution. | 
|         |     11 * | 
|         |     12 * Contributors: | 
|         |     13 * | 
|         |     14 * Description:  Navigation pane for file manager | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18  | 
|         |     19  | 
|         |     20 #ifndef CFILEMANAGERFOLDERNAVIGATIONPANE_H | 
|         |     21 #define CFILEMANAGERFOLDERNAVIGATIONPANE_H | 
|         |     22  | 
|         |     23 // INCLUDES | 
|         |     24 #include <coecntrl.h> | 
|         |     25 #include <AknUtils.h> // TAknLayoutRect, TAknLayoutText | 
|         |     26 #include <aknlongtapdetector.h> | 
|         |     27 #include <AknsItemID.h> | 
|         |     28  | 
|         |     29 // CONSTANTS | 
|         |     30 const TInt KFileManagerMaxFolderDepth = 5; // Includes the root | 
|         |     31  | 
|         |     32 // FORWARD DECLARATIONS | 
|         |     33 class CFbsBitmap; | 
|         |     34 class MFileManagerFolderNaviObserver; | 
|         |     35  | 
|         |     36 // CLASS DECLARATION | 
|         |     37  | 
|         |     38 /** | 
|         |     39  * Folder navigation pane for File Manager. | 
|         |     40  * Custom navigation pane to show folder depth of the | 
|         |     41  * current folder in navigation pane using folder icons. | 
|         |     42  * | 
|         |     43  *  @lib FileManagerView.lib | 
|         |     44  *  @since S60 2.0 | 
|         |     45  */ | 
|         |     46 class CFileManagerFolderNavigationPane : | 
|         |     47         public CCoeControl, | 
|         |     48         public MAknLongTapDetectorCallBack | 
|         |     49     { | 
|         |     50     private: | 
|         |     51         /** | 
|         |     52          * Folder indicator set. | 
|         |     53          */ | 
|         |     54         class TIndicatorSet | 
|         |     55             { | 
|         |     56             public: // New functions | 
|         |     57                 /** | 
|         |     58                  * Compares two indicator sets. | 
|         |     59                  * @param aFirst First indicator set to compare. | 
|         |     60                  * @param aSecond The other indicator set to compare. | 
|         |     61                  * @return ETrue if sets are equal, EFalse otherwise. | 
|         |     62                  */ | 
|         |     63                 static TBool Compare( | 
|         |     64                     const TIndicatorSet& aFirst, | 
|         |     65                     const TIndicatorSet& aSecond ); | 
|         |     66  | 
|         |     67             public: // Data | 
|         |     68                 /// id | 
|         |     69                 TInt iId; | 
|         |     70                 /// Bitmap file name | 
|         |     71                 TFileName iBmpFile; | 
|         |     72                 /// Icon bitmap id | 
|         |     73                 TInt iIconId; | 
|         |     74                 /// Mask bitmap id | 
|         |     75                 TInt iMaskId; | 
|         |     76                 /// Skin ID | 
|         |     77                 TAknsItemID iAknsItemIdRoot; | 
|         |     78  | 
|         |     79             }; | 
|         |     80  | 
|         |     81     public: // Constructors and destructor | 
|         |     82  | 
|         |     83         /** | 
|         |     84          * Two-phased constructor. | 
|         |     85          * @param aRoot Id of the root indicator | 
|         |     86          * @param aDepth Depth of the navigation | 
|         |     87          * @param aReader Resource reader for reading navigation pane from | 
|         |     88          *                resource file. | 
|         |     89          * @return Newly created navigation pane. | 
|         |     90          */ | 
|         |     91         IMPORT_C static CFileManagerFolderNavigationPane* NewL( | 
|         |     92             const TInt aRoot, | 
|         |     93             const TInt aDepth, | 
|         |     94             TResourceReader& aReader ); | 
|         |     95  | 
|         |     96         /** | 
|         |     97          * Destructor. | 
|         |     98          */ | 
|         |     99         IMPORT_C ~CFileManagerFolderNavigationPane(); | 
|         |    100  | 
|         |    101  | 
|         |    102     public: // New functions | 
|         |    103  | 
|         |    104         /** | 
|         |    105          * Specifies how many subfolder icons are displayed. | 
|         |    106          * Depth range is 0..n ( 0 = root, 1 = root+subfolder, etc. ) | 
|         |    107          * Depth over 4 is displayed just as tree dots at the end of navipane. | 
|         |    108          * @param aDepth set current depth | 
|         |    109          */ | 
|         |    110         IMPORT_C void SetFolderDepth( const TInt aDepth ); | 
|         |    111  | 
|         |    112         /** | 
|         |    113          * Return current folder depth. | 
|         |    114          * @return aDepth return current depth | 
|         |    115          */ | 
|         |    116         IMPORT_C TInt FolderDepth() const; | 
|         |    117  | 
|         |    118         /** | 
|         |    119          * Changes the active root | 
|         |    120          * @param aRoot Id of the root indicator | 
|         |    121          */ | 
|         |    122         IMPORT_C void ChangeRootL( const TInt aRoot ); | 
|         |    123  | 
|         |    124         /** | 
|         |    125          * Handles resource change | 
|         |    126          * @param aType Change type | 
|         |    127          */ | 
|         |    128         IMPORT_C void HandleResourceChangeL( TInt aType ); | 
|         |    129  | 
|         |    130         /** | 
|         |    131          * Sets navigation observer | 
|         |    132          * @param aObserver Pointer to navigation observer | 
|         |    133          */ | 
|         |    134         IMPORT_C void SetObserver( | 
|         |    135             MFileManagerFolderNaviObserver* aObserver ); | 
|         |    136  | 
|         |    137     protected: // Functions From CCoeControl | 
|         |    138  | 
|         |    139         /** | 
|         |    140          * @see CCoeControl | 
|         |    141          */ | 
|         |    142         void SizeChanged(); | 
|         |    143  | 
|         |    144         /** | 
|         |    145          * @see CCoeControl | 
|         |    146          */ | 
|         |    147         void Draw( const TRect& aRect ) const; | 
|         |    148  | 
|         |    149         /** | 
|         |    150          * @see CCoeControl | 
|         |    151          */ | 
|         |    152         void HandlePointerEventL( | 
|         |    153             const TPointerEvent& aPointerEvent ); | 
|         |    154  | 
|         |    155      private: // From MAknLongTapDetectorCallBack | 
|         |    156         /** | 
|         |    157          * @see MAknLongTapDetectorCallBack | 
|         |    158          */ | 
|         |    159         void HandleLongTapEventL( | 
|         |    160             const TPoint& aPenEventLocation,  | 
|         |    161             const TPoint& aPenEventScreenLocation ); | 
|         |    162  | 
|         |    163     private: | 
|         |    164  | 
|         |    165         /** | 
|         |    166          * C++ default constructor. | 
|         |    167          * @param aDepth Depth of the navigation | 
|         |    168          */ | 
|         |    169         CFileManagerFolderNavigationPane( | 
|         |    170             const TInt aRoot, const TInt aDepth ); | 
|         |    171  | 
|         |    172         /** | 
|         |    173          * By default Symbian 2nd phase constructor is private. | 
|         |    174          * @param aRoot Id of the root indicator  | 
|         |    175          * @param aReader Resource reader for reading navigation pane from | 
|         |    176          *                resource file. | 
|         |    177          */ | 
|         |    178         void ConstructL( TResourceReader& aReader ); | 
|         |    179  | 
|         |    180     private: // New functions | 
|         |    181         /** | 
|         |    182          * Notifies CCoeControl to redraw the pane | 
|         |    183          */ | 
|         |    184         void ReportChange(); | 
|         |    185  | 
|         |    186         /** | 
|         |    187          * Loads folder bitmaps | 
|         |    188          */ | 
|         |    189         void LoadFolderBitmapL(); | 
|         |    190  | 
|         |    191         /** | 
|         |    192          * Checks does position map to drawn navigation level icon | 
|         |    193          */ | 
|         |    194         TInt CheckHitFolderLevel( const TPoint& aPos ); | 
|         |    195  | 
|         |    196     private: // Data | 
|         |    197  | 
|         |    198         // 0 = phone, 1 = MMC | 
|         |    199         TInt iRoot; | 
|         |    200  | 
|         |    201         /// Own: Bitmap for subfolders | 
|         |    202         CFbsBitmap* iFolderBitmap; | 
|         |    203  | 
|         |    204         /// Own: Bitmap mask for subfolders | 
|         |    205         CFbsBitmap* iFolderMask; | 
|         |    206  | 
|         |    207         /// Own: Name of the bitmap file for folder icon and mask | 
|         |    208         HBufC* iBmpFile; | 
|         |    209  | 
|         |    210         /// Id for folder icon bitmap | 
|         |    211         TInt iFolderIconId; | 
|         |    212  | 
|         |    213         /// Id for folder icon mask | 
|         |    214         TInt iFolderMaskId; | 
|         |    215  | 
|         |    216         /// Own: Separator character for folders | 
|         |    217         HBufC* iSeparator; | 
|         |    218  | 
|         |    219         /// Own: The end character append to the indicator after iMaxDepth is reached | 
|         |    220         HBufC* iEndChar; | 
|         |    221  | 
|         |    222         /// Id for folder skin | 
|         |    223         TAknsItemID iAknsItemIdFolder; | 
|         |    224  | 
|         |    225         /// Maximum folder depth displayed in indicator | 
|         |    226         TInt iMaxDepth; | 
|         |    227  | 
|         |    228         /// Own: Bitmap for rootfolder | 
|         |    229         CFbsBitmap* iRootBitmap; | 
|         |    230  | 
|         |    231         /// Own: Bitmap mask for rootfolder | 
|         |    232         CFbsBitmap* iRootMask; | 
|         |    233  | 
|         |    234         /// Rectangles where bitmaps are drawn ( 0 = rootbitmap, 1..max = defaultbitmaps ) | 
|         |    235         TFixedArray<TAknLayoutRect, KFileManagerMaxFolderDepth> iBitmapLayout; | 
|         |    236  | 
|         |    237         /// Rectangles where slashs are drawn ( 0..max = \, max + 1 = ... ) | 
|         |    238         TFixedArray<TAknLayoutText, KFileManagerMaxFolderDepth + 1> iTextLayout; | 
|         |    239  | 
|         |    240         /// Folder depth | 
|         |    241         TInt iDepth; | 
|         |    242  | 
|         |    243         /// Array to store folder indicators | 
|         |    244         RArray<TIndicatorSet> iIndicatorArray; | 
|         |    245  | 
|         |    246         /// Ref: Pointer to navigation observer | 
|         |    247         MFileManagerFolderNaviObserver* iObserver; | 
|         |    248  | 
|         |    249         /// Own: For long tap detecting | 
|         |    250         CAknLongTapDetector* iLongTapDetector; | 
|         |    251  | 
|         |    252         /// For long tap handling | 
|         |    253         TBool iLongTap; | 
|         |    254     }; | 
|         |    255  | 
|         |    256 #endif // CMGNAVIPANEOLDERINDICATOR_H | 
|         |    257  | 
|         |    258 // End of File |