taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp
branchRCL_3
changeset 11 ff572dfe6d86
parent 9 f966699dea19
child 12 9674c1a575e9
equal deleted inserted replaced
9:f966699dea19 11:ff572dfe6d86
    66 const TInt KLayoutItemCount = 4;
    66 const TInt KLayoutItemCount = 4;
    67 
    67 
    68 const TInt KRedrawTime = 250000; // 0.25 sec
    68 const TInt KRedrawTime = 250000; // 0.25 sec
    69 const TInt KRedrawTimeForLayoutSwitch = 700000; // 0.7 sec
    69 const TInt KRedrawTimeForLayoutSwitch = 700000; // 0.7 sec
    70 const TInt KHighlighActivationTime = 100000; // 100 ms
    70 const TInt KHighlighActivationTime = 100000; // 100 ms
    71 const TInt KUpdateGridTime = 1000000; // 1 s
    71 const TInt KUpdateGridTime = 0; // imediately
    72 
    72 
    73 const TInt KMaxGranularity = 4;
    73 const TInt KMaxGranularity = 4;
    74 
    74 
    75 // -----------------------------------------------------------------------------
    75 // -----------------------------------------------------------------------------
    76 // CTsFastSwapArea::NewL
    76 // CTsFastSwapArea::NewL
   204     iGrid->SetRect(gridAppPane.Rect());
   204     iGrid->SetRect(gridAppPane.Rect());
   205     TAknLayoutScalableParameterLimits gridParams = 
   205     TAknLayoutScalableParameterLimits gridParams = 
   206         AknLayoutScalable_Apps::cell_tport_appsw_pane_ParamLimits( variety );
   206         AknLayoutScalable_Apps::cell_tport_appsw_pane_ParamLimits( variety );
   207     TPoint empty( ELayoutEmpty, ELayoutEmpty );
   207     TPoint empty( ELayoutEmpty, ELayoutEmpty );
   208     
   208     
       
   209     // Setup bitmap layout
   209     AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0,
   210     AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0,
   210             AknLayoutScalable_Apps::cell_tport_appsw_pane_g1( variety ).LayoutLine(),
   211             AknLayoutScalable_Apps::cell_tport_appsw_pane_g1( variety ).LayoutLine(),
   211             empty, empty );
   212             empty, empty );
   212 
   213 
   213     // Setup text layout
   214     // Setup text layout
   214     TAknLayoutText textLayout;
   215     AknListBoxLayouts::SetupFormTextCell(*iGrid, iGrid->ItemDrawer(), 1,
   215     textLayout.LayoutText(
   216             AknLayoutScalable_Apps::cell_tport_appsw_pane_t1( variety ).LayoutLine(),
   216             Rect(),
   217             empty, empty);
   217             AknLayoutScalable_Apps::cell_tport_appsw_pane_t1( variety ).LayoutLine() );
   218     
   218     
       
   219     // Because textLayout.BaselineOffset() does not work (missing lib entry),
       
   220     // we need to calculate offset ourselves
       
   221     TInt baselineOffset = textLayout.TextRect().iBr.iY - textLayout.TextRect().iTl.iY;
       
   222     AknListBoxLayouts::SetupFormTextCell( *iGrid, iGrid->ItemDrawer(), 1 /*Column index*/,
       
   223                                           textLayout.Font() /*Font type*/,
       
   224                                           NULL /*color*/,
       
   225                                           textLayout.TextRect().iTl.iX /*Left margin*/, 0 /*unused*/,
       
   226                                           baselineOffset /*Baseline*/, 0 /*Text width*/,
       
   227                                           textLayout.Align() /*Text alignment*/,
       
   228                                           TPoint(0,0) /*Start pos*/,
       
   229                                           TPoint(0,0) /*End pos*/);
       
   230     // Text colors
   219     // Text colors
   231     TRgb textColor;
   220     TRgb textColor;
   232     AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
   221     AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
   233             KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
   222             KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
   234     TRgb highlightTextColor;
   223     TRgb highlightTextColor;
   745 //
   734 //
   746 void CTsFastSwapArea::HandleSwitchToForegroundEvent()
   735 void CTsFastSwapArea::HandleSwitchToForegroundEvent()
   747     {
   736     {
   748     TSLOG_CONTEXT( CTsFastSwapArea::HandleSwitchToForegroundEvent, TSLOG_LOCAL );
   737     TSLOG_CONTEXT( CTsFastSwapArea::HandleSwitchToForegroundEvent, TSLOG_LOCAL );
   749     TSLOG_IN();
   738     TSLOG_IN();
       
   739     
       
   740     // Reset grid
       
   741     TRAP_IGNORE( ReCreateGridL() );
   750     
   742     
   751     // get the current task list
   743     // get the current task list
   752     HandleFswContentChanged();
   744     HandleFswContentChanged();
   753     // and then start listening for changes
   745     // and then start listening for changes
   754     iFSClient->Subscribe( *this );
   746     iFSClient->Subscribe( *this );
  1251             visibleItem = SelectedIndex();
  1243             visibleItem = SelectedIndex();
  1252             }
  1244             }
  1253         if(visibleItem != SelectedIndex())
  1245         if(visibleItem != SelectedIndex())
  1254             {
  1246             {
  1255             iGrid->SetCurrentDataIndex( visibleItem );
  1247             iGrid->SetCurrentDataIndex( visibleItem );
  1256             DrawNow();
  1248             DrawDeferred();
  1257             }
  1249             }
  1258         }
  1250         }
  1259 
  1251 
  1260     iUpdateGridTimer->Cancel();
  1252     // Check if view is outside of grid world
  1261     iUpdateGridTimer->After(aRedrawDelay);
  1253     TPoint absViewPos = ViewPos();
       
  1254     absViewPos.iX -= Rect().Width() / 2;
       
  1255     if( !iEvtHandler.IsPhysicsRunning() &&
       
  1256         ( absViewPos.iX < 0 || absViewPos.iX + Rect().Width() > GridWorldSize().iWidth )
       
  1257       )
       
  1258         {
       
  1259         // View is outside of grid world - update view
       
  1260         iUpdateGridTimer->Cancel();
       
  1261         iUpdateGridTimer->After(aRedrawDelay);
       
  1262         }
  1262     }
  1263     }
  1263 
  1264 
  1264 // --------------------------------------------------------------------------
  1265 // --------------------------------------------------------------------------
  1265 // CTsFastSwapArea::GridWorldSize
  1266 // CTsFastSwapArea::GridWorldSize
  1266 // --------------------------------------------------------------------------
  1267 // --------------------------------------------------------------------------
  1361 // CTsFastSwapArea::Tap
  1362 // CTsFastSwapArea::Tap
  1362 // --------------------------------------------------------------------------
  1363 // --------------------------------------------------------------------------
  1363 //
  1364 //
  1364 void CTsFastSwapArea::TapL(const TPoint& aPoint)
  1365 void CTsFastSwapArea::TapL(const TPoint& aPoint)
  1365     {
  1366     {
  1366     if(iGrid->Rect().Contains(aPoint))
  1367     if(Rect().Contains(aPoint))
  1367         {
  1368         {
  1368         //provide tap pointer event to grid
  1369         //provide tap pointer event to grid
  1369         iGrid->HandlePointerEventL(iTapEvent);
  1370         iGrid->HandlePointerEventL(iTapEvent);
  1370         iHighlightTimer->Cancel();
  1371         iHighlightTimer->Cancel();
  1371         iHighlightTimer->After(KHighlighActivationTime);
  1372         iHighlightTimer->After(KHighlighActivationTime);
  1621                                        TPointerEvent() );
  1622                                        TPointerEvent() );
  1622             }
  1623             }
  1623         }
  1624         }
  1624     }
  1625     }
  1625 
  1626 
       
  1627 
       
  1628 // -----------------------------------------------------------------------------
       
  1629 // CTsFastSwapArea::UpdateComponentVisibility
       
  1630 // -----------------------------------------------------------------------------
       
  1631 //
       
  1632 void CTsFastSwapArea::UpdateComponentVisibility()
       
  1633     {
       
  1634     // Switch off scrollbars
       
  1635     CEikScrollBarFrame* scrollBar = iGrid->ScrollBarFrame();
       
  1636     if(scrollBar)
       
  1637         {
       
  1638         TRAP_IGNORE( scrollBar->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, 
       
  1639                                                         CEikScrollBarFrame::EOff));
       
  1640         }
       
  1641     }
       
  1642 
  1626 // End of file
  1643 // End of file