|
1 /* |
|
2 * Copyright (c) 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: tabbed view control implementation class with doublestyle listbox |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H |
|
19 #define __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H |
|
20 |
|
21 #include "mvimpstuitabbedviewcontrol.h" |
|
22 #include "cvimpstuisinglestylelistbox.h" |
|
23 |
|
24 class CVIMPSTUiSingleStyleListBox; |
|
25 // CLASS DECLARATION |
|
26 /** |
|
27 * Tabbed view control. Shows list of contacts. |
|
28 * @lib vimpstui.lib |
|
29 * @since S60 v5.0 |
|
30 */ |
|
31 class CVIMPSTUiSingleListBoxTabViewControl : public CCoeControl, |
|
32 public MVIMPSTProcessArrayObserver, |
|
33 public MEikListBoxObserver, |
|
34 public MCoeControlObserver, |
|
35 public MVIMPSTUiTabbedViewControl |
|
36 { |
|
37 public: // Constructor and destructor |
|
38 void HandleAvatarChangeL( const TDesC& aUserId ); |
|
39 /** |
|
40 * Creates a new CImContactsTabbedViewControl. |
|
41 * |
|
42 * @param aTabbedView reference to view. |
|
43 * @param aKeyEventHandler Key event handler to be used |
|
44 * @param aCommandHandler reference to commandhandler |
|
45 * @param aServiceId Id of the service |
|
46 * @param aBrandHandler reference to brandhandler |
|
47 * @param aEngine reference to engine |
|
48 */ |
|
49 static CVIMPSTUiSingleListBoxTabViewControl* NewL( CVIMPSTUiTabbedView& aTabbedView, MPbk2KeyEventHandler* aKeyEventHandler, |
|
50 MVIMPSTCmdHandler& aCommandHandler, |
|
51 TUint32 aServiceId, |
|
52 CVIMPSTUiBrandData& aBrandHandler, |
|
53 MVIMPSTEngine& aEngine ); |
|
54 |
|
55 /** |
|
56 * Creates a new CImContactsTabbedViewControl and leaves it to |
|
57 * cleanup stack. |
|
58 * @see NewL |
|
59 * |
|
60 * @param aTabbedView reference to view. |
|
61 * @param aKeyEventHandler Key event handler to be used |
|
62 * @param aCommandHandler reference to commandhandler |
|
63 * @param aServiceId Id of the service |
|
64 * @param aBrandHandler reference to brandhandler |
|
65 * @param aEngine reference to engine |
|
66 */ |
|
67 static CVIMPSTUiSingleListBoxTabViewControl* NewLC( CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
68 MVIMPSTCmdHandler& aCommandHandler, |
|
69 TUint32 aServiceId, |
|
70 CVIMPSTUiBrandData& aBrandHandler, |
|
71 MVIMPSTEngine& aEngine ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 ~CVIMPSTUiSingleListBoxTabViewControl(); |
|
77 |
|
78 public : // from MIMArrayProcessObserver |
|
79 /** |
|
80 * @see MIMArrayProcessObserver. |
|
81 */ |
|
82 void HandleAdditionL(TVIMPSTEnums::TItem type, TInt aIndex); |
|
83 |
|
84 |
|
85 /** |
|
86 * @see MIMArrayProcessObserver. |
|
87 */ |
|
88 void HandleDeletionL(TVIMPSTEnums::TItem type, TInt aIndex); |
|
89 |
|
90 public://from MEikListBoxObserver |
|
91 |
|
92 /** |
|
93 * From MEikListBoxObserver, Handles event's generated by listbox |
|
94 * @see MEikListBoxObserver |
|
95 */ |
|
96 void HandleListBoxEventL( CEikListBox* aListBox, |
|
97 TListBoxEvent aEventType ); |
|
98 |
|
99 public: //from MCoeControlObserver |
|
100 /** |
|
101 * Handles events from findpane and forwards them to listbox filter. |
|
102 * @see MCoeControlObserver |
|
103 */ |
|
104 void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); |
|
105 |
|
106 /** |
|
107 |
|
108 /** |
|
109 * Get access to listbox model's filter |
|
110 * @return model's filter |
|
111 */ |
|
112 CAknListBoxFilterItems* ListFilter(); |
|
113 |
|
114 |
|
115 public: // New functions |
|
116 |
|
117 /** |
|
118 * Returns the currently focused item's index. |
|
119 * @return TInt, current item index. |
|
120 */ |
|
121 TInt CurrentItemIndex() const; |
|
122 |
|
123 /** |
|
124 * Sets the currently focused item's index. |
|
125 * |
|
126 * @param aIndex new currently focused index |
|
127 */ |
|
128 void SetCurrentItemIndex( TInt aIndex ); |
|
129 |
|
130 /** |
|
131 * Sets the currently focused item's index and updates the control |
|
132 * on the display. |
|
133 * |
|
134 * @param aIndex new currently focused index |
|
135 */ |
|
136 void SetCurrentItemIndexAndDraw( TInt aIndex ); |
|
137 |
|
138 /** |
|
139 * Handles item addition for this control. |
|
140 */ |
|
141 void HandleItemAdditionL(); |
|
142 /** |
|
143 * Handles item removal for this control. |
|
144 */ |
|
145 void HandleItemRemovalL(); |
|
146 |
|
147 /** |
|
148 * Sets list box empty text. |
|
149 * |
|
150 * @param aResourceId resource id of a empty text |
|
151 */ |
|
152 void SetListEmptyTextL( TInt aResourceId ); |
|
153 |
|
154 /** |
|
155 * send the message using selected item |
|
156 * this will launch the conversation view if im is enabled. |
|
157 */ |
|
158 void SendMessageL(); |
|
159 |
|
160 /** |
|
161 * Updates view after edit. |
|
162 * @param aIndex is the index of item that has changed. |
|
163 * @param aType is list item type. |
|
164 */ |
|
165 void UpdateViewL( TInt aIndex, TVIMPSTEnums::TItem aType); |
|
166 |
|
167 /** |
|
168 * @see MVIMPSTUiTabbedViewControl. |
|
169 */ |
|
170 void HandleAvatarDeleteL( const TDesC& aUserId ); |
|
171 |
|
172 |
|
173 /** |
|
174 * LoadsBitmap array. |
|
175 */ |
|
176 void LoadBitmapsL(); |
|
177 |
|
178 |
|
179 |
|
180 /** |
|
181 * Activates find-pane |
|
182 */ |
|
183 void ActivateFindPaneL(); |
|
184 |
|
185 /** |
|
186 * De-activates find-pane |
|
187 */ |
|
188 void DeactivateFindPaneL(); |
|
189 |
|
190 /** |
|
191 * Sets the lock status of softkeys |
|
192 * @param aLock new status of lock (ETrue: locked, EFalse: Unlocked) |
|
193 */ |
|
194 void SetCbaLockL( TBool aLock ); |
|
195 |
|
196 |
|
197 /** |
|
198 * Updates Softkeys according to current focus |
|
199 * @param aUseDefaultCba Flag to force the default sofkeys for view. |
|
200 * Default value is false. |
|
201 */ |
|
202 void UpdateCbaL( TBool aUseDefaultCba = EFalse ); |
|
203 |
|
204 /** |
|
205 *Handle the avatar deletion in UI |
|
206 */ |
|
207 void SetFocussedId(const TDesC& aContact) ; |
|
208 |
|
209 /** |
|
210 * the avatar deletion in UI |
|
211 */ |
|
212 TPtrC GetFocussedId() ; |
|
213 |
|
214 private: // From CCoeControl, standard control functionality |
|
215 |
|
216 /** |
|
217 * @see CCoeControl |
|
218 */ |
|
219 TKeyResponse OfferKeyEventL |
|
220 ( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
221 |
|
222 /** |
|
223 * @see CCoeControl |
|
224 */ |
|
225 void SizeChanged(); |
|
226 |
|
227 /** |
|
228 * @see CCoeControl |
|
229 */ |
|
230 TInt CountComponentControls() const; |
|
231 |
|
232 /** |
|
233 * @see CCoeControl |
|
234 */ |
|
235 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
236 |
|
237 /** |
|
238 * @see CCoeControl |
|
239 */ |
|
240 void FocusChanged( TDrawNow aDrawNow ); |
|
241 |
|
242 private: // Implementation |
|
243 /** |
|
244 * Standard C++ constructor |
|
245 * |
|
246 * @param aTabbedView reference to view. |
|
247 * @param aKeyEventHandler Key event handler to be used |
|
248 * @param aCommandHandler reference to commandhandler |
|
249 * @param aServiceId Id of the service |
|
250 * @param aBrandHandler reference to brandhandler |
|
251 * @param aEngine reference to engine |
|
252 */ |
|
253 CVIMPSTUiSingleListBoxTabViewControl( CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
254 MVIMPSTCmdHandler& aCommandHandler, |
|
255 TUint32 aServiceId, |
|
256 CVIMPSTUiBrandData& aBrandHandler, |
|
257 MVIMPSTEngine& aEngine ); |
|
258 |
|
259 /** |
|
260 * Performs the 2nd phase of construction. |
|
261 * |
|
262 */ |
|
263 void ConstructL(); |
|
264 |
|
265 /** |
|
266 * Layouts current components according to AVKON LAF |
|
267 */ |
|
268 void SetLayout(); |
|
269 |
|
270 |
|
271 void SetFocusAndMakeItemVisible(); |
|
272 |
|
273 public: |
|
274 |
|
275 /** |
|
276 * Sets the iClrFindPaneFlag |
|
277 */ |
|
278 void SetClrFindPaneFlag(TBool aFlag); |
|
279 |
|
280 /** |
|
281 * Checks if the last contact is focused and Sets the iLastItemFlag |
|
282 */ |
|
283 void CheckAndSetLastItemFlag(); |
|
284 |
|
285 /** |
|
286 * returns the CCoeControl* pointer |
|
287 */ |
|
288 CCoeControl* CoeControl(); |
|
289 |
|
290 |
|
291 |
|
292 private: // Data |
|
293 |
|
294 // not owned |
|
295 CVIMPSTUiTabbedView& iTabbedView; |
|
296 |
|
297 // Not owned: key event handler |
|
298 MPbk2KeyEventHandler* iKeyEventHandler; |
|
299 |
|
300 //Holds the Ref to CMd Handler - Doesnt Own |
|
301 MVIMPSTCmdHandler& iCommandHandler; |
|
302 |
|
303 //Doesnt Own |
|
304 MVIMPSTProcessArray& iArrayProcess; |
|
305 |
|
306 //Service Id |
|
307 TUint32 iServiceId ; |
|
308 |
|
309 //doesnt own - Brand Handler |
|
310 CVIMPSTUiBrandData& iBrandHandler; |
|
311 |
|
312 //doesnt own - Engine Handler |
|
313 MVIMPSTEngine& iEngine; |
|
314 |
|
315 |
|
316 // Owns. Listbox to view friends-list data |
|
317 CVIMPSTUiSingleStyleListBox* iListBox; |
|
318 |
|
319 // Owns. Search field. |
|
320 CAknSearchField* iFindbox; |
|
321 |
|
322 // is find pane visible. |
|
323 TBool iFindPaneIsVisible; |
|
324 |
|
325 //current state |
|
326 TBool iCurrentState; |
|
327 |
|
328 // Owns: Flag to check whether the last contact was selected |
|
329 TBool iLastItemFlag; |
|
330 |
|
331 // CBA. not owned |
|
332 CEikButtonGroupContainer* iCba; |
|
333 |
|
334 // Lock status foc softkeys |
|
335 TBool iCbaLock; |
|
336 |
|
337 // Storage for previous focus |
|
338 TVIMPSTEnums::TItem iLastFocusedItemType; |
|
339 |
|
340 //flag to check to clear find pane |
|
341 TBool iClrFindPaneFlag; |
|
342 |
|
343 //indicate command to be executed on enter key event |
|
344 TInt iCurrentCmdToExe; |
|
345 }; |
|
346 |
|
347 #endif // __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H |
|
348 |
|
349 // End of file |