author | Simon Howkins <simonh@symbian.org> |
Fri, 12 Nov 2010 14:20:29 +0000 | |
branch | RCL_3 |
changeset 54 | e5e9368908dc |
parent 52 | 40fb776cbfb3 |
permissions | -rw-r--r-- |
39 | 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> |
|
28 |
||
29 |
||
30 |
// FORWARD DECLARATIONS |
|
31 |
class CEikTextListBox; |
|
32 |
||
33 |
||
34 |
// CLASS DECLARATION |
|
35 |
/** |
|
36 |
* Base class for all containers in File Manager |
|
37 |
*/ |
|
38 |
class CFileManagerContainerBase : public CCoeControl, |
|
39 |
public MEikListBoxObserver, |
|
40 |
public MCoeControlObserver, |
|
41 |
public MEikCommandObserver, |
|
52
40fb776cbfb3
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
42
diff
changeset
|
42 |
public MListBoxSelectionObserver |
39 | 43 |
{ |
44 |
public: // destructor |
|
45 |
/** |
|
46 |
* Destructor. |
|
47 |
*/ |
|
48 |
~CFileManagerContainerBase(); |
|
49 |
||
50 |
protected: // MEikListBoxObserver |
|
51 |
void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
52 |
||
53 |
protected: // MCoeControlObserver |
|
54 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
55 |
||
56 |
protected: // From CCoeControl |
|
57 |
/** |
|
58 |
* @see CCoeControl |
|
59 |
*/ |
|
60 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
61 |
||
62 |
/** |
|
63 |
* @see CCoeControl |
|
64 |
*/ |
|
65 |
void SizeChanged(); |
|
66 |
||
67 |
/** |
|
68 |
* @see CCoeControl |
|
69 |
*/ |
|
70 |
TInt CountComponentControls() const; |
|
71 |
||
72 |
/** |
|
73 |
* @see CCoeControl |
|
74 |
*/ |
|
75 |
CCoeControl* ComponentControl( TInt aIndex ) const; |
|
76 |
||
77 |
/** |
|
78 |
* @see CCoeControl |
|
79 |
*/ |
|
80 |
void FocusChanged( TDrawNow aDrawNow ); |
|
81 |
||
82 |
/** |
|
83 |
* @see CCoeControl |
|
84 |
*/ |
|
85 |
void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
86 |
||
87 |
public: // From MEikCommandObserver |
|
88 |
/** |
|
89 |
* @see MEikCommandObserver |
|
90 |
*/ |
|
91 |
void ProcessCommandL( TInt aCommandId ); |
|
92 |
||
93 |
public: // New functions |
|
94 |
/** |
|
95 |
* Sets list empty and removes empty text until refreshed. |
|
96 |
*/ |
|
97 |
virtual void SetListEmptyL(); |
|
98 |
||
99 |
/** |
|
100 |
* Stores the focus, so when control is reseted, focus can |
|
101 |
* be set back to current position. |
|
102 |
* |
|
103 |
* @param aFocusedIndex index to be stored |
|
104 |
*/ |
|
105 |
void SetIndex( TInt aFocusedIndex ); |
|
106 |
||
107 |
/** |
|
108 |
* Sets text array. |
|
109 |
*/ |
|
110 |
void SetTextArray( MDesCArray* aArray ); |
|
111 |
||
112 |
/** |
|
113 |
* Sets help context. |
|
114 |
*/ |
|
115 |
void SetHelpContext( const TDesC& aHelpContext ); |
|
116 |
||
117 |
/** |
|
118 |
* Sets empty text. |
|
119 |
*/ |
|
120 |
void SetEmptyTextL( TInt aTextId ); |
|
121 |
||
122 |
/** |
|
123 |
* Refreshes the container. |
|
124 |
* @param aFocusedIndex Index of the item that will be focused |
|
125 |
* after refresh. |
|
126 |
*/ |
|
127 |
virtual void RefreshListL( TInt aFocusedIndex ); |
|
128 |
||
129 |
/** |
|
130 |
* Gets selection mode status |
|
131 |
*/ |
|
132 |
TBool SelectionModeEnabled() const; |
|
133 |
||
134 |
/** |
|
135 |
* Updates cba |
|
136 |
*/ |
|
137 |
virtual void UpdateCba(); |
|
138 |
||
139 |
/** |
|
140 |
* Gets index of current list item |
|
141 |
* @return Index of current list item or KErrNotFound if list is empty. |
|
142 |
*/ |
|
143 |
virtual TInt ListBoxCurrentItemIndex(); |
|
144 |
||
145 |
/** |
|
146 |
* Gets number of list items |
|
147 |
* @return Number of list items. |
|
148 |
*/ |
|
149 |
virtual TInt ListBoxNumberOfItems(); |
|
150 |
||
151 |
/** |
|
152 |
* Gets indexes of selection |
|
153 |
* @return Array of selected indexes. Ownership is not transferred. |
|
154 |
*/ |
|
155 |
virtual const CArrayFix< TInt >* ListBoxSelectionIndexes(); |
|
156 |
||
157 |
/** |
|
158 |
* Gets number of selected list items |
|
159 |
* @return Number of selected list items. |
|
160 |
*/ |
|
161 |
virtual TInt ListBoxSelectionIndexesCount(); |
|
162 |
||
163 |
/** |
|
164 |
* Toggles list item selection status |
|
165 |
* @param aIndex Index of list item. |
|
166 |
*/ |
|
167 |
virtual void ListBoxToggleItemL( TInt aIndex ); |
|
168 |
||
169 |
/** |
|
170 |
* Checks list item selection status |
|
171 |
* @param aIndex Index of list item. |
|
172 |
* @return ETrue if item is selected. Otherwise EFalse. |
|
173 |
*/ |
|
174 |
virtual TBool ListBoxIsItemSelected( TInt aIndex ); |
|
175 |
||
176 |
/** |
|
177 |
* Selects all list items |
|
178 |
*/ |
|
179 |
virtual void ListBoxSelectAllL(); |
|
180 |
||
181 |
/** |
|
182 |
* Clears list selection |
|
183 |
*/ |
|
184 |
virtual void ListBoxClearSelection(); |
|
185 |
||
186 |
/** |
|
187 |
* Sets text showm in empty list view. |
|
188 |
* @param aText Text to be shown |
|
189 |
*/ |
|
190 |
virtual void ListBoxSetTextL( const TDesC& aText ); |
|
191 |
||
192 |
/** |
|
193 |
* Checks is search field visible |
|
194 |
* @return ETrue if search field is visible. Otherwise EFalse. |
|
195 |
*/ |
|
196 |
virtual TBool IsSearchFieldVisible() const; |
|
197 |
||
198 |
/** |
|
199 |
* Enables and disables the search field. |
|
200 |
* @param aEnable New status of search field. |
|
201 |
* @param aSearchText Text to search |
|
202 |
*/ |
|
203 |
virtual void EnableSearchFieldL( |
|
204 |
TBool aEnable, const TDesC& aSearchText = KNullDesC ); |
|
205 |
||
206 |
/** |
|
207 |
* Sets current item index after search |
|
208 |
* @param aIndex Current item index. |
|
209 |
*/ |
|
210 |
virtual void SetCurrentItemIndexAfterSearch( TInt aIndex ); |
|
211 |
||
212 |
/** |
|
213 |
* Selects list item |
|
214 |
* @param aIndex Index of list item. |
|
215 |
*/ |
|
216 |
virtual void ListBoxSelectItemL( TInt aIndex ); |
|
217 |
||
218 |
/** |
|
219 |
* Deselects list item |
|
220 |
* @param aIndex Index of list item. |
|
221 |
*/ |
|
222 |
virtual void ListBoxDeselectItem( TInt aIndex ); |
|
223 |
||
224 |
/** |
|
225 |
* |
|
226 |
* |
|
227 |
*/ |
|
228 |
virtual void ListBoxSetSelectionIndexesL(const CArrayFixFlat<TInt>* |
|
229 |
aSelectionIndexes); |
|
230 |
/** |
|
231 |
* search filed index to listbox index |
|
232 |
* @param aIndex index in search filed |
|
233 |
* @return index in listbox |
|
234 |
*/ |
|
235 |
virtual TInt SearchFieldToListBoxIndex( TInt aIndex ); |
|
236 |
protected: |
|
237 |
/** |
|
238 |
* Standard C++ constructor. |
|
239 |
*/ |
|
240 |
CFileManagerContainerBase(); |
|
241 |
||
242 |
virtual void ConstructL( |
|
243 |
const TRect& aRect, |
|
244 |
const TInt aFocusedIndex ); |
|
245 |
||
246 |
virtual CEikTextListBox* CreateListBoxL() = 0; |
|
247 |
||
248 |
TBool ListBoxExists() const; |
|
249 |
||
250 |
CEikListBox& ListBox(); |
|
251 |
||
252 |
private: // From MListBoxSelectionObserver |
|
253 |
void SelectionModeChanged( |
|
254 |
CEikListBox* aListBox, TBool aSelectionModeEnabled ); |
|
255 |
||
256 |
private: |
|
257 |
void SetEmptyArrayL(); |
|
258 |
||
259 |
private: // Data |
|
260 |
// Own: Pointer to listbox |
|
261 |
CEikTextListBox* iListBox; |
|
262 |
// Own: Help context name |
|
263 |
TCoeContextName iHelpContext; |
|
264 |
// Own: Empty text |
|
265 |
HBufC* iEmptyText; |
|
266 |
// Ref: Pointer to text array |
|
267 |
MDesCArray* iArray; |
|
268 |
// Own: Stores selection mode status |
|
269 |
TBool iSelectionModeEnabled; |
|
270 |
||
271 |
}; |
|
272 |
||
273 |
#endif // CFILEMANAGERCONTAINERBASE_H |
|
274 |
||
275 |
// End of File |