taskswitcher/teleportui/hgteleportapp/src/hgteleportfastswapgrid.cpp
changeset 4 4d54b72983ae
parent 3 fb3763350a08
child 5 c743ef5928ba
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
     1 /*
       
     2  * ============================================================================
       
     3  *  Name        : hgteleportfastswapgrid.cpp
       
     4  *  Part of     : Hg Teleport
       
     5  *  Description : Teleport Fast Swap area UI
       
     6  *  Version     : %version:  19 %
       
     7  *
       
     8  *  Copyright © 2009 Nokia.  All rights reserved.
       
     9  *  This material, including documentation and any related computer
       
    10  *  programs, is protected by copyright controlled by Nokia.  All
       
    11  *  rights are reserved.  Copying, including reproducing, storing,
       
    12  *  adapting or translating, any or all of this material requires the
       
    13  *  prior written consent of Nokia.  This material also contains
       
    14  *  confidential information which may not be disclosed to others
       
    15  *  without the prior written consent of Nokia.
       
    16  * ============================================================================
       
    17  *
       
    18  */
       
    19 
       
    20 #include <avkon.mbg>
       
    21 #include <aknlayoutscalable_apps.cdl.h>
       
    22 #include <layoutmetadata.cdl.h>
       
    23 #include <AknsFrameBackgroundControlContext.h>
       
    24 #include <touchfeedback.h>
       
    25 
       
    26 #include "hgteleportfastswapgrid.h"
       
    27 
       
    28 // TODO: Layout update
       
    29 const TInt KCloseIconSize = 30;
       
    30 
       
    31 
       
    32  /* ================================================================================
       
    33   * CHgTeleportFastSwapGrid
       
    34   * ================================================================================
       
    35   */
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CHgTeleportFastSwapGrid::CHgTeleportFastSwapGrid
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CHgTeleportFastSwapGrid::CHgTeleportFastSwapGrid()
       
    42 : CAknGrid(),
       
    43   iCloseIconHitIdx( KErrNotFound ),
       
    44   iBehaviour( ETouchOnly ),
       
    45   iHighlightVisible( EFalse )
       
    46     {
       
    47     }
       
    48 
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CHgTeleportFastSwapGrid::~CHgTeleportFastSwapGrid
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CHgTeleportFastSwapGrid::~CHgTeleportFastSwapGrid()
       
    55     {
       
    56     iCloseItems.Close();
       
    57     delete iBgContext;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CHgTeleportFastSwapGrid::ConstructL
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 void CHgTeleportFastSwapGrid::ConstructL( const CCoeControl* aParent )
       
    65     {
       
    66     CAknGrid::ConstructL( aParent, EAknListBoxSelectionGrid );
       
    67     SetPrimaryScrollingType(CAknGridView::EScrollFollowsItemsAndLoops);
       
    68     SetSecondaryScrollingType(CAknGridView::EScrollFollowsItemsAndLoops);
       
    69     iBgContext = CAknsFrameBackgroundControlContext::NewL(
       
    70                KAknsIIDQsnFrPopup,
       
    71                TRect(),
       
    72                TRect(),
       
    73                ETrue );
       
    74     iBgContext->SetCenter( KAknsIIDQsnFrPopupCenter );
       
    75     iVisibleViewRect = TRect( 0, 0, 0, 0 );
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CHgTeleportFastSwapGrid::HandlePointerEventL
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 void CHgTeleportFastSwapGrid::HandlePointerEventL( const TPointerEvent &aPointerEvent )
       
    83     {
       
    84     TBool eventHandled( EFalse );
       
    85     if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
       
    86          iCloseIconHitIdx == KErrNotFound )
       
    87         {
       
    88         // Check if close icon has been hit
       
    89         // Find hit item
       
    90         TInt hitItem( KErrNotFound );
       
    91         for ( TInt i = 0; i < Model()->NumberOfItems(); i++ )
       
    92             {
       
    93             if ( GridView()->XYPosToItemIndex( aPointerEvent.iParentPosition, i ) )
       
    94                 {
       
    95                 hitItem = i;
       
    96                 break;
       
    97                 }
       
    98             }
       
    99         if ( hitItem != KErrNotFound )
       
   100             {
       
   101             // Item found, check if close icon has been hit
       
   102             TPoint itemPos = GridView()->ItemPos( hitItem );
       
   103             TSize itemSize = GridView()->ItemSize( hitItem );
       
   104             TRect itemRect( itemPos, itemSize );
       
   105             CHgTeleportGridItemDrawer* itemDrawer =
       
   106                 static_cast<CHgTeleportGridItemDrawer*>( ItemDrawer() );
       
   107             TRect closeIconRect = itemDrawer->GetCloseIconRect( itemRect );
       
   108             if ( closeIconRect.Contains( aPointerEvent.iParentPosition ) )
       
   109                 {
       
   110                 // Close icon hit
       
   111                 iCloseIconHitIdx = hitItem;
       
   112                 eventHandled = ETrue;
       
   113                 // Hide highlight to mark close icon
       
   114                 HideHighlight();
       
   115                 // Update current item and redraw grid
       
   116                 SetCurrentItemIndex( hitItem );
       
   117                 DrawNow();
       
   118                 if ( iFastSwapGridObserver )
       
   119                     {
       
   120                     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   121                     feedback->InstantFeedback(this,
       
   122                                               ETouchFeedbackBasicButton, 
       
   123                                               ETouchFeedbackVibra, 
       
   124                                               aPointerEvent);
       
   125                     iFastSwapGridObserver->HandleCloseEventL( hitItem );
       
   126                     }
       
   127                 ResetCloseHit();
       
   128                 if ( GridBehaviour() == EHybrid )
       
   129                     {
       
   130                     ShowHighlight();
       
   131                     }
       
   132                 else
       
   133                     {
       
   134                     Redraw();
       
   135                     }
       
   136                 }
       
   137             }
       
   138         }
       
   139     
       
   140     if ( !eventHandled )
       
   141         {
       
   142         CAknGrid::HandlePointerEventL( aPointerEvent );
       
   143         Redraw();
       
   144         }
       
   145     }
       
   146 
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CHgTeleportFastSwapGrid::HandleDeviceStateChanged
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 void CHgTeleportFastSwapGrid::HandleDeviceStateChanged( TChangeType aChangeType )
       
   153     {
       
   154     if ( aChangeType == ESkin )
       
   155         {
       
   156         LoadCloseIcon();
       
   157         }
       
   158     }
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CHgTeleportFastSwapGrid::MopSupplyObject
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 TTypeUid::Ptr CHgTeleportFastSwapGrid::MopSupplyObject( TTypeUid aId )
       
   165     {
       
   166     if ( aId.iUid == MAknsControlContext::ETypeId )
       
   167         {
       
   168         return MAknsControlContext::SupplyMopObject( aId, iBgContext );
       
   169         }
       
   170     return CCoeControl::MopSupplyObject( aId );
       
   171     }
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CHgTeleportFastSwapGrid::HandleResourceChange
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void CHgTeleportFastSwapGrid::HandleResourceChange( TInt aType )
       
   179     {
       
   180     if ( aType != KEikDynamicLayoutVariantSwitch )
       
   181         {
       
   182         CAknGrid::HandleResourceChange( aType );
       
   183         }
       
   184     }
       
   185 
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // CHgTeleportFastSwapGrid::SizeChanged
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 void CHgTeleportFastSwapGrid::SizeChanged()
       
   192     {
       
   193     }
       
   194 
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CHgTeleportFastSwapGrid::SetFastSwapGridObserver
       
   198 // -----------------------------------------------------------------------------
       
   199 //
       
   200 void CHgTeleportFastSwapGrid::SetFastSwapGridObserver( MHgTeleportFastSwapGridObserver* aObserver )
       
   201     {
       
   202     iFastSwapGridObserver = aObserver;
       
   203     }
       
   204 
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CHgTeleportFastSwapGrid::CreateItemDrawerL
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 void CHgTeleportFastSwapGrid::CreateItemDrawerL()
       
   211     {
       
   212     TRect availableRect;
       
   213     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, availableRect);
       
   214     TAknLayoutRect fastSwapAreaPane;
       
   215     TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
       
   216     fastSwapAreaPane.LayoutRect( availableRect,
       
   217             AknLayoutScalable_Apps::tport_appsw_pane( variety ) );
       
   218     const TInt leftOffset = fastSwapAreaPane.Rect().iTl.iX;
       
   219     const TInt rightOffset = availableRect.Width() - fastSwapAreaPane.Rect().iBr.iX;
       
   220     
       
   221     CFormattedCellGridData* data = CFormattedCellGridData::NewL();
       
   222     CleanupStack::PushL( data );
       
   223     CHgTeleportGridItemDrawer* itemDrawer =
       
   224         new ( ELeave ) CHgTeleportGridItemDrawer( this, data );
       
   225     CleanupStack::PushL( itemDrawer );
       
   226     itemDrawer->SetEdgeOffset( leftOffset, rightOffset );
       
   227     iItemDrawer = itemDrawer;
       
   228     CleanupStack::Pop( itemDrawer );
       
   229     CleanupStack::Pop( data );
       
   230     LoadCloseIcon();
       
   231     }
       
   232 
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // CHgTeleportFastSwapGrid::SetCloseItemsL
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 void CHgTeleportFastSwapGrid::SetCloseItemsL( RArray<TInt>& aItemIndex )
       
   239     {
       
   240     iCloseItems.Close();
       
   241     for ( TInt i = 0; i < aItemIndex.Count(); i++ )
       
   242         {
       
   243         iCloseItems.AppendL( aItemIndex[i] );
       
   244         }
       
   245     }
       
   246 
       
   247 
       
   248 // -----------------------------------------------------------------------------
       
   249 // CHgTeleportFastSwapGrid::CanCloseItem
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 TBool CHgTeleportFastSwapGrid::CanCloseItem( TInt aItemIndex )
       
   253     {
       
   254     return iCloseItems.Find(aItemIndex) != KErrNotFound;
       
   255     }
       
   256 
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CHgTeleportFastSwapGrid::ItemCloseHit
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 TBool CHgTeleportFastSwapGrid::IsItemCloseHit( TInt aItemIndex )
       
   263     {
       
   264     return iCloseIconHitIdx == aItemIndex;
       
   265     }
       
   266 
       
   267 
       
   268 // -----------------------------------------------------------------------------
       
   269 // CHgTeleportFastSwapGrid::ResetCloseHit
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 void CHgTeleportFastSwapGrid::ResetCloseHit()
       
   273     {
       
   274     iCloseIconHitIdx = KErrNotFound;
       
   275     }
       
   276 
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 // CHgTeleportFastSwapGrid::SetBehaviour
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 void CHgTeleportFastSwapGrid::SetGridBehaviour( TFastSwapGridBehaviour aBehaviour )
       
   283     {
       
   284     iBehaviour = aBehaviour;
       
   285     switch ( iBehaviour )
       
   286         {
       
   287         case ETouchOnly:
       
   288             {
       
   289             HideHighlight();
       
   290             }
       
   291             break;
       
   292         default:
       
   293             {
       
   294             ShowHighlight();
       
   295             }
       
   296             break;
       
   297         }
       
   298     }
       
   299 
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CHgTeleportFastSwapGrid::GridBehaviour
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 CHgTeleportFastSwapGrid::TFastSwapGridBehaviour CHgTeleportFastSwapGrid::GridBehaviour()
       
   306     {
       
   307     return iBehaviour;
       
   308     }
       
   309 
       
   310 
       
   311 // -----------------------------------------------------------------------------
       
   312 // CHgTeleportFastSwapGrid::ShowHighlight
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void CHgTeleportFastSwapGrid::ShowHighlight()
       
   316     {
       
   317     if ( !iHighlightVisible )
       
   318         {
       
   319         // Draw highlight
       
   320         iHighlightVisible = ETrue;
       
   321         Redraw();
       
   322         }
       
   323     }
       
   324 
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // CHgTeleportFastSwapGrid::HideHighlight
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 void CHgTeleportFastSwapGrid::HideHighlight()
       
   331     {
       
   332     if ( iHighlightVisible )
       
   333         {
       
   334         iHighlightVisible = EFalse;
       
   335         Redraw();
       
   336         }
       
   337     }
       
   338 
       
   339 
       
   340 // -----------------------------------------------------------------------------
       
   341 // CHgTeleportFastSwapGrid::IsHighlightVisible
       
   342 // -----------------------------------------------------------------------------
       
   343 //
       
   344 TBool CHgTeleportFastSwapGrid::IsHighlightVisible()
       
   345     {
       
   346     return iHighlightVisible;
       
   347     }
       
   348 
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // CHgTeleportFastSwapGrid::SetVisibleViewRect
       
   352 // -----------------------------------------------------------------------------
       
   353 //
       
   354 void CHgTeleportFastSwapGrid::SetVisibleViewRect( const TRect aRect )
       
   355     {
       
   356     iVisibleViewRect = aRect;
       
   357     }
       
   358 
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CHgTeleportFastSwapGrid::VisibleViewRect
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 TRect CHgTeleportFastSwapGrid::VisibleViewRect()
       
   365     {
       
   366     TRect retVal;
       
   367     TRect emptyRect = TRect( 0, 0, 0, 0 );
       
   368     if ( iVisibleViewRect == emptyRect )
       
   369         {
       
   370         retVal = Rect();
       
   371         }
       
   372     else
       
   373         {
       
   374         retVal = iVisibleViewRect;
       
   375         }
       
   376     return retVal;
       
   377     }
       
   378 
       
   379 
       
   380 // -----------------------------------------------------------------------------
       
   381 // CHgTeleportFastSwapGrid::LoadCloseIconL
       
   382 // -----------------------------------------------------------------------------
       
   383 //
       
   384 void CHgTeleportFastSwapGrid::LoadCloseIcon()
       
   385     {
       
   386     // Load and set close icon
       
   387     CFbsBitmap* icon = NULL;
       
   388     CFbsBitmap* mask = NULL;
       
   389 
       
   390     TRAP_IGNORE(AknsUtils::CreateIconLC( AknsUtils::SkinInstance(),
       
   391                 KAknsIIDQgnIndiItutListCollapse,
       
   392                 icon,
       
   393                 mask,
       
   394                 KAvkonBitmapFile,
       
   395                 EMbmAvkonQgn_indi_button_preview_close,
       
   396                 EMbmAvkonQgn_indi_button_preview_close_mask
       
   397                 );
       
   398                 CleanupStack::Pop( 2 ); // codescanner::cleanup
       
   399                 );
       
   400 
       
   401     // TODO: Layout update
       
   402     AknIconUtils::SetSize( icon, TSize( KCloseIconSize, KCloseIconSize ), EAspectRatioPreserved );
       
   403     AknIconUtils::SetSize( mask, TSize( KCloseIconSize, KCloseIconSize ), EAspectRatioPreserved );
       
   404 
       
   405     static_cast<CHgTeleportGridItemDrawer*>(iItemDrawer)->SetCloseIcon( icon, mask );
       
   406     }
       
   407 
       
   408 
       
   409 // -----------------------------------------------------------------------------
       
   410 // CHgTeleportFastSwapGrid::Redraw
       
   411 // -----------------------------------------------------------------------------
       
   412 //
       
   413 void CHgTeleportFastSwapGrid::Redraw()
       
   414     {
       
   415     DrawDeferred();
       
   416     CCoeControl* ctrlToRedraw = Parent();
       
   417     if ( ctrlToRedraw )
       
   418         {
       
   419         ctrlToRedraw->DrawDeferred();
       
   420         ctrlToRedraw = ctrlToRedraw->Parent();
       
   421         if ( ctrlToRedraw )
       
   422             {
       
   423             ctrlToRedraw->DrawNow();
       
   424             }
       
   425         }
       
   426     }
       
   427 
       
   428 
       
   429 /* ================================================================================
       
   430  * CHgTeleportGridItemDrawer
       
   431  * ================================================================================
       
   432  */
       
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 // CHgTeleportGridItemDrawer::CHgTeleportGridItemDrawer
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 CHgTeleportGridItemDrawer::CHgTeleportGridItemDrawer(
       
   439         CHgTeleportFastSwapGrid* aGrid,
       
   440         CFormattedCellListBoxData* aData )
       
   441 : CFormattedCellListBoxItemDrawer( aGrid->Model(),
       
   442         NULL,
       
   443         aData ),
       
   444   iGrid( aGrid )
       
   445     {
       
   446     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, iScreenRect);
       
   447     }
       
   448 
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // CHgTeleportGridItemDrawer::~CHgTeleportGridItemDrawer
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 CHgTeleportGridItemDrawer::~CHgTeleportGridItemDrawer()
       
   455     {
       
   456     delete iCloseIcon;
       
   457     delete iCloseIconMask;
       
   458     }
       
   459 
       
   460 
       
   461 // -----------------------------------------------------------------------------
       
   462 // CHgTeleportGridItemDrawer::SetCloseIcon
       
   463 // -----------------------------------------------------------------------------
       
   464 //
       
   465 void CHgTeleportGridItemDrawer::SetCloseIcon( CFbsBitmap* aBmp, CFbsBitmap* aMask )
       
   466     {
       
   467     delete iCloseIcon;
       
   468     iCloseIcon = aBmp;
       
   469     delete iCloseIconMask;
       
   470     iCloseIconMask = aMask;
       
   471     }
       
   472 
       
   473 
       
   474 // -----------------------------------------------------------------------------
       
   475 // CHgTeleportGridItemDrawer::GetCloseIconRect
       
   476 // -----------------------------------------------------------------------------
       
   477 //
       
   478 TRect CHgTeleportGridItemDrawer::GetCloseIconRect( const TRect& aItemRect ) const
       
   479     {
       
   480     // TODO: layout update
       
   481     const TInt KRightMargin = 7;
       
   482     const TInt KTopMargin = 34;
       
   483     TRect retVal( TPoint(aItemRect.iBr.iX - KCloseIconSize - KRightMargin,
       
   484                          aItemRect.iTl.iY + KTopMargin),
       
   485                          TSize( KCloseIconSize, KCloseIconSize ) );
       
   486     return retVal;
       
   487     }
       
   488 
       
   489 
       
   490 // -----------------------------------------------------------------------------
       
   491 // CHgTeleportGridItemDrawer::SetEdgeOffset
       
   492 // -----------------------------------------------------------------------------
       
   493 //
       
   494 void CHgTeleportGridItemDrawer::SetEdgeOffset( TInt aLeftOffset, TInt aRightOffset )
       
   495     {
       
   496     iLeftOffset = aLeftOffset;
       
   497     iRightOffset = aRightOffset;
       
   498     }
       
   499 
       
   500 
       
   501 // -----------------------------------------------------------------------------
       
   502 // CHgTeleportGridItemDrawer::DrawActualItem
       
   503 // -----------------------------------------------------------------------------
       
   504 //
       
   505  void CHgTeleportGridItemDrawer::DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
       
   506                                                  TBool aItemIsCurrent, TBool aViewIsEmphasized,
       
   507                                                  TBool aViewIsDimmed, TBool aItemIsSelected ) const
       
   508     {
       
   509     if ( IsItemRectVisible( aActualItemRect ) )
       
   510         {
       
   511         // Calculate offset of the visible rectangle
       
   512         TRect drawRect = aActualItemRect;
       
   513         if ( drawRect.iTl.iX < iLeftOffset )
       
   514             {
       
   515             drawRect.iTl.iX = iLeftOffset;
       
   516             }
       
   517         if ( iScreenRect.Width() - drawRect.iBr.iX < iRightOffset )
       
   518             {
       
   519             drawRect.iBr.iX = iScreenRect.Width() - iRightOffset;
       
   520             }
       
   521         iGc->SetClippingRect(drawRect);
       
   522         
       
   523         // Check for item highlight
       
   524         TBool itemIsCurrent = !iGrid->IsHighlightVisible() ? EFalse : aItemIsCurrent;
       
   525         
       
   526         // Draw item
       
   527         CFormattedCellListBoxItemDrawer::DrawActualItem(aItemIndex, aActualItemRect,
       
   528                 itemIsCurrent, aViewIsEmphasized, aViewIsDimmed, aItemIsSelected );
       
   529         
       
   530         if ( iGrid->CanCloseItem( aItemIndex ) && iCloseIcon && iCloseIconMask )
       
   531             {
       
   532             TRect closeIconRect = GetCloseIconRect( aActualItemRect );
       
   533             // Draw frame
       
   534             // TODO: layout update
       
   535             const TInt KFrameGrow = 5;
       
   536             TRect innerRect = closeIconRect;
       
   537             TRect outerRect = innerRect;
       
   538             outerRect.Grow(KFrameGrow, KFrameGrow);
       
   539             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   540             if ( iGrid->IsItemCloseHit( aItemIndex ) )
       
   541                 {
       
   542                 AknsDrawUtils::DrawFrame(skin, *iGc, outerRect, innerRect,
       
   543                         KAknsIIDQgnFrSctrlButtonPressed, KAknsIIDQgnFrSctrlButtonCenterPressed);
       
   544                 }
       
   545             else
       
   546                 {
       
   547                 AknsDrawUtils::DrawFrame(skin, *iGc, outerRect, innerRect,
       
   548                         KAknsIIDQgnFrSctrlButton, KAknsIIDQgnFrSctrlButtonCenter);
       
   549                 }
       
   550             // Draw close icon
       
   551             TRect sourceRect( TPoint(0,0), iCloseIcon->SizeInPixels() );
       
   552             iGc->DrawBitmapMasked( closeIconRect, iCloseIcon, sourceRect, iCloseIconMask, ETrue );
       
   553             }
       
   554         }
       
   555     }
       
   556 
       
   557 
       
   558 // -----------------------------------------------------------------------------
       
   559 // CHgTeleportGridItemDrawer::DrawActualItem
       
   560 // -----------------------------------------------------------------------------
       
   561 //
       
   562 TBool CHgTeleportGridItemDrawer::IsItemRectVisible( const TRect& aItemRect ) const
       
   563     {
       
   564     TBool retVal( EFalse );
       
   565     TRect viewRect = iGrid->VisibleViewRect();
       
   566     if ( // left edge of item rectangle on screen
       
   567          ( aItemRect.iTl.iX >= viewRect.iTl.iX && aItemRect.iTl.iX <= viewRect.iBr.iX ) ||
       
   568          // right edge of item rectangle on screen
       
   569          ( aItemRect.iBr.iX >= viewRect.iTl.iX && aItemRect.iBr.iX <= viewRect.iBr.iX )
       
   570         )
       
   571         {
       
   572         retVal = ETrue;
       
   573         }
       
   574     return retVal;
       
   575     }
       
   576  
       
   577  
       
   578  
       
   579  /* ================================================================================
       
   580   * CHgTeleportGridHighlightTimer
       
   581   * ================================================================================
       
   582   */
       
   583 
       
   584 // -----------------------------------------------------------------------------
       
   585 // CHgTeleportGridHighlightTimer::CHgTeleportGridHighlightTimer
       
   586 // -----------------------------------------------------------------------------
       
   587 //
       
   588 CHgTeleportFastSwapTimer::CHgTeleportFastSwapTimer( MHgTeleportFastSwapTimerObserver& aObserver )
       
   589 : CTimer( EPriorityStandard ),
       
   590   iObserver( &aObserver )
       
   591     {
       
   592     }
       
   593 
       
   594 
       
   595 // -----------------------------------------------------------------------------
       
   596 // CHgTeleportGridHighlightTimer::CHgTeleportGridHighlightTimer
       
   597 // -----------------------------------------------------------------------------
       
   598 //
       
   599 CHgTeleportFastSwapTimer::~CHgTeleportFastSwapTimer()
       
   600     {
       
   601     Cancel();
       
   602     }
       
   603 
       
   604 
       
   605 // -----------------------------------------------------------------------------
       
   606 // CHgTeleportGridHighlightTimer::ConstructL
       
   607 // -----------------------------------------------------------------------------
       
   608 //
       
   609 void CHgTeleportFastSwapTimer::ConstructL()
       
   610     {
       
   611     CTimer::ConstructL();
       
   612     CActiveScheduler::Add( this );
       
   613     }
       
   614 
       
   615 
       
   616 // -----------------------------------------------------------------------------
       
   617 // CHgTeleportGridHighlightTimer::CHgTeleportGridHighlightTimer
       
   618 // -----------------------------------------------------------------------------
       
   619 //
       
   620 void CHgTeleportFastSwapTimer::RunL()
       
   621     {
       
   622     iObserver->TimerCompletedL(this);
       
   623     }
       
   624  
       
   625  // End of file