32 class CAknStylusPopUpMenu; |
32 class CAknStylusPopUpMenu; |
33 class CAknQueryDialog; |
33 class CAknQueryDialog; |
34 class CTsEventControler; |
34 class CTsEventControler; |
35 class MTsDataChangeObserver; |
35 class MTsDataChangeObserver; |
36 class CAknLongTapAnimation; |
36 class CAknLongTapAnimation; |
37 class CTsFastSwapAreaExtension; |
|
38 class CAknPointerEventSuppressor; |
|
39 |
37 |
40 /** |
38 /** |
41 * Taskswitcher Fast Swap area UI. |
39 * Taskswitcher Fast Swap area UI. |
42 */ |
40 */ |
43 class CTsFastSwapArea: public CCoeControl, |
41 class CTsFastSwapArea: public CCoeControl, |
180 |
178 |
181 // From MEikListBoxObserver |
179 // From MEikListBoxObserver |
182 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
180 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
183 |
181 |
184 public: |
182 public: |
185 |
|
186 enum TsFastSwapAreaGridData { |
|
187 EMaxItemsOnScreen = 1, |
|
188 EGridItemWidth, |
|
189 EGridItemGap |
|
190 }; |
|
191 |
|
192 /** |
183 /** |
193 * Implements drag gesture handling |
184 * Implements drag gesture handling |
194 * @see MTsEventControlerObserver |
185 * @see MTsEventControlerObserver |
195 */ |
186 */ |
196 void MoveOffset(const TPoint&, TBool); |
187 void MoveOffset(const TPoint&, TBool); |
235 /** |
226 /** |
236 * Checks if app with the given window group id is present on taskswitcher |
227 * Checks if app with the given window group id is present on taskswitcher |
237 * list. |
228 * list. |
238 */ |
229 */ |
239 TBool WgOnTaskList( TInt aWgId ); |
230 TBool WgOnTaskList( TInt aWgId ); |
240 |
|
241 /** |
|
242 * Returns full grid view size. |
|
243 */ |
|
244 TSize GridWorldSize(); |
|
245 |
|
246 /** |
|
247 * Retrieves number of items in grid |
|
248 */ |
|
249 TInt GridItemCount(); |
|
250 |
|
251 /** |
|
252 * Returnes value of the requested grid data |
|
253 */ |
|
254 TInt GetGridItemData( TsFastSwapAreaGridData aDataType ); |
|
255 |
231 |
256 public: |
232 public: |
257 // from CCoeControl |
233 // from CCoeControl |
258 TInt CountComponentControls() const; |
234 TInt CountComponentControls() const; |
259 CCoeControl* ComponentControl(TInt aIndex) const; |
235 CCoeControl* ComponentControl(TInt aIndex) const; |
284 |
260 |
285 /** |
261 /** |
286 * Switches to another application. |
262 * Switches to another application. |
287 */ |
263 */ |
288 void SwitchToApp( TInt aWgId, const TUid& aUid ); |
264 void SwitchToApp( TInt aWgId, const TUid& aUid ); |
289 |
265 |
290 /** |
266 /** |
291 * Update and prepare data for grid. |
267 * Makes a copy of the given bitmap. |
|
268 * Also scaled to the given size, but maintains aspect ratio, |
|
269 * so the size of the returned bitmap may be less then aSize. |
|
270 */ |
|
271 CFbsBitmap* CopyBitmapL( TInt aFbsHandle, TSize aSize ); |
|
272 |
|
273 /** |
|
274 * Called from HandleFswContentChanged. |
292 */ |
275 */ |
293 void GetContentForGrid(); |
276 void HandleFswContentChangedL(); |
294 |
277 |
295 /** |
278 /** |
296 * Obtain actual data from server. |
279 * Shows the content from iArray on the screen. |
297 */ |
280 */ |
298 void GetContentL(); |
281 void RenderContentL( TBool aSuppressAnimation = EFalse ); |
299 |
|
300 /** |
|
301 * Prepare the content from iArray to be shown on the screen. |
|
302 */ |
|
303 void RenderContentL( ); |
|
304 |
|
305 /** |
|
306 * Prepare bitmap for item. |
|
307 */ |
|
308 CGulIcon* CreateItemIconLC( CTsFswEntry* aEntry, TBool aIsScreenshot ); |
|
309 |
282 |
310 /** |
283 /** |
311 * Creates the ganes grid control. |
284 * Creates the ganes grid control. |
312 */ |
285 */ |
313 void ReCreateGridL(); |
286 void ReCreateGridL(); |
321 * Setup grid layout for view |
294 * Setup grid layout for view |
322 * |
295 * |
323 * @param aItemCount number of items in grid |
296 * @param aItemCount number of items in grid |
324 */ |
297 */ |
325 void LayoutGridViewL( TInt aItemCount ); |
298 void LayoutGridViewL( TInt aItemCount ); |
|
299 |
|
300 /** |
|
301 * Returns rectangles for fast swap area controls |
|
302 */ |
|
303 void GetFastSwapAreaRects( RArray<TAknLayoutRect>& aRects ); |
326 |
304 |
327 /** |
305 /** |
328 * Creates a stylus popup instance (iPopup) if not yet done. |
306 * Creates a stylus popup instance (iPopup) if not yet done. |
329 */ |
307 */ |
330 void PreCreatePopupL(); |
308 void PreCreatePopupL(); |
340 * Sends the data-changed notification. |
318 * Sends the data-changed notification. |
341 */ |
319 */ |
342 void NotifyChange(); |
320 void NotifyChange(); |
343 |
321 |
344 /** |
322 /** |
|
323 * Retrieves and returns size for image graphics. |
|
324 */ |
|
325 TSize PreferredImageSize(); |
|
326 |
|
327 /** |
|
328 * Retrieves number of items in grid |
|
329 */ |
|
330 TInt GridItemCount(); |
|
331 |
|
332 /** |
|
333 * Calculates the correct size if aspect ratio needs to be preserved. |
|
334 */ |
|
335 TSize CalculateSizePreserveRatio(const TSize& aTargetAreaSize, |
|
336 const TSize& aSourceSize); |
|
337 |
|
338 /** |
345 * Selects next item in grid |
339 * Selects next item in grid |
346 */ |
340 */ |
347 void SelectNextItem(); |
341 void SelectNextItem(); |
348 |
342 |
349 /** |
343 /** |
354 * @param aRedrawDelay - animation delay. |
348 * @param aRedrawDelay - animation delay. |
355 */ |
349 */ |
356 void CenterItem( TInt aRedrawDelay); |
350 void CenterItem( TInt aRedrawDelay); |
357 |
351 |
358 /** |
352 /** |
|
353 * Returns full grid view size. |
|
354 */ |
|
355 TSize GridWorldSize(); |
|
356 |
|
357 /** |
359 * Updates grid, called for manual grid scroll update |
358 * Updates grid, called for manual grid scroll update |
360 * |
359 * |
361 * @param aForceRedraw if set to ETrue - redraw will be forced |
360 * @param aForceRedraw if set to ETrue - redraw will be forced |
362 * @param aAnimate set to ETrue to enable animation |
361 * @param aAnimate set to ETrue to enable animation |
363 */ |
362 */ |
368 * Returns grid view size |
367 * Returns grid view size |
369 */ |
368 */ |
370 TSize ViewSize(); |
369 TSize ViewSize(); |
371 |
370 |
372 /** |
371 /** |
|
372 * Returns the position of the given item inside grid world rect. |
|
373 * Returns point in the middle of the view rectangle. |
|
374 * |
|
375 * @param aItemIdx index of the item for which calculation will be done |
|
376 */ |
|
377 TPoint ItemViewPosition( TInt aItemIdx ); |
|
378 |
|
379 /** |
|
380 * Returns index of the shown item, based on the logical |
|
381 * position of the grids view. Item that is closest to the |
|
382 * middle of screen is returned. |
|
383 * |
|
384 * @param aViewPos grids view position. This must be point in |
|
385 * the middle of the view rectangle |
|
386 * @return index of the item |
|
387 */ |
|
388 TInt ViewToVisibleItem( const TPoint aViewPos ); |
|
389 |
|
390 /** |
|
391 * Launches increasing pop-up feedback. |
|
392 */ |
|
393 void LaunchPopupFeedback(); |
|
394 |
|
395 /** |
373 * Show highlight when disabled and |
396 * Show highlight when disabled and |
374 * consume EEventKeyUp that follows after event that swiched on the highlight. |
397 * consume EEventKeyUp that follows after event that swiched on the highlight. |
375 */ |
398 */ |
376 TKeyResponse ShowHighlightOnKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aType); |
399 TKeyResponse ShowHighlightOnKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aType); |
377 |
400 |
378 /** |
401 /** |
|
402 * Returns current screen orientation: |
|
403 * |
|
404 * @return 1 if landscape, 0 if portait |
|
405 */ |
|
406 TInt GetCurrentScreenOrientation(); |
|
407 |
|
408 /** |
|
409 * Retrieves variety value, based on current screen resolution. |
|
410 * |
|
411 * @param aVariety result of the function, 0 value means portrait |
|
412 * value of 1 indicates landscape |
|
413 * @return ETrue if screen resolution differs from vale returned by |
|
414 * layout meta data functions. |
|
415 */ |
|
416 TBool GetVariety( TInt& aVariety ); |
|
417 |
|
418 /** |
379 * Cancels long tap animation. |
419 * Cancels long tap animation. |
380 */ |
420 */ |
381 void CancelLongTapAnimation( TBool aDisablePopup = ETrue ); |
421 void CancelLongTapAnimation( TBool aDisablePopup = ETrue ); |
382 |
422 |
383 /** |
423 /** |
387 * @param aHitPoint point where tapped event is registered |
427 * @param aHitPoint point where tapped event is registered |
388 * @return ETrue if long animation is allowed for that position |
428 * @return ETrue if long animation is allowed for that position |
389 */ |
429 */ |
390 TBool LongTapAnimForPos( const TPoint& aHitPoint ); |
430 TBool LongTapAnimForPos( const TPoint& aHitPoint ); |
391 |
431 |
392 /** |
|
393 * Count grid rectangle based on given item position |
|
394 */ |
|
395 TRect CountCenteredGridRect( TPoint aItemPosition); |
|
396 |
|
397 private: // Data |
432 private: // Data |
398 |
433 |
399 // parent control |
434 // parent control |
400 CCoeControl& iParent; |
435 CCoeControl& iParent; |
401 |
|
402 // utility helper class |
|
403 CTsFastSwapAreaExtension* iFastSwapExt; |
|
404 |
436 |
405 // device state |
437 // device state |
406 // not own |
438 // not own |
407 CTsDeviceState& iDeviceState; |
439 CTsDeviceState& iDeviceState; |
408 |
440 |
451 TBool iIgnoreLayoutSwitch; |
483 TBool iIgnoreLayoutSwitch; |
452 |
484 |
453 // Key event handling |
485 // Key event handling |
454 TBool iConsumeEvent; |
486 TBool iConsumeEvent; |
455 TBool iKeyEvent; |
487 TBool iKeyEvent; |
456 CAknPointerEventSuppressor* iEventSupressor; |
|
457 TBool iSupressDrag; |
|
458 |
488 |
459 // App closing handling |
489 // App closing handling |
460 RArray<TInt> iIsClosing; |
490 RArray<TInt> iIsClosing; |
461 TInt iWidgetClosingCount; |
491 TInt iWidgetClosingCount; |
462 TInt iPrevAppCount; |
492 TInt iPrevAppCount; |
463 |
493 |
464 // Long tap animation |
494 // Long tap animation |
465 CAknLongTapAnimation* iLongTapAnimation; |
495 CAknLongTapAnimation* iLongTapAnimation; |
466 CTsFastSwapTimer* iLongTapAnimationTimer; |
496 CTsFastSwapTimer* iLongTapAnimationTimer; |
467 TBool iLongTapAnimationRunning; |
497 TBool iLongTapAnimationRunning; |
468 |
|
469 // Screenshot handling |
|
470 RArray<TInt> iPrevScreenshots; |
|
471 RArray<TInt> iPrevWgIds; |
|
472 }; |
498 }; |
473 |
499 |
474 #endif // TSFASTSWAPAREA_H |
500 #endif // TSFASTSWAPAREA_H |