filemanager/App/inc/CFileManagerFileListContainer.h
changeset 0 6a9f87576119
child 10 875fd7f60fdf
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:  File list container in file manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CFILEMANAGERFILELISTCONTAINER_H
       
    20 #define CFILEMANAGERFILELISTCONTAINER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "CFileManagerContainerBase.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CFileManagerDocument;
       
    27 class CFileManagerAppUi;
       
    28 class CAknSearchField;
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * File list container in File Manager.
       
    34  * Replaces old phone memory, memory card, folder and search specific
       
    35  * containers.
       
    36  */
       
    37 class CFileManagerFileListContainer : public CFileManagerContainerBase,
       
    38                                       public MCoeFocusObserver
       
    39     {
       
    40     public:
       
    41         enum TListType
       
    42             {
       
    43             EListMain = 0, // Main layout
       
    44             EListMemoryStore, // Memory store (Phone memory etc) layout
       
    45             EListFolder // Folder layout
       
    46             };
       
    47 
       
    48         static CFileManagerFileListContainer*
       
    49             CFileManagerFileListContainer::NewL(
       
    50                 const TRect& aRect,
       
    51                 const TInt aFocusedIndex,
       
    52                 const TListType aType,
       
    53                 const TInt aEmptyText,
       
    54                 const TDesC& aHelpContext );
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         ~CFileManagerFileListContainer();
       
    60 
       
    61     private: // MCoeControlObserver
       
    62         void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
       
    63 
       
    64     private: // From CCoeControl
       
    65         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
       
    66 
       
    67         void HandlePointerEventL( const TPointerEvent &aPointerEvent );
       
    68 
       
    69         void SizeChanged();
       
    70 
       
    71         TInt CountComponentControls() const;
       
    72 
       
    73         CCoeControl* ComponentControl( TInt aIndex ) const;
       
    74 
       
    75     public: // From CFileManagerContainerBase
       
    76         void SetListEmptyL();
       
    77 
       
    78         void RefreshListL( TInt aFocusedIndex );
       
    79 
       
    80         CEikTextListBox* CreateListBoxL();
       
    81 
       
    82         void UpdateCba();
       
    83 
       
    84         TInt ListBoxCurrentItemIndex();
       
    85 
       
    86         TInt ListBoxNumberOfItems();
       
    87 
       
    88         const CArrayFix< TInt >* ListBoxSelectionIndexes();
       
    89 
       
    90         TInt ListBoxSelectionIndexesCount();
       
    91 
       
    92         void ListBoxToggleItemL( TInt aIndex );
       
    93 
       
    94         TBool ListBoxIsItemSelected( TInt aIndex );
       
    95 
       
    96         void ListBoxSetTextL( const TDesC& aText );
       
    97 
       
    98         TBool IsSearchFieldVisible() const;
       
    99 
       
   100         void EnableSearchFieldL(
       
   101             TBool aEnable, const TDesC& aSearchText = KNullDesC );
       
   102 
       
   103         void SetCurrentItemIndexAfterSearch( TInt aIndex );
       
   104 
       
   105         void ListBoxSelectItemL( TInt aIndex );
       
   106 
       
   107         void ListBoxDeselectItem( TInt aIndex );
       
   108 
       
   109     private: // From MCoeFocusObserver
       
   110         void HandleChangeInFocus();
       
   111 
       
   112         void HandleDestructionOfFocusedItem();
       
   113 
       
   114     private:
       
   115         /**
       
   116          * Standard C++ constructor.
       
   117          */
       
   118         CFileManagerFileListContainer(
       
   119             const TListType aType );
       
   120 
       
   121         void ConstructL(
       
   122             const TRect& aRect,
       
   123             const TInt aFocusedIndex,
       
   124             const TInt aEmptyText,
       
   125             const TDesC& aHelpContext );
       
   126 
       
   127         TInt SearchFieldToListIndex( TInt aIndex );
       
   128 
       
   129         TInt ListToSearchFieldIndex( TInt aIndex );
       
   130 
       
   131         void PageScrollL( TBool aUp );
       
   132 
       
   133         TKeyResponse OfferSearchKeyEventL(
       
   134             const TKeyEvent& aKeyEvent, TEventCode aType );
       
   135 
       
   136     private:
       
   137         /**
       
   138          * Custom item drawer, to support the "no-folders-marked" feature.
       
   139          */
       
   140         class CItemDrawer : public CColumnListBoxItemDrawer
       
   141             {
       
   142             public:
       
   143                 CItemDrawer(
       
   144                     CTextListBoxModel* aTextListBoxModel,
       
   145                     const CFont* aFont,
       
   146                     CColumnListBoxData* aColumnData,
       
   147                     CFileManagerFileListContainer& aContainer );
       
   148             public: // From CColumnListBoxItemDrawer
       
   149                 TListItemProperties Properties( TInt aItemIndex ) const;
       
   150             private: // Data
       
   151                 CFileManagerFileListContainer& iContainer;
       
   152             };
       
   153 
       
   154         /**
       
   155          * Custom listbox, to support the "no-folders-marked" feature.
       
   156          */
       
   157         class CListBox : public CAknSingleGraphicStyleListBox
       
   158             {
       
   159             public:
       
   160                 CListBox( CFileManagerFileListContainer& aContainer );
       
   161 
       
   162             protected: // From CAknSingleGraphicStyleListBox
       
   163                 void CreateItemDrawerL();
       
   164 
       
   165             private: // Data
       
   166                 CFileManagerFileListContainer& iContainer;
       
   167             };
       
   168 
       
   169     private: // Data
       
   170         // Ref: Document of this application
       
   171         CFileManagerDocument* iDocument;
       
   172         // Ref: AppUi of this application
       
   173         CFileManagerAppUi* iAppUi;
       
   174         // List type bits
       
   175         TUint iType;
       
   176         // Indicates if the navigation is supported
       
   177         TBool iRightLeftNaviSupported;
       
   178         // Indicates if dragging is on
       
   179         TBool iDragging;
       
   180         // Stores dragging start point
       
   181         TPoint iDragStartPoint;
       
   182         // Own: Search field
       
   183         CAknSearchField* iSearchField;
       
   184         // Buffer for search text
       
   185         TFileName iSearchText;
       
   186         // Indicates if search field is enabled after refresh
       
   187         TBool iSearchFieldAfterRefresh;
       
   188         // Stores the list index to be restored after search ends
       
   189         TInt iIndexAfterSearch;
       
   190         // Stores search field enabled status
       
   191         TBool iSearchFieldEnabled;
       
   192         // Stores fast scroll disbaled status
       
   193         TBool iOwnFastScrollDisabled;
       
   194     };
       
   195 
       
   196 #endif      // CFILEMANAGERFILELISTCONTAINER_H
       
   197             
       
   198 // End of File