taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswapgrid.h
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
child 18 d05a55b217df
equal deleted inserted replaced
12:9674c1a575e9 17:b8fae6b8a148
    75     ~CTsFastSwapGrid();
    75     ~CTsFastSwapGrid();
    76     void ConstructL( const CCoeControl* aParent );
    76     void ConstructL( const CCoeControl* aParent );
    77     
    77     
    78 public: // From CCoeControl
    78 public: // From CCoeControl
    79     void HandlePointerEventL( const TPointerEvent &aPointerEvent );
    79     void HandlePointerEventL( const TPointerEvent &aPointerEvent );
    80     TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
    81     void HandleResourceChange( TInt aType );
    80     void HandleResourceChange( TInt aType );
    82     void SizeChanged();
    81     void SizeChanged();
       
    82     void Draw( const TRect& aRect ) const;
    83     
    83     
    84 public: //From MTsDeviceStateObserver
    84 public: //From MTsDeviceStateObserver
    85     /**
    85     /**
    86      * Called when a change, to which the observer is registered,
    86      * Called when a change, to which the observer is registered,
    87      * has happened.
    87      * has happened.
   115      * Resets index of the item that has been close icon hit
   115      * Resets index of the item that has been close icon hit
   116      */
   116      */
   117     void ResetCloseHit();
   117     void ResetCloseHit();
   118     
   118     
   119     /**
   119     /**
       
   120      * Sets color for the screenshot stroke.
       
   121      * 
       
   122      * @param  aColor  color for the thumbnail
       
   123      * @param  aHighlightedColor  color for thumbnail when item is highlighted
       
   124      */
       
   125     void SetStrokeColors( TRgb aColor, 
       
   126                           TRgb aHighlightedColor );
       
   127     
       
   128     /**
       
   129      * Sets items for which stroke will be drawn
       
   130      * 
       
   131      * @param  aItemIndex  array of item indexes for which stroke
       
   132      *                     is drawn
       
   133      */
       
   134     void SetStrokeItemsL( RArray<TInt>& aItemIndex );
       
   135     
       
   136     /**
   120      * Sets grid behaviour
   137      * Sets grid behaviour
   121      * 
   138      * 
   122      * @param  aBehaviour  behaviour to be set
   139      * @param  aBehaviour  behaviour to be set
   123      */
   140      */
   124     void SetGridBehaviour( TFastSwapGridBehaviour aBehaviour );
   141     void SetGridBehaviour( TFastSwapGridBehaviour aBehaviour );
   156     
   173     
   157     /**
   174     /**
   158      * Returns visible view. Items outside of visible rectangle are not drawn.
   175      * Returns visible view. Items outside of visible rectangle are not drawn.
   159      */
   176      */
   160     TRect VisibleViewRect();
   177     TRect VisibleViewRect();
   161     
       
   162     /**
       
   163      * Launch tactile ETouchFeedbackSensitive feedback.
       
   164      */
       
   165     void LaunchTactileFeedback();
       
   166     
       
   167     /**
       
   168      * Set tactile feedback support.
       
   169      * 
       
   170      * @param aSupport new support value 
       
   171      */
       
   172     void SetTactileFeedbackSupport(TBool aSupport);
       
   173     
       
   174     /**
       
   175      * Remove item from iFullyVisibleItems and iPartialVisibleItems arrays 
       
   176      * 
       
   177      * @param   aItem  idem index 
       
   178      * @return  ETrue  if item was removed
       
   179      *          EFalse if item was not found
       
   180      */
       
   181     TBool RemoveFromVisibleItems(TInt aItem) const;
       
   182 
       
   183     /**
       
   184      * Add item to iFullyVisibleItems array 
       
   185      * 
       
   186      * @param   aItem  idem index 
       
   187      * @return  ETrue  if item was added
       
   188      *          EFalse if item was not added because it was there before
       
   189      */
       
   190     TBool AddToFullyVisibleItems(TInt aItem) const;
       
   191 
       
   192     /**
       
   193      * Remove item from iPartialVisibleItems array 
       
   194      * 
       
   195      * @param   aItem  idem index 
       
   196      * @return  ETrue  if item was removed
       
   197      *          EFalse if item was not removed because it was not found
       
   198      */
       
   199     TBool MoveToPartialVisibleItems(TInt aItem) const;
       
   200 
   178 
   201 private: // From CAknGrid
   179 private: // From CAknGrid
   202     virtual void CreateItemDrawerL();
   180     virtual void CreateItemDrawerL();
   203 
   181 
   204 private: // From MTsFastSwapTimerObserver
   182 private: // From MTsFastSwapTimerObserver
   207 private: // New functions
   185 private: // New functions
   208     
   186     
   209     /**
   187     /**
   210      * Loads close icon bitmap and mask
   188      * Loads close icon bitmap and mask
   211      */
   189      */
   212     void LoadCloseIcon();
   190     void LoadCloseIconAndStrokeParams();
   213     
   191     
   214     /**
   192     /**
   215      * Redraws grid and parent controls
   193      * Redraws grid and parent controls
   216      */
   194      */
   217     void Redraw();
   195     void Redraw();
   218     
   196     
   219 private: // Data
   197 private: // Data
   220     
   198     
   221     // Grid's parent
   199     // Grid's parent
   222     const CCoeControl* iParent;
   200     const CCoeControl* iParent;
   223     
       
   224     // Background context for grid
       
   225     CAknsFrameBackgroundControlContext* iBgContext;
       
   226     
   201     
   227     // Close icon handling
   202     // Close icon handling
   228     RArray<TInt> iCloseItems;
   203     RArray<TInt> iCloseItems;
   229     TInt iCloseIconHitIdx;
   204     TInt iCloseIconHitIdx;
   230     MTsFastSwapGridObserver* iFastSwapGridObserver;
   205     MTsFastSwapGridObserver* iFastSwapGridObserver;
   234     TFastSwapGridBehaviour iBehaviour;
   209     TFastSwapGridBehaviour iBehaviour;
   235     TBool iHighlightVisible;
   210     TBool iHighlightVisible;
   236     
   211     
   237     // Visible view rectangle (horizontal scrolling support)
   212     // Visible view rectangle (horizontal scrolling support)
   238     TRect iVisibleViewRect;
   213     TRect iVisibleViewRect;
   239     
       
   240     // Feedback support
       
   241     TBool iTactileFeedbackSupport;
       
   242     CTsFastSwapTimer* iFeedbackTimer;
       
   243     
       
   244     mutable RArray<TInt> iFullyVisibleItems;
       
   245     mutable RArray<TInt> iPartialVisibleItems;
       
   246     };
   214     };
   247 
   215 
   248 
   216 
   249 
   217 
   250 /**
   218 /**
   263 
   231 
   264     /**
   232     /**
   265      * Sets close icon drawn for items that can be closed.
   233      * Sets close icon drawn for items that can be closed.
   266      * Ownership transferred.
   234      * Ownership transferred.
   267      */
   235      */
   268     void SetCloseIcon( CFbsBitmap* aBmp, CFbsBitmap* aMask );
   236     void SetCloseIcon( CFbsBitmap* aBmp, CFbsBitmap* aBmpMask,
       
   237                        CFbsBitmap* aBmpPressed, CFbsBitmap* aBmpPressedMask );
   269 
   238 
   270     /**
   239     /**
   271      * Initializes close icon rectangles.
   240      * Initializes close icon rectangles.
   272      * 
   241      * 
   273      * @param  aButtonRect  rectangle for the button, coordinates must be relative to the grid item
   242      * @param  aButtonRect  rectangle for the button, coordinates must be relative to the grid item
   294      * 
   263      * 
   295      * @param  aEnable  if set to ETrue, background will be redrawn by item drawer
   264      * @param  aEnable  if set to ETrue, background will be redrawn by item drawer
   296      *                  if set to EFalse, background will not be redrawn
   265      *                  if set to EFalse, background will not be redrawn
   297      */
   266      */
   298     void SetRedrawBackground( TBool aEnable );
   267     void SetRedrawBackground( TBool aEnable );
       
   268     
       
   269     /**
       
   270      * Sets color for the screenshot stroke.
       
   271      * 
       
   272      * @param  aColor  color for the thumbnail
       
   273      * @param  aHighlightedColor  color for thumbnail when item is highlighted
       
   274      */
       
   275     void SetStrokeColors( TRgb aNormalColor,
       
   276                           TRgb aHighlightedColor );
       
   277     
       
   278     /**
       
   279      * Sets items for which stroke will be drawn
       
   280      * 
       
   281      * @param  aItemIndex  array of item indexes for which stroke
       
   282      *                     is drawn.
       
   283      */
       
   284     void SetStrokeItemsL( RArray<TInt>& aItemIndex );
       
   285     
       
   286     /**
       
   287      * Sets stroke offset and size: values must be relative
       
   288      * to item rectangle.
       
   289      * 
       
   290      * @param  aStrokeOffset  offset of the stroke rectangle relative
       
   291      *                        to item rectangle
       
   292      * @param aStrokeSize     size of the stroke rectangle
       
   293      */
       
   294     void SetStrokeOffset( TPoint aStrokeOffset, TSize aStrokeSize );
   299 
   295 
   300 private: // From CFormattedCellListBoxItemDrawer
   296 private: // From CFormattedCellListBoxItemDrawer
   301     void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
   297     void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
   302                          TBool aItemIsCurrent, TBool aViewIsEmphasized,
   298                          TBool aItemIsCurrent, TBool aViewIsEmphasized,
   303                          TBool aViewIsDimmed, TBool aItemIsSelected ) const;
   299                          TBool aViewIsDimmed, TBool aItemIsSelected ) const;
   331     // Not owned
   327     // Not owned
   332     CTsFastSwapGrid* iGrid;
   328     CTsFastSwapGrid* iGrid;
   333     // Owned
   329     // Owned
   334     CFbsBitmap* iCloseIcon;
   330     CFbsBitmap* iCloseIcon;
   335     CFbsBitmap* iCloseIconMask;
   331     CFbsBitmap* iCloseIconMask;
       
   332     CFbsBitmap* iCloseIconPressed;
       
   333     CFbsBitmap* iCloseIconPressedMask;
   336     
   334     
   337     TRect iScreenRect;
   335     TRect iScreenRect;
   338     TInt iLeftOffset;
   336     TInt iLeftOffset;
   339     TInt iRightOffset;
   337     TInt iRightOffset;
   340     
   338     
   341     // Layout data
   339     // Close button data
   342     TRect iCloseIconRect;
   340     TRect iCloseIconRect;
   343     TRect iCloseButtonRect;
   341     TRect iCloseButtonRect;
   344 	
   342 	
   345     TBool iRedrawBackground;
   343     TBool iRedrawBackground;
       
   344     
       
   345     // Stroke data
       
   346     TRgb iStrokeColor;
       
   347     TRgb iHighlightStrokeColor;
       
   348     RArray<TInt> iStrokeItems;
       
   349     TRect iStrokeRect;
   346     };
   350     };
   347 
   351 
   348 
   352 
   349 
   353 
   350 /**
   354 /**