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