author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:57:31 +0300 | |
branch | RCL_3 |
changeset 22 | f5c50b8af68c |
parent 21 | 65326cf895ed |
permissions | -rw-r--r-- |
21 | 1 |
/* |
2 |
* Copyright (c) 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: Base class for all file manager containers |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CFILEMANAGERCONTAINERBASE_H |
|
20 |
#define CFILEMANAGERCONTAINERBASE_H |
|
21 |
||
22 |
||
23 |
// INCLUDES |
|
24 |
#include <coecntrl.h> |
|
25 |
#include <badesca.h> |
|
26 |
#include <eiklbo.h> |
|
27 |
#include <eikcmobs.h> |
|
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
28 |
#include <aknmarkingmodeobserver.h> |
21 | 29 |
|
30 |
||
31 |
// FORWARD DECLARATIONS |
|
32 |
class CEikTextListBox; |
|
33 |
||
34 |
||
35 |
// CLASS DECLARATION |
|
36 |
/** |
|
37 |
* Base class for all containers in File Manager |
|
38 |
*/ |
|
39 |
class CFileManagerContainerBase : public CCoeControl, |
|
40 |
public MEikListBoxObserver, |
|
41 |
public MCoeControlObserver, |
|
42 |
public MEikCommandObserver, |
|
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
43 |
public MListBoxSelectionObserver, |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
44 |
public MAknMarkingModeObserver |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
45 |
|
21 | 46 |
{ |
47 |
public: // destructor |
|
48 |
/** |
|
49 |
* Destructor. |
|
50 |
*/ |
|
51 |
~CFileManagerContainerBase(); |
|
52 |
||
53 |
protected: // MEikListBoxObserver |
|
54 |
void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
55 |
||
56 |
protected: // MCoeControlObserver |
|
57 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
58 |
||
59 |
protected: // From CCoeControl |
|
60 |
/** |
|
61 |
* @see CCoeControl |
|
62 |
*/ |
|
63 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
64 |
||
65 |
/** |
|
66 |
* @see CCoeControl |
|
67 |
*/ |
|
68 |
void SizeChanged(); |
|
69 |
||
70 |
/** |
|
71 |
* @see CCoeControl |
|
72 |
*/ |
|
73 |
TInt CountComponentControls() const; |
|
74 |
||
75 |
/** |
|
76 |
* @see CCoeControl |
|
77 |
*/ |
|
78 |
CCoeControl* ComponentControl( TInt aIndex ) const; |
|
79 |
||
80 |
/** |
|
81 |
* @see CCoeControl |
|
82 |
*/ |
|
83 |
void FocusChanged( TDrawNow aDrawNow ); |
|
84 |
||
85 |
/** |
|
86 |
* @see CCoeControl |
|
87 |
*/ |
|
88 |
void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
89 |
||
90 |
public: // From MEikCommandObserver |
|
91 |
/** |
|
92 |
* @see MEikCommandObserver |
|
93 |
*/ |
|
94 |
void ProcessCommandL( TInt aCommandId ); |
|
95 |
||
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
96 |
public: // From MAknMarkingModeObserver |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
97 |
/** |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
98 |
* This method is called when marking mode is activated or deactivated. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
99 |
* |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
100 |
* @since 5.2 |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
101 |
* @param aActivated ETrue if marking mode is activated, EFalse |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
102 |
* if marking mode is deactivated. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
103 |
*/ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
104 |
void MarkingModeStatusChanged( TBool aActivated ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
105 |
|
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
106 |
/** |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
107 |
* This method is called just before marking mode is closed. Client can |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
108 |
* either accept or decline closing. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
109 |
* |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
110 |
* @since 5.2 |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
111 |
* @return ETrue if marking mode should be closed, otherwise EFalse. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
112 |
*/ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
113 |
TBool ExitMarkingMode() const; |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
114 |
|
21 | 115 |
public: // New functions |
116 |
/** |
|
117 |
* Sets list empty and removes empty text until refreshed. |
|
118 |
*/ |
|
119 |
virtual void SetListEmptyL(); |
|
120 |
||
121 |
/** |
|
122 |
* Stores the focus, so when control is reseted, focus can |
|
123 |
* be set back to current position. |
|
124 |
* |
|
125 |
* @param aFocusedIndex index to be stored |
|
126 |
*/ |
|
127 |
void SetIndex( TInt aFocusedIndex ); |
|
128 |
||
129 |
/** |
|
130 |
* Sets text array. |
|
131 |
*/ |
|
132 |
void SetTextArray( MDesCArray* aArray ); |
|
133 |
||
134 |
/** |
|
135 |
* Sets help context. |
|
136 |
*/ |
|
137 |
void SetHelpContext( const TDesC& aHelpContext ); |
|
138 |
||
139 |
/** |
|
140 |
* Sets empty text. |
|
141 |
*/ |
|
142 |
void SetEmptyTextL( TInt aTextId ); |
|
143 |
||
144 |
/** |
|
145 |
* Refreshes the container. |
|
146 |
* @param aFocusedIndex Index of the item that will be focused |
|
147 |
* after refresh. |
|
148 |
*/ |
|
149 |
virtual void RefreshListL( TInt aFocusedIndex ); |
|
150 |
||
151 |
/** |
|
152 |
* Gets selection mode status |
|
153 |
*/ |
|
154 |
TBool SelectionModeEnabled() const; |
|
155 |
||
156 |
/** |
|
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
157 |
* Gets marking mode status. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
158 |
* |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
159 |
* @since 5.2 |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
160 |
* @return ETrue if marking mode is activated, otherwise EFalse. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
161 |
*/ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
162 |
TBool IsMarkingModeActivated() const; |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
163 |
|
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
164 |
/** |
21 | 165 |
* Updates cba |
166 |
*/ |
|
167 |
virtual void UpdateCba(); |
|
168 |
||
169 |
/** |
|
170 |
* Gets index of current list item |
|
171 |
* @return Index of current list item or KErrNotFound if list is empty. |
|
172 |
*/ |
|
173 |
virtual TInt ListBoxCurrentItemIndex(); |
|
174 |
||
175 |
/** |
|
176 |
* Gets number of list items |
|
177 |
* @return Number of list items. |
|
178 |
*/ |
|
179 |
virtual TInt ListBoxNumberOfItems(); |
|
180 |
||
181 |
/** |
|
182 |
* Gets indexes of selection |
|
183 |
* @return Array of selected indexes. Ownership is not transferred. |
|
184 |
*/ |
|
185 |
virtual const CArrayFix< TInt >* ListBoxSelectionIndexes(); |
|
186 |
||
187 |
/** |
|
188 |
* Gets number of selected list items |
|
189 |
* @return Number of selected list items. |
|
190 |
*/ |
|
191 |
virtual TInt ListBoxSelectionIndexesCount(); |
|
192 |
||
193 |
/** |
|
194 |
* Toggles list item selection status |
|
195 |
* @param aIndex Index of list item. |
|
196 |
*/ |
|
197 |
virtual void ListBoxToggleItemL( TInt aIndex ); |
|
198 |
||
199 |
/** |
|
200 |
* Checks list item selection status |
|
201 |
* @param aIndex Index of list item. |
|
202 |
* @return ETrue if item is selected. Otherwise EFalse. |
|
203 |
*/ |
|
204 |
virtual TBool ListBoxIsItemSelected( TInt aIndex ); |
|
205 |
||
206 |
/** |
|
207 |
* Selects all list items |
|
208 |
*/ |
|
209 |
virtual void ListBoxSelectAllL(); |
|
210 |
||
211 |
/** |
|
212 |
* Clears list selection |
|
213 |
*/ |
|
214 |
virtual void ListBoxClearSelection(); |
|
215 |
||
216 |
/** |
|
217 |
* Sets text showm in empty list view. |
|
218 |
* @param aText Text to be shown |
|
219 |
*/ |
|
220 |
virtual void ListBoxSetTextL( const TDesC& aText ); |
|
221 |
||
222 |
/** |
|
223 |
* Checks is search field visible |
|
224 |
* @return ETrue if search field is visible. Otherwise EFalse. |
|
225 |
*/ |
|
226 |
virtual TBool IsSearchFieldVisible() const; |
|
227 |
||
228 |
/** |
|
229 |
* Enables and disables the search field. |
|
230 |
* @param aEnable New status of search field. |
|
231 |
* @param aSearchText Text to search |
|
232 |
*/ |
|
233 |
virtual void EnableSearchFieldL( |
|
234 |
TBool aEnable, const TDesC& aSearchText = KNullDesC ); |
|
235 |
||
236 |
/** |
|
237 |
* Sets current item index after search |
|
238 |
* @param aIndex Current item index. |
|
239 |
*/ |
|
240 |
virtual void SetCurrentItemIndexAfterSearch( TInt aIndex ); |
|
241 |
||
242 |
/** |
|
243 |
* Selects list item |
|
244 |
* @param aIndex Index of list item. |
|
245 |
*/ |
|
246 |
virtual void ListBoxSelectItemL( TInt aIndex ); |
|
247 |
||
248 |
/** |
|
249 |
* Deselects list item |
|
250 |
* @param aIndex Index of list item. |
|
251 |
*/ |
|
252 |
virtual void ListBoxDeselectItem( TInt aIndex ); |
|
253 |
||
254 |
/** |
|
255 |
* |
|
256 |
* |
|
257 |
*/ |
|
258 |
virtual void ListBoxSetSelectionIndexesL(const CArrayFixFlat<TInt>* |
|
259 |
aSelectionIndexes); |
|
260 |
/** |
|
261 |
* search filed index to listbox index |
|
262 |
* @param aIndex index in search filed |
|
263 |
* @return index in listbox |
|
264 |
*/ |
|
265 |
virtual TInt SearchFieldToListBoxIndex( TInt aIndex ); |
|
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
266 |
|
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
267 |
/** |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
268 |
* Sets flag to indicate marking mode could exit or not |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
269 |
* |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
270 |
* @since 5.2 |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
271 |
* @param aAllowExit ETrue if allow marking mode exit, EFalse if not |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
272 |
*/ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
273 |
virtual void AllowMarkingModeExit( TBool aAllowExit ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
274 |
|
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
275 |
/** |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
276 |
* Turns the marking mode on / off. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
277 |
* |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
278 |
* @since 5.2 |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
279 |
* @param aEnable ETrue to turn marking mode on, |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
280 |
* EFalse to turn marking mode off. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
281 |
*/ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
282 |
virtual void SetMarkingMode( TBool aEnable ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
283 |
|
21 | 284 |
protected: |
285 |
/** |
|
286 |
* Standard C++ constructor. |
|
287 |
*/ |
|
288 |
CFileManagerContainerBase(); |
|
289 |
||
290 |
virtual void ConstructL( |
|
291 |
const TRect& aRect, |
|
292 |
const TInt aFocusedIndex ); |
|
293 |
||
294 |
virtual CEikTextListBox* CreateListBoxL() = 0; |
|
295 |
||
296 |
TBool ListBoxExists() const; |
|
297 |
||
298 |
CEikListBox& ListBox(); |
|
299 |
||
300 |
private: // From MListBoxSelectionObserver |
|
301 |
void SelectionModeChanged( |
|
302 |
CEikListBox* aListBox, TBool aSelectionModeEnabled ); |
|
303 |
||
304 |
private: |
|
305 |
void SetEmptyArrayL(); |
|
306 |
||
307 |
private: // Data |
|
308 |
// Own: Pointer to listbox |
|
309 |
CEikTextListBox* iListBox; |
|
310 |
// Own: Help context name |
|
311 |
TCoeContextName iHelpContext; |
|
312 |
// Own: Empty text |
|
313 |
HBufC* iEmptyText; |
|
314 |
// Ref: Pointer to text array |
|
315 |
MDesCArray* iArray; |
|
316 |
// Own: Stores selection mode status |
|
317 |
TBool iSelectionModeEnabled; |
|
22
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
318 |
// Own: Indicates marking mode is activated or not |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
319 |
TBool iMarkingModeActivated; |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
320 |
// Own: Indicates marking mode is allowed to exit or not |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
21
diff
changeset
|
321 |
TBool iAllowMarkingModeExit; |
21 | 322 |
|
323 |
}; |
|
324 |
||
325 |
#endif // CFILEMANAGERCONTAINERBASE_H |
|
326 |
||
327 |
// End of File |