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 TInt SearchFieldToListBoxIndex(TInt aIndex ); |
|
110 |
|
111 private: // From MCoeFocusObserver |
|
112 void HandleChangeInFocus(); |
|
113 |
|
114 void HandleDestructionOfFocusedItem(); |
|
115 |
|
116 private: |
|
117 /** |
|
118 * Standard C++ constructor. |
|
119 */ |
|
120 CFileManagerFileListContainer( |
|
121 const TListType aType ); |
|
122 |
|
123 void ConstructL( |
|
124 const TRect& aRect, |
|
125 const TInt aFocusedIndex, |
|
126 const TInt aEmptyText, |
|
127 const TDesC& aHelpContext ); |
|
128 |
|
129 TInt SearchFieldToListIndex( TInt aIndex ); |
|
130 |
|
131 TInt ListToSearchFieldIndex( TInt aIndex ); |
|
132 |
|
133 void PageScrollL( TBool aUp ); |
|
134 |
|
135 TKeyResponse OfferSearchKeyEventL( |
|
136 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
137 |
|
138 private: |
|
139 /** |
|
140 * Custom item drawer, to support the "no-folders-marked" feature. |
|
141 */ |
|
142 class CItemDrawer : public CColumnListBoxItemDrawer |
|
143 { |
|
144 public: |
|
145 CItemDrawer( |
|
146 CTextListBoxModel* aTextListBoxModel, |
|
147 const CFont* aFont, |
|
148 CColumnListBoxData* aColumnData, |
|
149 CFileManagerFileListContainer& aContainer ); |
|
150 public: // From CColumnListBoxItemDrawer |
|
151 TListItemProperties Properties( TInt aItemIndex ) const; |
|
152 private: // Data |
|
153 CFileManagerFileListContainer& iContainer; |
|
154 }; |
|
155 |
|
156 /** |
|
157 * Custom listbox, to support the "no-folders-marked" feature. |
|
158 */ |
|
159 class CListBox : public CAknSingleGraphicStyleListBox |
|
160 { |
|
161 public: |
|
162 CListBox( CFileManagerFileListContainer& aContainer ); |
|
163 |
|
164 protected: // From CAknSingleGraphicStyleListBox |
|
165 void CreateItemDrawerL(); |
|
166 |
|
167 private: // Data |
|
168 CFileManagerFileListContainer& iContainer; |
|
169 }; |
|
170 |
|
171 private: // Data |
|
172 // Ref: Document of this application |
|
173 CFileManagerDocument* iDocument; |
|
174 // Ref: AppUi of this application |
|
175 CFileManagerAppUi* iAppUi; |
|
176 // List type bits |
|
177 TUint iType; |
|
178 // Indicates if the navigation is supported |
|
179 TBool iRightLeftNaviSupported; |
|
180 // Indicates if dragging is on |
|
181 TBool iDragging; |
|
182 // Stores dragging start point |
|
183 TPoint iDragStartPoint; |
|
184 // Own: Search field |
|
185 CAknSearchField* iSearchField; |
|
186 // Buffer for search text |
|
187 TFileName iSearchText; |
|
188 // Indicates if search field is enabled after refresh |
|
189 TBool iSearchFieldAfterRefresh; |
|
190 // Stores the list index to be restored after search ends |
|
191 TInt iIndexAfterSearch; |
|
192 // Stores search field enabled status |
|
193 TBool iSearchFieldEnabled; |
|
194 // Stores fast scroll disbaled status |
|
195 TBool iOwnFastScrollDisabled; |
|
196 }; |
|
197 |
|
198 #endif // CFILEMANAGERFILELISTCONTAINER_H |
|
199 |
|
200 // End of File |
|