uifw/AvKon/src/aknchoicelist.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
   117     {
   117     {
   118         TRgb color( KRgbBlack );  // sane default for nonskinned case
   118         TRgb color( KRgbBlack );  // sane default for nonskinned case
   119         if ( AknsUtils::AvkonSkinEnabled() )
   119         if ( AknsUtils::AvkonSkinEnabled() )
   120             {
   120             {
   121             AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
   121             AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
   122                                    color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 );
   122                                    color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
   123             }
   123             }
   124 
   124 
   125         ItemDrawer()->SetTextColor( color );
   125         ItemDrawer()->SetTextColor( color );
   126         ItemDrawer()->SetBackColor( AKN_LAF_COLOR( 0 ) );
   126         ItemDrawer()->SetBackColor( AKN_LAF_COLOR( 0 ) );
   127 
   127 
   128         if ( AknsUtils::AvkonSkinEnabled() )
   128         if ( AknsUtils::AvkonSkinEnabled() )
   129             {
   129             {
   130             AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
   130             AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
   131                                    color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 );
   131                                    color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
   132             }
   132             }
   133 
   133 
   134         ItemDrawer()->SetHighlightedTextColor( color );
   134         ItemDrawer()->SetHighlightedTextColor( color );
   135         ItemDrawer()->SetHighlightedBackColor( AKN_LAF_COLOR( 0 ) );    
   135         ItemDrawer()->SetHighlightedBackColor( AKN_LAF_COLOR( 0 ) );    
   136     }
   136     }
   163 /**
   163 /**
   164 *  Control container for choice list
   164 *  Control container for choice list
   165 */
   165 */
   166 NONSHARABLE_CLASS( CAknChoiceListPopup ) : public CCoeControl,
   166 NONSHARABLE_CLASS( CAknChoiceListPopup ) : public CCoeControl,
   167                   public MEikListBoxObserver,                  
   167                   public MEikListBoxObserver,                  
   168                   MEikCommandObserver
   168                   MEikCommandObserver,
       
   169                   public MCoeForegroundObserver
   169     {
   170     {
   170 public:      
   171 public:      
   171     CAknChoiceListPopup() : iIndex( -1 ), iCancelled( EFalse )
   172     CAknChoiceListPopup() : iIndex( -1 ), iCancelled( EFalse )
   172         {
   173         {
   173         AKNTASHOOK_ADD( this, "CAknChoiceListPopup" );
   174         AKNTASHOOK_ADD( this, "CAknChoiceListPopup" );
   243             SetFocus( EFalse );            
   244             SetFocus( EFalse );            
   244 
   245 
   245             iAvkonAppUi->RemoveFromStack( this );
   246             iAvkonAppUi->RemoveFromStack( this );
   246             iEikonEnv->BringForwards( EFalse );
   247             iEikonEnv->BringForwards( EFalse );
   247             AknGlobalPopupPriorityController::ShowPopup(*this, EFalse);
   248             AknGlobalPopupPriorityController::ShowPopup(*this, EFalse);
       
   249             DrawableWindow()->SetNonFading( EFalse );
       
   250             iCoeEnv->RemoveForegroundObserver( *this );
   248             
   251             
   249             if ( AknLayoutUtils::PenEnabled() )
   252             if ( AknLayoutUtils::PenEnabled() )
   250                 {
   253                 {
   251                 SetPointerCapture( EFalse );
   254                 SetPointerCapture( EFalse );
   252                 }
   255                 }
   290             }
   293             }
   291         else
   294         else
   292             {
   295             {
   293             TRAP_IGNORE( iList->ScrollBarFrame()->SetScrollBarVisibilityL(
   296             TRAP_IGNORE( iList->ScrollBarFrame()->SetScrollBarVisibilityL(
   294                 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff) );
   297                 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff) );
   295                 
       
   296             // Enable scrolling
       
   297             iList->DisableScrolling( EFalse );   
       
   298             }
   298             }
   299             
   299             
   300         layoutRect.LayoutRect( rectParent, 
   300         layoutRect.LayoutRect( rectParent, 
   301             AknLayoutScalable_Avkon::list_choice_list_pane( variety ).LayoutLine() );        
   301             AknLayoutScalable_Avkon::list_choice_list_pane( variety ).LayoutLine() );        
   302         iList->SetRect( layoutRect.Rect() );
   302         iList->SetRect( layoutRect.Rect() );
   389         iIsDisplayed = ETrue;
   389         iIsDisplayed = ETrue;
   390         AknGlobalPopupPriorityController::AddPopupToControlStackL( *this );
   390         AknGlobalPopupPriorityController::AddPopupToControlStackL( *this );
   391         iEikonEnv->BringForwards( ETrue );
   391         iEikonEnv->BringForwards( ETrue );
   392         DrawableWindow()->SetOrdinalPosition( 0 );    
   392         DrawableWindow()->SetOrdinalPosition( 0 );    
   393         AknGlobalPopupPriorityController::ShowPopup(*this, ETrue);
   393         AknGlobalPopupPriorityController::ShowPopup(*this, ETrue);
   394         
   394         DrawableWindow()->SetNonFading( ETrue );
       
   395         iCoeEnv->AddForegroundObserverL( *this );
       
   396        
   395         // this will fix possibly corrupted index        
   397         // this will fix possibly corrupted index        
   396         if ( iIndex < iList->Model()->ItemTextArray()->MdcaCount() && iIndex >= 0 )
   398         if ( iIndex < iList->Model()->ItemTextArray()->MdcaCount() && iIndex >= 0 )
   397             {
   399             {
   398             iList->SetCurrentItemIndex( iIndex );
   400             iList->SetCurrentItemIndex( iIndex );
   399             }
   401             }
   467         if ( aType == EEventKey )
   469         if ( aType == EEventKey )
   468             {            
   470             {            
   469             if ( aKeyEvent.iScanCode == EStdKeyUpArrow || 
   471             if ( aKeyEvent.iScanCode == EStdKeyUpArrow || 
   470                  aKeyEvent.iScanCode == EStdKeyDownArrow || 
   472                  aKeyEvent.iScanCode == EStdKeyDownArrow || 
   471                  aKeyEvent.iScanCode == EStdKeyEnter ||
   473                  aKeyEvent.iScanCode == EStdKeyEnter ||
   472                  aKeyEvent.iScanCode == EStdKeyDevice3 )
   474                  aKeyEvent.iScanCode == EStdKeyDevice3 ||
       
   475                  aKeyEvent.iScanCode == EStdKeyNkpEnter )
   473                 {            
   476                 {            
   474                 return iList->OfferKeyEventL(aKeyEvent, aType);    
   477                 return iList->OfferKeyEventL(aKeyEvent, aType);    
   475                 }
   478                 }
   476             else
   479             else
   477                 {
   480                 {
   479                 return EKeyWasConsumed;                
   482                 return EKeyWasConsumed;                
   480                 }            
   483                 }            
   481             }
   484             }
   482         return EKeyWasNotConsumed;          
   485         return EKeyWasNotConsumed;          
   483         }
   486         }
       
   487     
       
   488     void HandleGainingForeground()
       
   489         {
       
   490         }
       
   491 
       
   492     void HandleLosingForeground()
       
   493         {
       
   494         CloseChoiceList();   
       
   495         }
   484 
   496 
   485 private:
   497 private:
   486 
   498 
   487      // ---------------------------------------------------------
   499      // ---------------------------------------------------------
   488     // CAknChoiceListPopup::CountComponentControls
   500     // CAknChoiceListPopup::CountComponentControls
   514     void HandlePointerEventL(const TPointerEvent &aPointerEvent)
   526     void HandlePointerEventL(const TPointerEvent &aPointerEvent)
   515         {
   527         {
   516         
   528         
   517         if ( AknLayoutUtils::PenEnabled() )
   529         if ( AknLayoutUtils::PenEnabled() )
   518             {
   530             {
   519             
       
   520             // Make sure that scrolling is enabled for choicelist
       
   521             if ( iList->ScrollingDisabled() )
       
   522                 {
       
   523                 iList->DisableScrolling( EFalse );
       
   524                 }
       
   525                     
       
   526             TRect ctrlArea = iList->Rect();
   531             TRect ctrlArea = iList->Rect();
   527             
   532             
   528             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   533             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   529                 {
   534                 {
   530                 if ( !ctrlArea.Contains( aPointerEvent.iPosition ) )
   535                 if ( !ctrlArea.Contains( aPointerEvent.iPosition ) )
   781         if ( AknsUtils::AvkonSkinEnabled() )
   786         if ( AknsUtils::AvkonSkinEnabled() )
   782             {
   787             {
   783            TRgb textColor;
   788            TRgb textColor;
   784 
   789 
   785             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
   790             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
   786                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8) == KErrNone )
   791                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone )
   787                 {
   792                 {
   788                 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( 
   793                 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( 
   789                     *iLabel, EColorLabelText, textColor) );
   794                     *iLabel, EColorLabelText, textColor) );
   790                 }
   795                 }
   791             }
   796             }
  1063         if ( AknsUtils::AvkonSkinEnabled() && iLabel )
  1068         if ( AknsUtils::AvkonSkinEnabled() && iLabel )
  1064             {
  1069             {
  1065            TRgb textColor;
  1070            TRgb textColor;
  1066 
  1071 
  1067             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
  1072             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
  1068                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8) == KErrNone )
  1073                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone )
  1069                 {
  1074                 {
  1070                 TRAP_IGNORE( 
  1075                 TRAP_IGNORE( 
  1071                     AknLayoutUtils::OverrideControlColorL( 
  1076                     AknLayoutUtils::OverrideControlColorL( 
  1072                         *iLabel, EColorLabelText, textColor) );
  1077                         *iLabel, EColorLabelText, textColor) );
  1073                 }
  1078                 }
  1126             {
  1131             {
  1127             if ( feedback && iArray->Count() > 0 )
  1132             if ( feedback && iArray->Count() > 0 )
  1128                 {
  1133                 {
  1129                 feedback->InstantFeedback(
  1134                 feedback->InstantFeedback(
  1130                     this,
  1135                     this,
  1131                     ETouchFeedbackBasicItem,
  1136                     ETouchFeedbackList,
  1132                     aPointerEvent );
  1137                     aPointerEvent );
  1133                 }     
  1138                 }     
  1134             if ( Rect().Contains( aPointerEvent.iPosition ))
  1139             if ( Rect().Contains( aPointerEvent.iPosition ))
  1135                 {
  1140                 {
  1136                 ShowTooltipL();               
  1141                 ShowTooltipL();               
  1154                 if ( CAknTransitionUtils::TransitionsEnabled( 
  1159                 if ( CAknTransitionUtils::TransitionsEnabled( 
  1155                         AknTransEffect::EComponentTransitionsOff ) )
  1160                         AknTransEffect::EComponentTransitionsOff ) )
  1156                     {
  1161                     {
  1157                     feedback->InstantFeedback(
  1162                     feedback->InstantFeedback(
  1158                         this,
  1163                         this,
  1159                         ETouchFeedbackPopupOpen,
  1164                         ETouchFeedbackIncreasingPopUp,
  1160                     	aPointerEvent );
  1165                     	aPointerEvent );
  1161                     }
  1166                     }
  1162                 else
  1167                 else
  1163                     {
  1168                     {
  1164                     feedback->InstantFeedback(
  1169                     feedback->InstantFeedback(
  1498         if ( AknsUtils::AvkonSkinEnabled() )
  1503         if ( AknsUtils::AvkonSkinEnabled() )
  1499             {
  1504             {
  1500            TRgb textColor;
  1505            TRgb textColor;
  1501 
  1506 
  1502             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
  1507             if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, 
  1503                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8) == KErrNone )
  1508                 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone )
  1504                 {
  1509                 {
  1505                 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( 
  1510                 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( 
  1506                     *iLabel, EColorLabelText, textColor) );
  1511                     *iLabel, EColorLabelText, textColor) );
  1507                 }
  1512                 }
  1508             }
  1513             }