uifw/ganes/src/HgScroller.cpp
branchRCL_3
changeset 9 aabf2c525e0f
parent 4 8ca85d2f0db7
child 10 9f56a4e1b8ab
equal deleted inserted replaced
4:8ca85d2f0db7 9:aabf2c525e0f
    78     iDrawUtils = CHgDrawUtils::NewL( callback );
    78     iDrawUtils = CHgDrawUtils::NewL( callback );
    79     
    79     
    80     iIndicatorManager = CHgIndicatorManager::NewL();
    80     iIndicatorManager = CHgIndicatorManager::NewL();
    81 
    81 
    82     /*
    82     /*
    83      * TODO: Vasco says it supports qwerty, so the variation cannot be done.
       
    84      *          Commented out for the time being to fix a crash.
       
    85     // Enable key search only in non-touch or hybrid (touch + qwerty) devices
    83     // Enable key search only in non-touch or hybrid (touch + qwerty) devices
    86     if( !AknLayoutUtils::PenEnabled() ||
    84     if( !AknLayoutUtils::PenEnabled() ||
    87         CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(KFeatureIdQwertyInput)) )
    85         CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(KFeatureIdQwertyInput)) )
    88         {
    86         {
    89         iTextFind = CHgTextFind::NewL( *this );
    87         iTextFind = CHgTextFind::NewL( *this );
   370 // -----------------------------------------------------------------------------
   368 // -----------------------------------------------------------------------------
   371 //
   369 //
   372 EXPORT_C CHgScroller::~CHgScroller ( )
   370 EXPORT_C CHgScroller::~CHgScroller ( )
   373     {
   371     {
   374     iCoeEnv->RemoveForegroundObserver( *this );
   372     iCoeEnv->RemoveForegroundObserver( *this );
   375     
   373     ReleasePopupFont();
       
   374 
   376     iItems.ResetAndDestroy();
   375     iItems.ResetAndDestroy();
   377 
   376 
   378     delete iManager;
   377     delete iManager;
   379     delete iPhysics;
   378     delete iPhysics;
   380     delete iScrollbar;
   379     delete iScrollbar;
   490 
   489 
   491     HandleItemCountChanged();
   490     HandleItemCountChanged();
   492     
   491     
   493     if( iPopupDrawer )
   492     if( iPopupDrawer )
   494         {
   493         {
   495         iPopupDrawer->Init( Rect(), 
   494         ReleasePopupFont();
   496                 &ScreenFont( TCoeFont( KFocusTextFontSize, TCoeFont::EPlain ) ) );
   495 
       
   496         TFontSpec fontSpecTitle = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips();
       
   497         fontSpecTitle.iHeight = KFocusTextFontSize; // set height
       
   498         iCoeEnv->ScreenDevice()->GetNearestFontInTwips(iPopupFont, fontSpecTitle);
       
   499     
       
   500         iPopupDrawer->Init( Rect(), iPopupFont );
   497         }
   501         }
   498     
   502     
   499     if(iFirstTime)
   503     if(iFirstTime)
   500         {
   504         {
   501         iViewPosition = TPoint(iWidth/2, iHeight/2);
   505         iViewPosition = TPoint(iWidth/2, iHeight/2);
   769             // Highlight timer hasn't triggered so lets set the highlight.
   773             // Highlight timer hasn't triggered so lets set the highlight.
   770             // this is not usually the case since interval is 50ms but just to be sure.
   774             // this is not usually the case since interval is 50ms but just to be sure.
   771             SetHighlightL();
   775             SetHighlightL();
   772             }
   776             }
   773         
   777         
   774         if( iFlags & EHgScrollerSelectionMode || iSelectionMode != ENoSelection ) 
   778         // selection needs to be valid.
   775             // Marking mode or shift key pressed ( or hash )
   779         if( iSelectedIndex >= 0 && iSelectedIndex < iItems.Count() )
   776             {
   780             {
   777             if( iItems[iSelectedIndex]->Flags() & CHgItem::EHgItemFlagMarked )
   781             if( iFlags & EHgScrollerSelectionMode || iSelectionMode != ENoSelection ) 
       
   782                 // Marking mode or shift key pressed ( or hash )
   778                 {
   783                 {
   779                 UnMark( iSelectedIndex );
   784                 if( iItems[iSelectedIndex]->Flags() & CHgItem::EHgItemFlagMarked )
       
   785                     {
       
   786                     UnMark( iSelectedIndex );
       
   787                     }
       
   788                 else
       
   789                     {
       
   790                     Mark( iSelectedIndex );                    
       
   791                     }
       
   792                 DrawDeferred();
   780                 }
   793                 }
   781             else
   794             else // Selection
   782                 {
   795                 {
   783                 Mark( iSelectedIndex );                    
   796                 if( iSelectionToFocusedItem || !HasHighlight() )
   784                 }
   797                     {
   785             DrawDeferred();
   798                     if(iSelectionObserver)
   786             }
   799                         iSelectionObserver->HandleOpenL(iSelectedIndex);
   787         else // Selection
   800                     }
   788             {
       
   789             if( iSelectionToFocusedItem || !HasHighlight() )
       
   790                 {
       
   791                 if(iSelectionObserver)
       
   792                     iSelectionObserver->HandleOpenL(iSelectedIndex);
       
   793                 }
   801                 }
   794             }
   802             }
   795         }
   803         }
   796     }
   804     }
   797 
   805 
  1732 TBool CHgScroller::HasHighlight() const
  1740 TBool CHgScroller::HasHighlight() const
  1733     {
  1741     {
  1734     return (iActionMenu == NULL) || iShowHighlight || (iFlags & EHgScrollerForceDoubleClick);
  1742     return (iActionMenu == NULL) || iShowHighlight || (iFlags & EHgScrollerForceDoubleClick);
  1735     }
  1743     }
  1736 
  1744 
       
  1745 // ---------------------------------------------------------------------------
       
  1746 // CHgScroller::ReleasePopupFont()
       
  1747 // ---------------------------------------------------------------------------
       
  1748 //     
       
  1749 void CHgScroller::ReleasePopupFont()
       
  1750     {
       
  1751     if (iPopupFont)
       
  1752         {
       
  1753         iCoeEnv->ScreenDevice()->ReleaseFont(iPopupFont);
       
  1754         iPopupFont = NULL;
       
  1755         }
       
  1756     }
       
  1757 
       
  1758 
  1737 // End of File
  1759 // End of File