--- a/uifw/EikStd/coctlsrc/EIKSCRLB.CPP Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/EikStd/coctlsrc/EIKSCRLB.CPP Tue Aug 31 15:28:30 2010 +0300
@@ -41,6 +41,8 @@
#include "eikscrlb.h"
#include "EIKSBEXT.H"
+const TInt KIntensity = 100; // 100%
+
const TInt KScrollBarWidth=9;
// const TInt KScrollButtonHeight=10;
// const TInt KArrowHeadScrollBarLength=20;
@@ -513,6 +515,9 @@
return CEikScrollBar::EArrowHead;
}
+void CEikScrollBarExtension::CreateButtonL(CAknScrollButton*& /*aButton*/,CAknScrollButton::TType /*aType*/)
+ {
+ }
void CEikScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
{
@@ -669,13 +674,13 @@
if ( iAvkonAppUiBase )
{
CAknPointerEventModifier* modifier = iAvkonAppUiBase->PointerEventModifier();
-
+
if ( modifier )
{
modifier->Pop( *this );
}
}
-
+
AknsUtils::DeregisterControlPosition( this );
}
@@ -701,9 +706,14 @@
if (aWindowOwning)
{
CreateWindowL(aParent);
- EnableWindowTransparency();
- Window().SetPointerGrab( ETrue );
- EnableDragEvents();
+ if ( CAknEnv::Static()->TransparencyEnabled() )
+ {
+ Window().SetRequiredDisplayMode( EColor16MA );
+ if ( Window().SetTransparencyAlphaChannel() == KErrNone )
+ {
+ Window().SetBackgroundColor( ~0 );
+ }
+ }
}
else if(aParent)
{
@@ -722,6 +732,18 @@
iOrientation=aOrientation;
CreateRequiredComponentsL();
+ if (aWindowOwning)
+ {
+ Window().SetPointerGrab(ETrue);
+ EnableDragEvents();
+ if (extension->iScrollIndicator)
+ extension->iScrollIndicator->SetAsWindowOwning(ETrue);
+
+
+ // By default set background to transparent
+ SetTransparentBackground(ETrue);
+ }
+
SetComponentsToInheritVisibility(ETrue);
MakeVisible(EFalse);
ActivateL();
@@ -824,11 +846,11 @@
EXPORT_C void CAknDoubleSpanScrollBar::MakeVisible(TBool aVisible)
{
CAknPointerEventModifier* modifier = iAvkonAppUiBase ? iAvkonAppUiBase->PointerEventModifier() : NULL;
-
+
if ( modifier )
{
CAknDoubleSpanScrollBarExtension* extension = static_cast<CAknDoubleSpanScrollBarExtension*> (iExtension);
- if ( aVisible && (extension->iScrollIndicator->ScrollSpan() > 0) && !( extension->iExtensionType & ENoExpandedTouchArea ) )
+ if ( aVisible && (extension->iScrollIndicator->ScrollSpan() > 0) )
{
modifier->Push( *this, ExtensionArea() );
}
@@ -894,21 +916,10 @@
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() );
- }
- }
- else
+
+ if ( modifier && IsVisible() )
{
- if ( modifier && IsVisible() )
- {
- modifier->Update( *this, ExtensionArea() );
- }
+ modifier->Update( *this, ExtensionArea() );
}
AknsUtils::RegisterControlPosition( this );
@@ -1043,48 +1054,33 @@
// 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();
-
- CCoeControl* parent = Parent();
- TBool feedbackEnabled = !IsDimmed() && IsVisible();
- if (parent && feedbackEnabled)
- {
- // check the same for the parent
- feedbackEnabled = !parent->IsDimmed() && parent->IsVisible();
- }
- if ( feedback && feedbackEnabled )
+
+ // touch release on thumb
+ TBool thumbPressed =
+ ( position < (thumbPositionPix + thumbSpanPix)
+ && position > thumbPositionPix );
+ if ( thumbPressed &&
+ aPointerEvent.iType == TPointerEvent::EButton1Up &&
+ thumbSpan < scrollSpan )
{
- feedback->InstantFeedback( this,
- ETouchFeedbackSlider,
- ETouchFeedbackVibra,
- aPointerEvent );
- }
- }
-
- if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
- {
- extension->iPointerDownOn = CEikScrollBar::ENone;
+ MTouchFeedback* feedback = MTouchFeedback::Instance();
- // 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;
+ 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,
+ ETouchFeedbackBasicSlider,
+ ETouchFeedbackVibra,
+ aPointerEvent );
+ }
}
- }
+
// check that scroll bar is useful
if (thumbSpan < scrollSpan)
{
@@ -1094,7 +1090,7 @@
indicator->SetBackgroudHighlight( ETrue );
extension->iPointerDownPosition = position;
-
+
if(iButtons.iIncreaseNudge &&
iButtons.iIncreaseNudge->Rect().Contains(aPointerEvent.iPosition))
{
@@ -1124,6 +1120,22 @@
}
}
+ 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)
{
@@ -1142,7 +1154,7 @@
TInt prevPosValue = extension->ThumbPosition();
-
+
// This will update the thumb's pixel extent, used
// below
extension->SetModelThumbPosition(thumbPosition);
@@ -1162,7 +1174,7 @@
}
if ( feedback && feedbackEnabled )
{
- feedback->InstantFeedback( this, ETouchFeedbackSlider, aPointerEvent );
+ feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aPointerEvent );
}
}
@@ -1185,7 +1197,7 @@
// repeat until thumb reaches the stylus down position
pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
}
-
+
}
else
@@ -1212,7 +1224,7 @@
}
if ( feedback && feedbackEnabled )
{
- feedback->InstantFeedback( this, ETouchFeedbackSlider, aPointerEvent );
+ feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aPointerEvent );
}
}
@@ -1236,7 +1248,7 @@
pointerWindow->RequestPointerRepeatEvent(KScrollRepeatTimeout, ignoreRect);
}
-
+
}
if(indicator->DrawBackgroundState())
@@ -1260,30 +1272,30 @@
if ( feedback )
{
- TTouchFeedbackType fbType = TTouchFeedbackType(
+ TTouchFeedbackType fbType = TTouchFeedbackType(
ETouchFeedbackAudio |
ETouchFeedbackVibra );
-
- feedback->InstantFeedback( this, ETouchFeedbackSlider, fbType, aPointerEvent );
+
+ feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, 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;
@@ -1301,6 +1313,20 @@
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);
@@ -1320,31 +1346,25 @@
if ( extension->iShowPopup && extension->iPopupController )
{
TPoint infoPoint = PositionRelativeToScreen();
-
+
if ( iOrientation == EVertical )
{
if ( AknLayoutUtils::LayoutMirrored() )
- {
- TRect mainPaneRect( 0, 0, 0, 0 );
- AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
- mainPaneRect );
- TInt mainPaneWidth = mainPaneRect.Width();
- infoPoint.iX += ( mainPaneWidth - infoPoint.iX + Rect().Width() ) / 2 ;
+ {
+ infoPoint.iX += Rect().Width();
+ infoPoint.iY += aPointerEvent.iPosition.iY;
+ extension->iPopupController->SetPositionAndAlignment (
+ infoPoint, EHLeftVCenter );
+ }
+ else
+ {
infoPoint.iY += aPointerEvent.iPosition.iY;
extension->iPopupController->SetPositionAndAlignment (
infoPoint, EHRightVCenter );
}
- else
- {
- infoPoint.iX = infoPoint.iX / 2;
- infoPoint.iY += aPointerEvent.iPosition.iY;
- extension->iPopupController->SetPositionAndAlignment (
- infoPoint, EHLeftVCenter );
- }
}
else if ( iOrientation == EHorizontal )
{
- //infoPoint.iY = infoPoint.iY / 2;
infoPoint.iX += aPointerEvent.iPosition.iX;
extension->iPopupController->SetPositionAndAlignment(
infoPoint, EHCenterVBottom );
@@ -1356,6 +1376,17 @@
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())
@@ -1385,7 +1416,7 @@
MTouchFeedback* feedback = MTouchFeedback::Instance();
if ( feedback )
{
- feedback->InstantFeedback ( this, ETouchFeedbackSlider, aPointerEvent );
+ feedback->InstantFeedback ( this, ETouchFeedbackBasicSlider, aPointerEvent );
}
extension->SetModelThumbPosition(thumbPosition);
indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
@@ -1428,7 +1459,7 @@
MTouchFeedback* feedback = MTouchFeedback::Instance();
if ( feedback )
{
- feedback->InstantFeedback ( this, ETouchFeedbackSlider, aPointerEvent );
+ feedback->InstantFeedback ( this, ETouchFeedbackBasicSlider, aPointerEvent );
}
extension->SetModelThumbPosition(thumbPosition);
indicator->SetIndicatorValues(scrollSpan, thumbPosition, thumbSpan, 0, 0);
@@ -1568,9 +1599,9 @@
{
CAknDoubleSpanScrollBarExtension* extension =
static_cast<CAknDoubleSpanScrollBarExtension*>( iExtension );
-
+
CAknDoubleSpanScrollIndicator* indicator = extension->iScrollIndicator;
-
+
indicator->SetHandleHighlight( EFalse );
}
@@ -1705,6 +1736,9 @@
return CEikScrollBarFrame::EDoubleSpan;
}
+void CAknDoubleSpanScrollBarExtension::CreateButtonL(CAknScrollButton*& /*aButton*/,CAknScrollButton::TType /*aType*/)
+ {
+ }
void CAknDoubleSpanScrollBarExtension::DoSetModel(const TEikScrollBarModel* aModel)
{
@@ -1736,6 +1770,10 @@
0);
}
+ if (iParent->OwnsWindow() && iScrollIndicator->TransparentBackground())
+ {
+ iParent->Window().HandleTransparencyUpdate();
+ }
if(iScrollIndicator->IsVisible())
{
if(iScrollIndicator->DrawBackgroundState() && !iParent->OwnsWindow())
@@ -1751,7 +1789,7 @@
}
else
{
- iParent->DrawDeferred();
+ iParent->DrawDeferred();
}
}
@@ -1866,7 +1904,6 @@
iScrollIndicator->SetContainerWindowL( *iParent );
iScrollIndicator->SetRect( iParent->Rect() );
iScrollIndicator->SetComponentsToInheritVisibility(ETrue);
- iScrollIndicator->SetAsWindowOwning( iParent->OwnsWindow() );
}
if ( AknLayoutUtils::PenEnabled() &&
@@ -2323,13 +2360,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() );
@@ -2340,58 +2377,7 @@
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 parentRect = windowOwningParent->Rect();
-
- if ( OwnsWindow() )
- {
- 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;
- }
- }
- }
- else
- {
- 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;
@@ -2406,7 +2392,7 @@
area.iBr.iX = iSize.iWidth + ( extension.Height() - scrollbar.Height() );
area.iBr.iY = area.iTl.iY + extension.Width();
}
-
+
return area;
}