--- a/uifw/EikStd/coctlsrc/EIKSCRLB.CPP Tue May 11 16:27:42 2010 +0300
+++ b/uifw/EikStd/coctlsrc/EIKSCRLB.CPP Tue May 25 12:58:19 2010 +0300
@@ -41,8 +41,6 @@
#include "eikscrlb.h"
#include "EIKSBEXT.H"
-const TInt KIntensity = 100; // 100%
-
const TInt KScrollBarWidth=9;
// const TInt KScrollButtonHeight=10;
// const TInt KArrowHeadScrollBarLength=20;
@@ -671,13 +669,13 @@
if ( iAvkonAppUiBase )
{
CAknPointerEventModifier* modifier = iAvkonAppUiBase->PointerEventModifier();
-
+
if ( modifier )
{
modifier->Pop( *this );
}
}
-
+
AknsUtils::DeregisterControlPosition( this );
}
@@ -826,7 +824,7 @@
EXPORT_C void CAknDoubleSpanScrollBar::MakeVisible(TBool aVisible)
{
CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
-
+
if ( modifier )
{
CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
@@ -896,22 +894,22 @@
EXPORT_C void CAknDoubleSpanScrollBar::SizeChanged()
{
CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
-
+
if (iExtension)
{
- CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
- if ( modifier && IsVisible() && !( extension->iExtensionType & ENoExpandedTouchArea ) )
- {
- modifier->Update( *this, ExtensionArea() );
- }
+ CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
+ if ( modifier && IsVisible() && !( extension->iExtensionType & ENoExpandedTouchArea ) )
+ {
+ modifier->Update( *this, ExtensionArea() );
+ }
}
else
- {
- if ( modifier && IsVisible() )
- {
- modifier->Update( *this, ExtensionArea() );
- }
- }
+ {
+ if ( modifier && IsVisible() )
+ {
+ modifier->Update( *this, ExtensionArea() );
+ }
+ }
AknsUtils::RegisterControlPosition( this );
if (iExtension)
@@ -1045,33 +1043,48 @@
// The real span area available (as pixels)
scrollSpanPix -= thumbSpanPix;
-
- // touch release on thumb
- TBool thumbPressed =
- ( position < (thumbPositionPix + thumbSpanPix)
- && position > thumbPositionPix );
- if ( thumbPressed &&
- aPointerEvent.iType == TPointerEvent::EButton1Up &&
- thumbSpan < scrollSpan )
- {
- MTouchFeedback* feedback = MTouchFeedback::Instance();
+
+ // touch release on thumb
+ TBool thumbPressed =
+ ( position < (thumbPositionPix + thumbSpanPix)
+ && position > thumbPositionPix );
+ if ( thumbPressed &&
+ aPointerEvent.iType == TPointerEvent::EButton1Up &&
+ thumbSpan < scrollSpan )
+ {
+ MTouchFeedback* feedback = MTouchFeedback::Instance();
- CCoeControl* parent = Parent();
- TBool feedbackEnabled = !IsDimmed() && IsVisible();
- if (parent && feedbackEnabled)
- {
- // check the same for the parent
- feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
- }
- if ( feedback && feedbackEnabled )
- {
- feedback->InstantFeedback( this,
- ETouchFeedbackSlider,
- ETouchFeedbackVibra,
- aPointerEvent );
- }
+ CCoeControl* parent = Parent();
+ TBool feedbackEnabled = !IsDimmed() && IsVisible();
+ if (parent && feedbackEnabled)
+ {
+ // check the same for the parent
+ feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
+ }
+ if ( feedback && feedbackEnabled )
+ {
+ feedback->InstantFeedback( this,
+ ETouchFeedbackSlider,
+ ETouchFeedbackVibra,
+ aPointerEvent );
}
-
+ }
+
+ if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+ {
+ extension->iPointerDownOn = CEikScrollBar::ENone;
+
+ // Highlight off always when the pointer is lifted
+ indicator->SetHandleHighlight( EFalse );
+ indicator->DrawDeferred();
+ indicator->SetBackgroudHighlight( EFalse );
+
+ if ( extension->iPopupController )
+ {
+ extension->iPopupController->HideInfoPopupNote();
+ extension->iShowPopup = EFalse;
+ }
+ }
// check that scroll bar is useful
if (thumbSpan < scrollSpan)
{
@@ -1111,22 +1124,6 @@
}
}
- if (aPointerEvent.iType == TPointerEvent::EButton1Up)
- {
- extension->iPointerDownOn = CEikScrollBar::ENone;
-
- // Highlight off always when the pointer is lifted
- indicator->SetHandleHighlight( EFalse );
- indicator->DrawDeferred();
- indicator->SetBackgroudHighlight( EFalse );
-
- if ( extension->iPopupController )
- {
- extension->iPopupController->HideInfoPopupNote();
- extension->iShowPopup = EFalse;
- }
- }
-
// respond to the pointer event
switch(extension->iPointerDownOn)
{
@@ -1145,7 +1142,7 @@
TInt prevPosValue = extension->ThumbPosition();
-
+
// This will update the thumb's pixel extent, used
// below
extension->SetModelThumbPosition(thumbPosition);
@@ -1188,7 +1185,7 @@
// repeat until thumb reaches the stylus down position
pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
}
-
+
}
else
@@ -1239,7 +1236,7 @@
pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
}
-
+
}
if(indicator->DrawBackgroundState())
@@ -1263,30 +1260,30 @@
if ( feedback )
{
- TTouchFeedbackType fbType = TTouchFeedbackType(
+ TTouchFeedbackType fbType = TTouchFeedbackType(
ETouchFeedbackAudio |
ETouchFeedbackVibra );
-
+
feedback->InstantFeedback( this, ETouchFeedbackSlider, fbType, aPointerEvent );
}
}
- if( aPointerEvent.iType == TPointerEvent::EDrag
+ if( aPointerEvent.iType == TPointerEvent::EDrag
|| aPointerEvent.iType == TPointerEvent::EButtonRepeat )
{
- // performace improving. Too many drag event received, handling every single event
+ // performace improving. Too many drag event received, handling every single event
// will use too much CPU time.
TTime now;
- now.HomeTime();
+ now.HomeTime();
if ( extension->iDragged &&
- now.MicroSecondsFrom( extension->iLastDrag )
+ now.MicroSecondsFrom( extension->iLastDrag )
< KScrollDragTimeout )
- {
+ {
break; // ignore drag for this time
}
extension->iDragged = ETrue; // after this time, iLastDragged has value.
extension->iLastDrag = now;
-
+
thumbPositionPix = position - extension->iPointerOffsetFromThumb;
TInt oldPosition = thumbPosition;
TReal newPosition = thumbPositionPix * ( scrollSpan - thumbSpan ) / (TReal)scrollSpanPix;
@@ -1304,20 +1301,6 @@
if(thumbPosition != oldPosition)
{
- // Smooth continuous tactile feedback is produced
- // during thumb dragging. The tactile feedback API
- // filters out possible re-startings of the effect.
- MTouchFeedback* feedback = MTouchFeedback::Instance();
-
- if ( feedback )
- {
- TTimeIntervalMicroSeconds32 timeout( 300000 );
- feedback->StartFeedback( this,
- ETouchContinuousSlider,
- &aPointerEvent,
- KIntensity, // intensity 100%
- timeout );
- }
extension->SetModelThumbPosition(thumbPosition);
indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
@@ -1367,17 +1350,6 @@
break;
case CEikScrollBar::ENone:
- {
- // Stop the continuous tactile feedback that may be playing
- // at the time due to possible previous thumb dragging.
- MTouchFeedback* feedback = MTouchFeedback::Instance();
-
- if ( feedback )
- {
- feedback->StopFeedback( this );
- }
- }
-
if(lastPointerDownOn == CEikScrollBar::EThumb)
{
if(extension->ScrollBarObserver())
@@ -1590,9 +1562,9 @@
{
CAknDoubleSpanScrollBarExtension* extension =
static_cast<CAknDoubleSpanScrollBarExtension*>( iExtension );
-
+
CAknDoubleSpanScrollIndicator* indicator = extension->iScrollIndicator;
-
+
indicator->SetHandleHighlight( EFalse );
}
@@ -1773,7 +1745,7 @@
}
else
{
- iParent->DrawDeferred();
+ iParent->DrawDeferred();
}
}
@@ -2345,13 +2317,13 @@
// interested in only about the ratio between scrollbar and extension.
TAknLayoutRect layoutRect;
layoutRect.LayoutRect( TRect( 0, 0, 200, 200 ), AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine() );
-
+
TRect parent( layoutRect.Rect() ); // parent of both extension and scrollbar
-
+
layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::scroll_pane( 0 ).LayoutLine() );
-
+
TRect scrollbar( layoutRect.Rect() );
-
+
CAknDoubleSpanScrollBarExtension* extension1 = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
if( extension1->iExtensionType & ENormalExpandedTouchArea )
layoutRect.LayoutRect( parent, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar( 0 ).LayoutLine() );
@@ -2362,58 +2334,58 @@
TRect extension( layoutRect.Rect() );
TRect area;
-
+
if ( iParentControl )
{
CCoeControl* windowOwningParent = iParentControl;
while ( windowOwningParent && !windowOwningParent->OwnsWindow() )
{
windowOwningParent = windowOwningParent->Parent();
- }
-
+ }
+
if ( windowOwningParent )
{
TInt xGap = 0;
- TRect scrollBarRect = Rect();
+ TRect scrollBarRect = Rect();
TRect parentRect = windowOwningParent->Rect();
-
- if ( OwnsWindow() )
+
+ if ( OwnsWindow() )
{
- scrollBarRect.Move( Position().iX -
+ scrollBarRect.Move( Position().iX -
windowOwningParent->Position().iX, 0 );
- }
+ }
if ( iOrientation == CEikScrollBar::EVertical )
- {
- // left to right layout in use
- if ( !AknLayoutUtils::LayoutMirrored() )
- {
- xGap = parentRect.iBr.iX - scrollBarRect.iBr.iX;
- if ( Abs( xGap ) < scrollBarRect.Width() )
- {
- extension.iBr.iX += xGap;
- }
- }
- // right to left layout in use
- else
- {
- xGap = parentRect.iTl.iX - scrollBarRect.iTl.iX;
- if ( Abs( xGap ) < scrollBarRect.Width() )
- {
- extension.iTl.iX += xGap;
- }
- }
- }
+ {
+ // left to right layout in use
+ if ( !AknLayoutUtils::LayoutMirrored() )
+ {
+ xGap = parentRect.iBr.iX - scrollBarRect.iBr.iX;
+ if ( Abs( xGap ) < scrollBarRect.Width() )
+ {
+ extension.iBr.iX += xGap;
+ }
+ }
+ // right to left layout in use
+ else
+ {
+ xGap = parentRect.iTl.iX - scrollBarRect.iTl.iX;
+ if ( Abs( xGap ) < scrollBarRect.Width() )
+ {
+ extension.iTl.iX += xGap;
+ }
+ }
+ }
else
- {
- xGap = parentRect.iBr.iY - scrollBarRect.iBr.iY;
- if ( Abs( xGap ) < scrollBarRect.Height() )
- {
- extension.iBr.iY += xGap;
- }
- }
+ {
+ xGap = parentRect.iBr.iY - scrollBarRect.iBr.iY;
+ if ( Abs( xGap ) < scrollBarRect.Height() )
+ {
+ extension.iBr.iY += xGap;
+ }
+ }
}
- }
-
+ }
+
if ( iOrientation == CEikScrollBar::EVertical )
{
area.iTl.iX = extension.iTl.iX - scrollbar.iTl.iX;
@@ -2426,9 +2398,9 @@
area.iTl.iX = scrollbar.iTl.iY - extension.iTl.iY;
area.iTl.iY = scrollbar.Width() - extension.Width();
area.iBr.iX = iSize.iWidth + ( extension.Height() - scrollbar.Height() );
- area.iBr.iY = area.iTl.iY + extension.Height();
+ area.iBr.iY = area.iTl.iY + extension.Width();
}
-
+
return area;
}