uifw/EikStd/coctlsrc/EIKSCRLB.CPP
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
child 21 978afdc0236f
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
    39 
    39 
    40 #include "AknDoubleSpanScrollIndicator.h"
    40 #include "AknDoubleSpanScrollIndicator.h"
    41 #include "eikscrlb.h"
    41 #include "eikscrlb.h"
    42 #include "EIKSBEXT.H"
    42 #include "EIKSBEXT.H"
    43 
    43 
    44 const TInt KIntensity = 100; // 100%
       
    45 
       
    46 const TInt KScrollBarWidth=9;
    44 const TInt KScrollBarWidth=9;
    47 // const TInt KScrollButtonHeight=10;
    45 // const TInt KScrollButtonHeight=10;
    48 // const TInt KArrowHeadScrollBarLength=20;
    46 // const TInt KArrowHeadScrollBarLength=20;
    49 
    47 
    50 // Constants for double span scrollbar
    48 // Constants for double span scrollbar
   513 TInt CEikScrollBarExtension::ScrollBarType()
   511 TInt CEikScrollBarExtension::ScrollBarType()
   514     {
   512     {
   515     return CEikScrollBar::EArrowHead;
   513     return CEikScrollBar::EArrowHead;
   516     }
   514     }
   517 
   515 
   518 void CEikScrollBarExtension::CreateButtonL(CAknScrollButton*& /*aButton*/,CAknScrollButton::TType /*aType*/)
       
   519     {
       
   520     }
       
   521 
   516 
   522 void CEikScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
   517 void CEikScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
   523     {
   518     {
   524     iParent->iModel=(*aModel);
   519     iParent->iModel=(*aModel);
   525     iParent->iModel.CheckBounds();
   520     iParent->iModel.CheckBounds();
   672     {
   667     {
   673     AKNTASHOOK_REMOVE();
   668     AKNTASHOOK_REMOVE();
   674     if ( iAvkonAppUiBase )
   669     if ( iAvkonAppUiBase )
   675         {
   670         {
   676         CAknPointerEventModifier* modifier = iAvkonAppUiBase->PointerEventModifier();
   671         CAknPointerEventModifier* modifier = iAvkonAppUiBase->PointerEventModifier();
   677         
   672 
   678         if ( modifier )
   673         if ( modifier )
   679             {
   674             {
   680             modifier->Pop( *this );
   675             modifier->Pop( *this );
   681             }
   676             }
   682         }
   677         }
   683         
   678 
   684     AknsUtils::DeregisterControlPosition( this );
   679     AknsUtils::DeregisterControlPosition( this );
   685     }
   680     }
   686 
   681 
   687 EXPORT_C void CAknDoubleSpanScrollBar::ConstructL(TBool aWindowOwning, MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
   682 EXPORT_C void CAknDoubleSpanScrollBar::ConstructL(TBool aWindowOwning, MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
   688                                                  TOrientation aOrientation,TInt /*aLength*/,TInt aScrollBarFlags )
   683                                                  TOrientation aOrientation,TInt /*aLength*/,TInt aScrollBarFlags )
   704         }
   699         }
   705 
   700 
   706     if (aWindowOwning)
   701     if (aWindowOwning)
   707         {
   702         {
   708         CreateWindowL(aParent);
   703         CreateWindowL(aParent);
   709         if ( CAknEnv::Static()->TransparencyEnabled() )
   704         EnableWindowTransparency();
   710             {
   705         Window().SetPointerGrab( ETrue );
   711             Window().SetRequiredDisplayMode( EColor16MA );
   706         EnableDragEvents();
   712             if ( Window().SetTransparencyAlphaChannel() == KErrNone )
       
   713                 {
       
   714                 Window().SetBackgroundColor( ~0 );
       
   715                 }
       
   716             }
       
   717         }
   707         }
   718     else if(aParent)
   708     else if(aParent)
   719         {
   709         {
   720         SetContainerWindowL(*aParent);
   710         SetContainerWindowL(*aParent);
   721         }
   711         }
   729     else
   719     else
   730         SetObserver(NULL);
   720         SetObserver(NULL);
   731 
   721 
   732     iOrientation=aOrientation;
   722     iOrientation=aOrientation;
   733     CreateRequiredComponentsL();
   723     CreateRequiredComponentsL();
   734 
       
   735     if (aWindowOwning)
       
   736         {
       
   737         Window().SetPointerGrab(ETrue);
       
   738         EnableDragEvents();
       
   739         if (extension->iScrollIndicator)
       
   740                extension->iScrollIndicator->SetAsWindowOwning(ETrue);
       
   741 
       
   742 
       
   743         // By default set background to transparent
       
   744         SetTransparentBackground(ETrue);
       
   745         }
       
   746 
   724 
   747     SetComponentsToInheritVisibility(ETrue);
   725     SetComponentsToInheritVisibility(ETrue);
   748     MakeVisible(EFalse);
   726     MakeVisible(EFalse);
   749     ActivateL();
   727     ActivateL();
   750     }
   728     }
   844 
   822 
   845 
   823 
   846 EXPORT_C void CAknDoubleSpanScrollBar::MakeVisible(TBool aVisible)
   824 EXPORT_C void CAknDoubleSpanScrollBar::MakeVisible(TBool aVisible)
   847     {
   825     {
   848     CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
   826     CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
   849     
   827 
   850     if ( modifier )
   828     if ( modifier )
   851         {
   829         {
   852         CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
   830         CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
   853         if ( aVisible  && (extension->iScrollIndicator->ScrollSpan() > 0) )
   831         if ( aVisible  && (extension->iScrollIndicator->ScrollSpan() > 0)  && !( extension->iExtensionType & ENoExpandedTouchArea ) )
   854             {
   832             {
   855             modifier->Push( *this, ExtensionArea() );
   833             modifier->Push( *this, ExtensionArea() );
   856             }
   834             }
   857         else
   835         else
   858             {
   836             {
   914 
   892 
   915 
   893 
   916 EXPORT_C void CAknDoubleSpanScrollBar::SizeChanged()
   894 EXPORT_C void CAknDoubleSpanScrollBar::SizeChanged()
   917     {
   895     {
   918     CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
   896     CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
   919     
   897 
   920     if ( modifier && IsVisible() )
   898     if (iExtension)
   921         {
   899             {
   922         modifier->Update( *this, ExtensionArea() );
   900             CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
       
   901             if ( modifier && IsVisible() && !( extension->iExtensionType & ENoExpandedTouchArea ) )
       
   902                 {
       
   903                 modifier->Update( *this, ExtensionArea() );
       
   904                 }
       
   905           }
       
   906     else
       
   907         {
       
   908         if ( modifier && IsVisible()  )
       
   909             {
       
   910             modifier->Update( *this, ExtensionArea() );
       
   911             }
   923         }
   912         }
   924 
   913 
   925     AknsUtils::RegisterControlPosition( this );
   914     AknsUtils::RegisterControlPosition( this );
   926     if (iExtension)
   915     if (iExtension)
   927         {
   916         {
  1052     // clear the pointer down info on pen up and hide info popup
  1041     // clear the pointer down info on pen up and hide info popup
  1053     TInt lastPointerDownOn = extension->iPointerDownOn;
  1042     TInt lastPointerDownOn = extension->iPointerDownOn;
  1054     // The real span area available (as pixels)
  1043     // The real span area available (as pixels)
  1055     scrollSpanPix -= thumbSpanPix;
  1044     scrollSpanPix -= thumbSpanPix;
  1056 
  1045 
  1057             
  1046 
  1058          // touch release on thumb
  1047      // touch release on thumb
  1059          TBool thumbPressed = 
  1048     TBool thumbPressed =
  1060                  ( position < (thumbPositionPix + thumbSpanPix) 
  1049              ( position < (thumbPositionPix + thumbSpanPix)
  1061                          && position > thumbPositionPix );
  1050                      && position > thumbPositionPix );
  1062          if ( thumbPressed &&
  1051     if ( thumbPressed &&
  1063               aPointerEvent.iType == TPointerEvent::EButton1Up &&
  1052           aPointerEvent.iType == TPointerEvent::EButton1Up &&
  1064               thumbSpan < scrollSpan )
  1053           thumbSpan < scrollSpan )
       
  1054         {
       
  1055          MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1056 
       
  1057          CCoeControl* parent = Parent();
       
  1058          TBool feedbackEnabled = !IsDimmed() && IsVisible();
       
  1059          if (parent && feedbackEnabled)
  1065              {
  1060              {
  1066              MTouchFeedback* feedback = MTouchFeedback::Instance();
  1061              // check the same for the parent
  1067 
  1062              feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
  1068              CCoeControl* parent = Parent();
       
  1069              TBool feedbackEnabled = !IsDimmed() && IsVisible();
       
  1070              if (parent && feedbackEnabled)
       
  1071                  {
       
  1072                  // check the same for the parent
       
  1073                  feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
       
  1074                  }
       
  1075              if ( feedback && feedbackEnabled )
       
  1076                  {
       
  1077                  feedback->InstantFeedback( this, 
       
  1078                                             ETouchFeedbackBasicSlider, 
       
  1079                                             ETouchFeedbackVibra, 
       
  1080                                             aPointerEvent );
       
  1081                  }
       
  1082              }
  1063              }
  1083      
  1064          if ( feedback && feedbackEnabled )
       
  1065              {
       
  1066              feedback->InstantFeedback( this,
       
  1067                                         ETouchFeedbackSlider,
       
  1068                                         ETouchFeedbackVibra,
       
  1069                                         aPointerEvent );
       
  1070              }
       
  1071          }
       
  1072 
       
  1073      if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
  1074          {
       
  1075          extension->iPointerDownOn = CEikScrollBar::ENone;
       
  1076 
       
  1077          // Highlight off always when the pointer is lifted
       
  1078          indicator->SetHandleHighlight( EFalse );
       
  1079          indicator->DrawDeferred();
       
  1080          indicator->SetBackgroudHighlight( EFalse );
       
  1081 
       
  1082          if ( extension->iPopupController )
       
  1083              {
       
  1084              extension->iPopupController->HideInfoPopupNote();
       
  1085                  extension->iShowPopup = EFalse;
       
  1086              }
       
  1087          }
  1084     // check that scroll bar is useful
  1088     // check that scroll bar is useful
  1085     if (thumbSpan < scrollSpan)
  1089     if (thumbSpan < scrollSpan)
  1086         {
  1090         {
  1087         // check where the pointer down occured
  1091         // check where the pointer down occured
  1088         if(aPointerEvent.iType == TPointerEvent::EButton1Down )
  1092         if(aPointerEvent.iType == TPointerEvent::EButton1Down )
  1089             {
  1093             {
  1090             indicator->SetBackgroudHighlight( ETrue );
  1094             indicator->SetBackgroudHighlight( ETrue );
  1091 
  1095 
  1092             extension->iPointerDownPosition  = position;
  1096             extension->iPointerDownPosition  = position;
  1093             
  1097 
  1094             if(iButtons.iIncreaseNudge &&
  1098             if(iButtons.iIncreaseNudge &&
  1095                iButtons.iIncreaseNudge->Rect().Contains(aPointerEvent.iPosition))
  1099                iButtons.iIncreaseNudge->Rect().Contains(aPointerEvent.iPosition))
  1096                 {
  1100                 {
  1097                 extension->iPointerDownOn = CEikScrollBar::EIncreaseNudgeButton;
  1101                 extension->iPointerDownOn = CEikScrollBar::EIncreaseNudgeButton;
  1098                 }
  1102                 }
  1118                 {
  1122                 {
  1119                 extension->iPointerDownOn = CEikScrollBar::EIncreaseShaft;
  1123                 extension->iPointerDownOn = CEikScrollBar::EIncreaseShaft;
  1120                 }
  1124                 }
  1121             }
  1125             }
  1122 
  1126 
  1123         if (aPointerEvent.iType == TPointerEvent::EButton1Up)
       
  1124             {
       
  1125             extension->iPointerDownOn = CEikScrollBar::ENone;
       
  1126 
       
  1127             // Highlight off always when the pointer is lifted
       
  1128             indicator->SetHandleHighlight( EFalse );
       
  1129             indicator->DrawDeferred();
       
  1130             indicator->SetBackgroudHighlight( EFalse );
       
  1131 
       
  1132             if ( extension->iPopupController )
       
  1133                 {
       
  1134                 extension->iPopupController->HideInfoPopupNote();
       
  1135                     extension->iShowPopup = EFalse;
       
  1136                 }
       
  1137             }
       
  1138 
       
  1139         // respond to the pointer event
  1127         // respond to the pointer event
  1140         switch(extension->iPointerDownOn)
  1128         switch(extension->iPointerDownOn)
  1141             {
  1129             {
  1142             case CEikScrollBar::EDecreaseShaft:
  1130             case CEikScrollBar::EDecreaseShaft:
  1143             case CEikScrollBar::EIncreaseShaft:
  1131             case CEikScrollBar::EIncreaseShaft:
  1152                         thumbPosition -= thumbSpan;
  1140                         thumbPosition -= thumbSpan;
  1153                         thumbPosition = Max(0, thumbPosition);
  1141                         thumbPosition = Max(0, thumbPosition);
  1154 
  1142 
  1155 
  1143 
  1156                         TInt prevPosValue = extension->ThumbPosition();
  1144                         TInt prevPosValue = extension->ThumbPosition();
  1157                         
  1145 
  1158                         // This will update the thumb's pixel extent, used
  1146                         // This will update the thumb's pixel extent, used
  1159                         // below
  1147                         // below
  1160                         extension->SetModelThumbPosition(thumbPosition);
  1148                         extension->SetModelThumbPosition(thumbPosition);
  1161                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1149                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1162 
  1150 
  1172                                 // check the same for the parent
  1160                                 // check the same for the parent
  1173                                 feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
  1161                                 feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
  1174                                 }
  1162                                 }
  1175                             if ( feedback && feedbackEnabled )
  1163                             if ( feedback && feedbackEnabled )
  1176                                 {
  1164                                 {
  1177                                 feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aPointerEvent );
  1165                                 feedback->InstantFeedback( this, ETouchFeedbackSlider, aPointerEvent );
  1178                                 }
  1166                                 }
  1179                             }
  1167                             }
  1180 
  1168 
  1181                         // request pointer repeat until the thumb reaches the pen down position
  1169                         // request pointer repeat until the thumb reaches the pen down position
  1182                         TInt newThumbPosPix = indicator->GetCurrentThumbPositionInPixels();
  1170                         TInt newThumbPosPix = indicator->GetCurrentThumbPositionInPixels();
  1195                                 ignoreRect.iBr = TPoint(newThumbPosPix, rt.iBr.iY);
  1183                                 ignoreRect.iBr = TPoint(newThumbPosPix, rt.iBr.iY);
  1196                                 }
  1184                                 }
  1197                             // repeat until thumb reaches the stylus down position
  1185                             // repeat until thumb reaches the stylus down position
  1198                             pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
  1186                             pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
  1199                             }
  1187                             }
  1200                         
  1188 
  1201 
  1189 
  1202                         }
  1190                         }
  1203                     else
  1191                     else
  1204                         {
  1192                         {
  1205                         event = iOrientation==EHorizontal ? EEikScrollPageRight : EEikScrollPageDown;
  1193                         event = iOrientation==EHorizontal ? EEikScrollPageRight : EEikScrollPageDown;
  1222                                 // check the same for the parent
  1210                                 // check the same for the parent
  1223                                 feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
  1211                                 feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
  1224                                 }
  1212                                 }
  1225                             if ( feedback && feedbackEnabled )
  1213                             if ( feedback && feedbackEnabled )
  1226                                 {
  1214                                 {
  1227                                 feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aPointerEvent );
  1215                                 feedback->InstantFeedback( this, ETouchFeedbackSlider, aPointerEvent );
  1228                                 }
  1216                                 }
  1229                             }
  1217                             }
  1230 
  1218 
  1231                         // request pointer repeat until the thumb reaches the pen down position
  1219                         // request pointer repeat until the thumb reaches the pen down position
  1232                         TInt newThumbPosPix = indicator->GetCurrentThumbPositionInPixels();
  1220                         TInt newThumbPosPix = indicator->GetCurrentThumbPositionInPixels();
  1246                                 }
  1234                                 }
  1247                             // repeat until thumb reaches the stylus down position
  1235                             // repeat until thumb reaches the stylus down position
  1248                             pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
  1236                             pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
  1249 
  1237 
  1250                             }
  1238                             }
  1251                         
  1239 
  1252                         }
  1240                         }
  1253 
  1241 
  1254                     if(indicator->DrawBackgroundState())
  1242                     if(indicator->DrawBackgroundState())
  1255                         indicator->DrawNow();
  1243                         indicator->DrawNow();
  1256                     else
  1244                     else
  1270                     {
  1258                     {
  1271                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1259                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1272 
  1260 
  1273                     if ( feedback )
  1261                     if ( feedback )
  1274                         {
  1262                         {
  1275                         TTouchFeedbackType fbType = TTouchFeedbackType( 
  1263                         TTouchFeedbackType fbType = TTouchFeedbackType(
  1276                                                         ETouchFeedbackAudio |
  1264                                                         ETouchFeedbackAudio |
  1277                                                         ETouchFeedbackVibra );
  1265                                                         ETouchFeedbackVibra );
  1278                           
  1266 
  1279                         feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, fbType, aPointerEvent );
  1267                         feedback->InstantFeedback( this, ETouchFeedbackSlider, fbType, aPointerEvent );
  1280                         }
  1268                         }
  1281                     }
  1269                     }
  1282 
  1270 
  1283                 if( aPointerEvent.iType == TPointerEvent::EDrag 
  1271                 if( aPointerEvent.iType == TPointerEvent::EDrag
  1284                    || aPointerEvent.iType == TPointerEvent::EButtonRepeat )
  1272                    || aPointerEvent.iType == TPointerEvent::EButtonRepeat )
  1285                     {
  1273                     {
  1286                     // performace improving. Too many drag event received, handling every single event 
  1274                     // performace improving. Too many drag event received, handling every single event
  1287                     // will use too much CPU time.
  1275                     // will use too much CPU time.
  1288                     TTime now;
  1276                     TTime now;
  1289                     now.HomeTime();                    
  1277                     now.HomeTime();
  1290                     if ( extension->iDragged &&
  1278                     if ( extension->iDragged &&
  1291                          now.MicroSecondsFrom( extension->iLastDrag ) 
  1279                          now.MicroSecondsFrom( extension->iLastDrag )
  1292                          < KScrollDragTimeout )
  1280                          < KScrollDragTimeout )
  1293                         {                        
  1281                         {
  1294                         break; // ignore drag for this time
  1282                         break; // ignore drag for this time
  1295                         }
  1283                         }
  1296                     extension->iDragged = ETrue; // after this time, iLastDragged has value.
  1284                     extension->iDragged = ETrue; // after this time, iLastDragged has value.
  1297                     extension->iLastDrag = now;
  1285                     extension->iLastDrag = now;
  1298                     
  1286 
  1299                     thumbPositionPix = position - extension->iPointerOffsetFromThumb;
  1287                     thumbPositionPix = position - extension->iPointerOffsetFromThumb;
  1300                     TInt oldPosition = thumbPosition;
  1288                     TInt oldPosition = thumbPosition;
  1301                     TReal newPosition = thumbPositionPix * ( scrollSpan - thumbSpan ) / (TReal)scrollSpanPix;
  1289                     TReal newPosition = thumbPositionPix * ( scrollSpan - thumbSpan ) / (TReal)scrollSpanPix;
  1302                     thumbPosition = newPosition;
  1290                     thumbPosition = newPosition;
  1303 
  1291 
  1311                     thumbPosition = Max(0, thumbPosition);
  1299                     thumbPosition = Max(0, thumbPosition);
  1312                     thumbPosition = Min((scrollSpan - thumbSpan), thumbPosition);
  1300                     thumbPosition = Min((scrollSpan - thumbSpan), thumbPosition);
  1313 
  1301 
  1314                     if(thumbPosition != oldPosition)
  1302                     if(thumbPosition != oldPosition)
  1315                         {
  1303                         {
  1316                         // Smooth continuous tactile feedback is produced
       
  1317                         // during thumb dragging. The tactile feedback API 
       
  1318                         // filters out possible re-startings of the effect.
       
  1319                         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1320 
       
  1321                         if ( feedback )
       
  1322                             {
       
  1323                             TTimeIntervalMicroSeconds32 timeout( 300000 );
       
  1324                             feedback->StartFeedback( this, 
       
  1325                                                      ETouchContinuousSlider, 
       
  1326                                                      &aPointerEvent, 
       
  1327                                                      KIntensity, // intensity 100%
       
  1328                                                      timeout );
       
  1329                             }
       
  1330                         extension->SetModelThumbPosition(thumbPosition);
  1304                         extension->SetModelThumbPosition(thumbPosition);
  1331                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1305                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1332 
  1306 
  1333                         if(indicator->DrawBackgroundState())
  1307                         if(indicator->DrawBackgroundState())
  1334                             indicator->DrawNow();
  1308                             indicator->DrawNow();
  1344                         }
  1318                         }
  1345                     // Show popup info
  1319                     // Show popup info
  1346                     if ( extension->iShowPopup && extension->iPopupController )
  1320                     if ( extension->iShowPopup && extension->iPopupController )
  1347                         {
  1321                         {
  1348                         TPoint infoPoint = PositionRelativeToScreen();
  1322                         TPoint infoPoint = PositionRelativeToScreen();
  1349 
  1323                         
  1350                         if ( iOrientation == EVertical )
  1324                         if ( iOrientation == EVertical )
  1351                             {
  1325                             {
  1352                             if ( AknLayoutUtils::LayoutMirrored() )
  1326                             if ( AknLayoutUtils::LayoutMirrored() )
       
  1327                             	{
       
  1328 								TRect mainPaneRect( 0, 0, 0, 0 );    
       
  1329                                 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
       
  1330                                                 mainPaneRect );
       
  1331                                 TInt mainPaneWidth = mainPaneRect.Width();
       
  1332                                 infoPoint.iX += ( mainPaneWidth - infoPoint.iX + Rect().Width() ) / 2 ;
       
  1333                                 infoPoint.iY += aPointerEvent.iPosition.iY;
       
  1334                                 extension->iPopupController->SetPositionAndAlignment (
       
  1335                                     infoPoint, EHRightVCenter );
       
  1336                                 }
       
  1337                             else
  1353                                 {
  1338                                 {
  1354                                 infoPoint.iX += Rect().Width();
  1339                                 infoPoint.iX = infoPoint.iX / 2;
  1355                                 infoPoint.iY += aPointerEvent.iPosition.iY;
  1340                                 infoPoint.iY += aPointerEvent.iPosition.iY;
  1356                                 extension->iPopupController->SetPositionAndAlignment (
  1341                                 extension->iPopupController->SetPositionAndAlignment (
  1357                                     infoPoint, EHLeftVCenter );
  1342                                     infoPoint, EHLeftVCenter );
  1358                                 }
  1343                                 }
  1359                             else
       
  1360                                 {
       
  1361                                 infoPoint.iY += aPointerEvent.iPosition.iY;
       
  1362                                 extension->iPopupController->SetPositionAndAlignment (
       
  1363                                     infoPoint, EHRightVCenter );
       
  1364                                 }
       
  1365                             }
  1344                             }
  1366                         else if ( iOrientation == EHorizontal )
  1345                         else if ( iOrientation == EHorizontal )
  1367                             {
  1346                             {
       
  1347                             //infoPoint.iY = infoPoint.iY / 2;
  1368                             infoPoint.iX += aPointerEvent.iPosition.iX;
  1348                             infoPoint.iX += aPointerEvent.iPosition.iX;
  1369                             extension->iPopupController->SetPositionAndAlignment(
  1349                             extension->iPopupController->SetPositionAndAlignment(
  1370                                 infoPoint, EHCenterVBottom );
  1350                                 infoPoint, EHCenterVBottom );
  1371                             }
  1351                             }
  1372                         extension->iPopupController->ShowInfoPopupNote();
  1352                         extension->iPopupController->ShowInfoPopupNote();
  1374                         }
  1354                         }
  1375                     }
  1355                     }
  1376                 break;
  1356                 break;
  1377 
  1357 
  1378             case CEikScrollBar::ENone:
  1358             case CEikScrollBar::ENone:
  1379                 {
       
  1380                 // Stop the continuous tactile feedback that may be playing
       
  1381                 // at the time due to possible previous thumb dragging.
       
  1382                 MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1383 
       
  1384                 if ( feedback )
       
  1385                     {
       
  1386                     feedback->StopFeedback( this );
       
  1387                     }
       
  1388                 }
       
  1389 
       
  1390                 if(lastPointerDownOn == CEikScrollBar::EThumb)
  1359                 if(lastPointerDownOn == CEikScrollBar::EThumb)
  1391                     {
  1360                     {
  1392                     if(extension->ScrollBarObserver())
  1361                     if(extension->ScrollBarObserver())
  1393                         {
  1362                         {
  1394                         extension->ScrollBarObserver()->HandleScrollEventL(
  1363                         extension->ScrollBarObserver()->HandleScrollEventL(
  1414                         //       button may be obsolete.
  1383                         //       button may be obsolete.
  1415                         // Sensitive feedback given for each "nudge"
  1384                         // Sensitive feedback given for each "nudge"
  1416                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1385                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1417                         if ( feedback )
  1386                         if ( feedback )
  1418                             {
  1387                             {
  1419                             feedback->InstantFeedback ( this, ETouchFeedbackBasicSlider, aPointerEvent );
  1388                             feedback->InstantFeedback ( this, ETouchFeedbackSlider, aPointerEvent );
  1420                             }
  1389                             }
  1421                         extension->SetModelThumbPosition(thumbPosition);
  1390                         extension->SetModelThumbPosition(thumbPosition);
  1422                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1391                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1423                         if(indicator->DrawBackgroundState())
  1392                         if(indicator->DrawBackgroundState())
  1424                             indicator->DrawNow();
  1393                             indicator->DrawNow();
  1457                         //       button may be obsolete.
  1426                         //       button may be obsolete.
  1458                         // Sensitive feedback given for each "nudge"
  1427                         // Sensitive feedback given for each "nudge"
  1459                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1428                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  1460                         if ( feedback )
  1429                         if ( feedback )
  1461                             {
  1430                             {
  1462                             feedback->InstantFeedback ( this, ETouchFeedbackBasicSlider, aPointerEvent );
  1431                             feedback->InstantFeedback ( this, ETouchFeedbackSlider, aPointerEvent );
  1463                             }
  1432                             }
  1464                         extension->SetModelThumbPosition(thumbPosition);
  1433                         extension->SetModelThumbPosition(thumbPosition);
  1465                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1434                         indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
  1466                         if(indicator->DrawBackgroundState())
  1435                         if(indicator->DrawBackgroundState())
  1467                             indicator->DrawNow();
  1436                             indicator->DrawNow();
  1597 //
  1566 //
  1598 void CAknDoubleSpanScrollBar::ResetPressedDownHighlight()
  1567 void CAknDoubleSpanScrollBar::ResetPressedDownHighlight()
  1599     {
  1568     {
  1600     CAknDoubleSpanScrollBarExtension* extension =
  1569     CAknDoubleSpanScrollBarExtension* extension =
  1601         static_cast<CAknDoubleSpanScrollBarExtension*>( iExtension );
  1570         static_cast<CAknDoubleSpanScrollBarExtension*>( iExtension );
  1602         
  1571 
  1603     CAknDoubleSpanScrollIndicator* indicator = extension->iScrollIndicator;
  1572     CAknDoubleSpanScrollIndicator* indicator = extension->iScrollIndicator;
  1604     
  1573 
  1605     indicator->SetHandleHighlight( EFalse );
  1574     indicator->SetHandleHighlight( EFalse );
  1606     }
  1575     }
  1607 
  1576 
  1608 
  1577 
  1609 //
  1578 //
  1734 TInt CAknDoubleSpanScrollBarExtension::ScrollBarType()
  1703 TInt CAknDoubleSpanScrollBarExtension::ScrollBarType()
  1735     {
  1704     {
  1736     return CEikScrollBarFrame::EDoubleSpan;
  1705     return CEikScrollBarFrame::EDoubleSpan;
  1737     }
  1706     }
  1738 
  1707 
  1739 void CAknDoubleSpanScrollBarExtension::CreateButtonL(CAknScrollButton*& /*aButton*/,CAknScrollButton::TType /*aType*/)
       
  1740     {
       
  1741     }
       
  1742 
  1708 
  1743 void CAknDoubleSpanScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
  1709 void CAknDoubleSpanScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
  1744     {
  1710     {
  1745     iParent->iModel=(*aModel);
  1711     iParent->iModel=(*aModel);
  1746     if (iScrollIndicator)
  1712     if (iScrollIndicator)
  1768                 aModel->iThumbSpan,
  1734                 aModel->iThumbSpan,
  1769                 0,
  1735                 0,
  1770                 0);
  1736                 0);
  1771             }
  1737             }
  1772 
  1738 
  1773         if (iParent->OwnsWindow() && iScrollIndicator->TransparentBackground())
       
  1774             {
       
  1775             iParent->Window().HandleTransparencyUpdate();
       
  1776             }
       
  1777         if(iScrollIndicator->IsVisible())
  1739         if(iScrollIndicator->IsVisible())
  1778             {
  1740             {
  1779             if(iScrollIndicator->DrawBackgroundState() && !iParent->OwnsWindow())
  1741             if(iScrollIndicator->DrawBackgroundState() && !iParent->OwnsWindow())
  1780                 {
  1742                 {
  1781                 if(HasModelChanged(aModel))
  1743                 if(HasModelChanged(aModel))
  1787                         iActiveScheduledDraw->Start(TCallBack(ScheduledDraw,this));
  1749                         iActiveScheduledDraw->Start(TCallBack(ScheduledDraw,this));
  1788                     }
  1750                     }
  1789                 }
  1751                 }
  1790             else
  1752             else
  1791                 {
  1753                 {
  1792                 iParent->DrawDeferred();                 
  1754                 iParent->DrawDeferred();
  1793                 }
  1755                 }
  1794 
  1756 
  1795             }
  1757             }
  1796         }
  1758         }
  1797     }
  1759     }
  1902         {
  1864         {
  1903         iScrollIndicator = CAknDoubleSpanScrollIndicator::NewL( iParent->iOrientation );
  1865         iScrollIndicator = CAknDoubleSpanScrollIndicator::NewL( iParent->iOrientation );
  1904         iScrollIndicator->SetContainerWindowL( *iParent );
  1866         iScrollIndicator->SetContainerWindowL( *iParent );
  1905         iScrollIndicator->SetRect( iParent->Rect() );
  1867         iScrollIndicator->SetRect( iParent->Rect() );
  1906         iScrollIndicator->SetComponentsToInheritVisibility(ETrue);
  1868         iScrollIndicator->SetComponentsToInheritVisibility(ETrue);
       
  1869         iScrollIndicator->SetAsWindowOwning( iParent->OwnsWindow() );
  1907         }
  1870         }
  1908 
  1871 
  1909     if ( AknLayoutUtils::PenEnabled() &&
  1872     if ( AknLayoutUtils::PenEnabled() &&
  1910         ( iScrollBarFlags & CEikScrollBar::EEnableNudgeButtons ) )
  1873         ( iScrollBarFlags & CEikScrollBar::EEnableNudgeButtons ) )
  1911         {
  1874         {
  2358     {
  2321     {
  2359     // Usage of hard-coded parent rectangle is acceptable since we're
  2322     // Usage of hard-coded parent rectangle is acceptable since we're
  2360     // interested in only about the ratio between scrollbar and extension.
  2323     // interested in only about the ratio between scrollbar and extension.
  2361     TAknLayoutRect layoutRect;
  2324     TAknLayoutRect layoutRect;
  2362     layoutRect.LayoutRect( TRect( 0, 0, 200, 200 ), AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine() );
  2325     layoutRect.LayoutRect( TRect( 0, 0, 200, 200 ), AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine() );
  2363     
  2326 
  2364     TRect parent( layoutRect.Rect() ); // parent of both extension and scrollbar
  2327     TRect parent( layoutRect.Rect() ); // parent of both extension and scrollbar
  2365     
  2328 
  2366     layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::scroll_pane( 0 ).LayoutLine() );
  2329     layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::scroll_pane( 0 ).LayoutLine() );
  2367     
  2330 
  2368     TRect scrollbar( layoutRect.Rect() );
  2331     TRect scrollbar( layoutRect.Rect() );
  2369     
  2332 
  2370     CAknDoubleSpanScrollBarExtension* extension1 = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
  2333     CAknDoubleSpanScrollBarExtension* extension1 = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
  2371     if( extension1->iExtensionType & ENormalExpandedTouchArea )
  2334     if( extension1->iExtensionType & ENormalExpandedTouchArea )
  2372         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar( 0 ).LayoutLine() );
  2335         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar( 0 ).LayoutLine() );
  2373     else if( extension1->iExtensionType & EScaleExpandedTouchArea )
  2336     else if( extension1->iExtensionType & EScaleExpandedTouchArea )
  2374         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar_cale( 0 ).LayoutLine() );
  2337         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar_cale( 0 ).LayoutLine() );
  2375     else
  2338     else
  2376         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar( 0 ).LayoutLine() );
  2339         layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar( 0 ).LayoutLine() );
  2377     TRect extension( layoutRect.Rect() );
  2340     TRect extension( layoutRect.Rect() );
  2378 
  2341 
  2379     TRect area;
  2342     TRect area;
  2380     
  2343 
       
  2344     if ( iParentControl )
       
  2345         {
       
  2346         CCoeControl* windowOwningParent = iParentControl;
       
  2347         while ( windowOwningParent && !windowOwningParent->OwnsWindow() )
       
  2348             {
       
  2349             windowOwningParent = windowOwningParent->Parent();
       
  2350             }
       
  2351 
       
  2352         if ( windowOwningParent )
       
  2353             {
       
  2354             TInt xGap = 0;
       
  2355             TRect scrollBarRect = Rect();
       
  2356             TRect parentRect = windowOwningParent->Rect();
       
  2357 
       
  2358             if ( OwnsWindow() )
       
  2359                 {
       
  2360                 scrollBarRect.Move( Position().iX -
       
  2361                     windowOwningParent->Position().iX, 0 );
       
  2362                 }
       
  2363             if ( iOrientation == CEikScrollBar::EVertical )
       
  2364                 {
       
  2365                 // left to right layout in use
       
  2366                 if ( !AknLayoutUtils::LayoutMirrored() )
       
  2367                     {
       
  2368                     xGap = parentRect.iBr.iX - scrollBarRect.iBr.iX;
       
  2369                     if ( Abs( xGap ) < scrollBarRect.Width() )
       
  2370                         {
       
  2371                         extension.iBr.iX += xGap;
       
  2372                         }
       
  2373                     }
       
  2374                 // right to left layout in use
       
  2375                 else
       
  2376                     {
       
  2377                     xGap = parentRect.iTl.iX - scrollBarRect.iTl.iX;
       
  2378                     if ( Abs( xGap ) < scrollBarRect.Width() )
       
  2379                         {
       
  2380                         extension.iTl.iX += xGap;
       
  2381                         }
       
  2382                     }
       
  2383                 }
       
  2384             else
       
  2385                 {
       
  2386                 xGap = parentRect.iBr.iY - scrollBarRect.iBr.iY;
       
  2387                 if ( Abs( xGap ) < scrollBarRect.Height() )
       
  2388                     {
       
  2389                     extension.iBr.iY += xGap;
       
  2390                     }
       
  2391                 }
       
  2392             }
       
  2393         }
       
  2394 
  2381     if ( iOrientation == CEikScrollBar::EVertical )
  2395     if ( iOrientation == CEikScrollBar::EVertical )
  2382         {
  2396         {
  2383         area.iTl.iX = extension.iTl.iX - scrollbar.iTl.iX;
  2397         area.iTl.iX = extension.iTl.iX - scrollbar.iTl.iX;
  2384         area.iTl.iY = scrollbar.iTl.iY - extension.iTl.iY;
  2398         area.iTl.iY = scrollbar.iTl.iY - extension.iTl.iY;
  2385         area.iBr.iX = area.iTl.iX + extension.Width();
  2399         area.iBr.iX = area.iTl.iX + extension.Width();
  2390         area.iTl.iX = scrollbar.iTl.iY - extension.iTl.iY;
  2404         area.iTl.iX = scrollbar.iTl.iY - extension.iTl.iY;
  2391         area.iTl.iY = scrollbar.Width() - extension.Width();
  2405         area.iTl.iY = scrollbar.Width() - extension.Width();
  2392         area.iBr.iX = iSize.iWidth + ( extension.Height() - scrollbar.Height() );
  2406         area.iBr.iX = iSize.iWidth + ( extension.Height() - scrollbar.Height() );
  2393         area.iBr.iY = area.iTl.iY + extension.Width();
  2407         area.iBr.iY = area.iTl.iY + extension.Width();
  2394         }
  2408         }
  2395     
  2409 
  2396     return area;
  2410     return area;
  2397     }
  2411     }
  2398 
  2412