uifw/ganes/src/HgScrollbar.cpp
changeset 0 2f259fa3e83a
child 3 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:     
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "HgScrollbar.h"
       
    20 #include <ganes/HgScrollbarObserverIface.h>
       
    21 #include "HgConstants.h"
       
    22 
       
    23 #include <AknsUtils.h>
       
    24 #include <AknUtils.h>
       
    25 #include <AknsDrawUtils.h>
       
    26 
       
    27 #include <layoutmetadata.cdl.h>
       
    28 #include <aknlayoutscalable_avkon.cdl.h>
       
    29 #include <aknlayoutscalable_apps.cdl.h>
       
    30 
       
    31 #include <bitstd.h>
       
    32 #include <gulicon.h>
       
    33 
       
    34 #include <AknIconUtils.h>
       
    35 #include <AknsUtils.h>
       
    36 #include <AknsConstants.h>
       
    37 #include <w32std.h>
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CHgScrollbar::NewL()
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CHgScrollbar* CHgScrollbar::NewL( MHgScrollbarObserver& aObserver )
       
    44     {
       
    45     CHgScrollbar* self = new (ELeave) CHgScrollbar( aObserver );
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CHgScrollbar::~CHgScrollbar()
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CHgScrollbar::~CHgScrollbar()
       
    57     {
       
    58     delete iScrollbarBg;
       
    59     delete iScrollbarHandle;
       
    60     delete iScrollbarHandleBg;
       
    61     delete iScrollbarBgSelected;
       
    62     delete iScrollbarHandleSelected;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CHgScrollbar::CHgScrollbar()
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CHgScrollbar::CHgScrollbar( MHgScrollbarObserver& aObserver )
       
    70     : iObserver( aObserver )
       
    71     {
       
    72     
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CHgScrollbar::ConstructL()
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CHgScrollbar::ConstructL()
       
    80     {
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CHgScrollbar::SetScrollbarL()
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void CHgScrollbar::InitScrollBarL(
       
    88         TRect aRect,
       
    89         TSize aTotalSize,
       
    90         TSize aViewSize,
       
    91         TBool aLandscapeScrolling )
       
    92     {
       
    93     if( iTotalSize == aTotalSize 
       
    94             && iViewSize == aViewSize 
       
    95             && iLandscapeScrolling == aLandscapeScrolling )
       
    96         {
       
    97         return;
       
    98         }
       
    99     
       
   100     TInt variety = aLandscapeScrolling ? 1 : 0;
       
   101     
       
   102     TAknLayoutRect layout;
       
   103     layout.LayoutRect(aRect, AknLayoutScalable_Avkon::scroll_pane( variety ));
       
   104     iScrollbarRect = layout.Rect();
       
   105     
       
   106     if((aTotalSize.iHeight <= aViewSize.iHeight && !aLandscapeScrolling)
       
   107             || (aTotalSize.iWidth <= aViewSize.iWidth && aLandscapeScrolling) )
       
   108         {
       
   109         iTotalSize = aViewSize;
       
   110         iStatic = ETrue;
       
   111         }
       
   112     else
       
   113         {
       
   114         iTotalSize = aTotalSize;
       
   115         iStatic = EFalse;
       
   116         }
       
   117 
       
   118     TBool viewChanged = iViewSize != aViewSize;
       
   119     
       
   120     iViewSize = aViewSize;
       
   121     iLandscapeScrolling = aLandscapeScrolling;
       
   122     iHandlePosition.SetXY(0,0);
       
   123 
       
   124     if(iLandscapeScrolling)
       
   125         {
       
   126         iTotalLength = iTotalSize.iWidth - iViewSize.iWidth;
       
   127         }
       
   128     else
       
   129         {
       
   130         iTotalLength = iTotalSize.iHeight - iViewSize.iHeight;
       
   131         }
       
   132 
       
   133     InitIconsL( viewChanged );    
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CHgScrollbar::SetViewPosition()
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void CHgScrollbar::SetViewPosition( TPoint aPosition )
       
   141     {
       
   142     if(!iStatic)
       
   143         {
       
   144         if(iLandscapeScrolling)
       
   145             {
       
   146             if (AknLayoutUtils::LayoutMirrored())
       
   147                 {
       
   148                 iHandlePosition.iX = (iScrollLength) * (1.0 - aPosition.iX / TReal(iTotalLength));
       
   149                 }
       
   150             else
       
   151                 {
       
   152                 iHandlePosition.iX = (iScrollLength) * (aPosition.iX / TReal(iTotalLength));            
       
   153                 }
       
   154             }
       
   155         else
       
   156             {
       
   157             iHandlePosition.iY = (iScrollLength) * (aPosition.iY / TReal(iTotalLength));
       
   158             }
       
   159         CheckHandlePosition( EFalse );
       
   160         }
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CHgScrollbar::HandlePointerEventL()
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 TBool CHgScrollbar::HandlePointerEventL( const TPointerEvent& aEvent )
       
   168     {
       
   169     return HandleScrollBarPointerEvent( aEvent );
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CHgScrollbar::HandleScrollBarPointerEvent()
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 TBool CHgScrollbar::HandleScrollBarPointerEvent( const TPointerEvent& aEvent )
       
   177     {
       
   178     TBool ret = EFalse;
       
   179     // Quick and dirty hack, remove when logic for fetching the correct drag rect is available
       
   180     TRect dragArea( iScrollbarRect );
       
   181     dragArea.iBr.iX += KScrollAreaOffset; 
       
   182     dragArea.iTl.iX -= KScrollAreaOffset;
       
   183 
       
   184     // Start drag
       
   185     if( aEvent.iType == TPointerEvent::EButton1Down && dragArea.Contains(aEvent.iPosition))
       
   186         {
       
   187         TSize size(iHandleSize);
       
   188         size.iWidth += KScrollAreaOffset*2;
       
   189         TRect handleRect( dragArea.iTl + iHandlePosition, size );
       
   190         iDragging = handleRect.Contains( aEvent.iPosition );
       
   191         iPrevDrag = aEvent.iPosition;
       
   192         iHandler = ret = ETrue;
       
   193         CheckHandlePosition( !iStatic );
       
   194         }
       
   195 
       
   196     // Drag
       
   197     if( aEvent.iType == TPointerEvent::EDrag && iHandler)
       
   198         {
       
   199         if( iDragging )
       
   200             {
       
   201             if(iLandscapeScrolling)
       
   202                 {
       
   203                 iHandlePosition.iX -= iPrevDrag.iX - aEvent.iPosition.iX;
       
   204                 }
       
   205             else
       
   206                 {
       
   207                 iHandlePosition.iY -= iPrevDrag.iY - aEvent.iPosition.iY;
       
   208                 }
       
   209             CheckHandlePosition( !iStatic );
       
   210             
       
   211             iPrevDrag = aEvent.iPosition;
       
   212             }
       
   213         ret = ETrue;
       
   214         }
       
   215 
       
   216     // End drag
       
   217     if( aEvent.iType == TPointerEvent::EButton1Up && iHandler)
       
   218         {
       
   219         if(!iDragging)
       
   220             {
       
   221             TBool below = iLandscapeScrolling ? 
       
   222                     aEvent.iPosition.iX > iHandlePosition.iX 
       
   223                     : aEvent.iPosition.iY > iHandlePosition.iY;
       
   224             iHandlePosition += below ? iHandleSize.AsPoint() : -iHandleSize.AsPoint();
       
   225             }
       
   226         CheckHandlePosition( !iStatic );
       
   227         iHandler = iDragging = EFalse; 
       
   228         ret = ETrue;
       
   229         }
       
   230 
       
   231     return ret;    
       
   232     }
       
   233 
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CHgScrollbar::Draw()
       
   237 // -----------------------------------------------------------------------------
       
   238 //
       
   239 void CHgScrollbar::Draw( CWindowGc& aGc )
       
   240     {
       
   241     DrawScrollbar( aGc );
       
   242     }
       
   243 
       
   244 // -----------------------------------------------------------------------------
       
   245 // CHgScrollbar::DrawScrollbar()
       
   246 // -----------------------------------------------------------------------------
       
   247 //
       
   248 void CHgScrollbar::DrawScrollbar( CWindowGc& aGc )
       
   249     {
       
   250     if(iScrollbarBg && iScrollbarHandle && iScrollbarHandleBg)
       
   251         {
       
   252         if(iHandler && !iStatic)
       
   253             {
       
   254             aGc.BitBltMasked(iScrollbarRect.iTl, 
       
   255                     iScrollbarHandleBg->Bitmap(),
       
   256                     iScrollbarHandleBg->Bitmap()->SizeInPixels(),
       
   257                     iScrollbarHandleBg->Mask(),
       
   258                     EFalse);
       
   259             
       
   260             aGc.BitBltMasked(iScrollbarRect.iTl + iHandlePosition, 
       
   261                     iScrollbarHandleSelected->Bitmap(),
       
   262                     iScrollbarHandleSelected->Bitmap()->SizeInPixels(),
       
   263                     iScrollbarHandleSelected->Mask(),
       
   264                     EFalse);
       
   265             }
       
   266         else
       
   267             {
       
   268             aGc.BitBltMasked(iScrollbarRect.iTl, 
       
   269                     iScrollbarBg->Bitmap(),
       
   270                     iScrollbarBg->Bitmap()->SizeInPixels(),
       
   271                     iScrollbarBg->Mask(),
       
   272                     EFalse);
       
   273             
       
   274             aGc.BitBltMasked(iScrollbarRect.iTl + iHandlePosition, 
       
   275                     iScrollbarHandle->Bitmap(),
       
   276                     iScrollbarHandle->Bitmap()->SizeInPixels(),
       
   277                     iScrollbarHandle->Mask(),
       
   278                     EFalse);
       
   279             }
       
   280         }
       
   281     }
       
   282 
       
   283 // -----------------------------------------------------------------------------
       
   284 // CHgScrollbar::CheckHandlePosition()
       
   285 // -----------------------------------------------------------------------------
       
   286 //
       
   287 void CHgScrollbar::CheckHandlePosition( TBool aReportChange )
       
   288     {
       
   289 
       
   290     if(iLandscapeScrolling)
       
   291         {
       
   292         iHandlePosition.iY = 0;
       
   293         if(iHandlePosition.iX < 0 )
       
   294             iHandlePosition.iX = 0;
       
   295         if(iHandlePosition.iX > iScrollLength)
       
   296             iHandlePosition.iX = iScrollLength;
       
   297         }
       
   298     else
       
   299         {
       
   300         iHandlePosition.iX = 0;
       
   301         if(iHandlePosition.iY < 0 )
       
   302             iHandlePosition.iY = 0;
       
   303         if(iHandlePosition.iY > iScrollLength)
       
   304             iHandlePosition.iY = iScrollLength;
       
   305         }
       
   306     if( aReportChange )
       
   307         {
       
   308         TPoint pos (iViewSize.iWidth/2, iViewSize.iHeight/2);
       
   309         if(iLandscapeScrolling)
       
   310             {
       
   311             if (AknLayoutUtils::LayoutMirrored())
       
   312                 {
       
   313                 pos.iX += (1.0 - iHandlePosition.iX / TReal(iScrollLength)) * (iTotalLength);
       
   314                 }
       
   315             else
       
   316                 {
       
   317                 pos.iX += (iHandlePosition.iX / TReal(iScrollLength)) * (iTotalLength);            
       
   318                 }
       
   319             }
       
   320         else
       
   321             {
       
   322             pos.iY += (iHandlePosition.iY / TReal(iScrollLength)) * (iTotalLength);
       
   323             }
       
   324         
       
   325         iObserver.ScrollBarPositionChanged( pos );
       
   326         }
       
   327     }
       
   328 
       
   329 // -----------------------------------------------------------------------------
       
   330 // CHgScrollbar::InitIconsL()
       
   331 // -----------------------------------------------------------------------------
       
   332 //
       
   333 void CHgScrollbar::InitIconsL( TBool aInitBgIcons )
       
   334     {
       
   335     if(aInitBgIcons)
       
   336         {
       
   337         delete iScrollbarBg; iScrollbarBg = NULL;
       
   338         delete iScrollbarBgSelected; iScrollbarBgSelected = NULL;
       
   339         delete iScrollbarHandleBg; iScrollbarHandleBg = NULL;
       
   340     
       
   341         CreateIconL(iScrollbarBg, iScrollbarRect.Size());
       
   342         CreateIconL(iScrollbarBgSelected, iScrollbarRect.Size());
       
   343         CreateIconL(iScrollbarHandleBg, iScrollbarRect.Size());
       
   344         }
       
   345     
       
   346     TReal xFactor = iScrollbarRect.Width()/TReal(iTotalSize.iWidth);
       
   347     TReal yFactor = iScrollbarRect.Height()/TReal(iTotalSize.iHeight); 
       
   348     
       
   349     iHandleSize = TSize ( iViewSize.iWidth * xFactor, iViewSize.iHeight * yFactor );
       
   350 
       
   351     if(iLandscapeScrolling)
       
   352         {
       
   353         TInt min = 2*iHandleSize.iHeight;
       
   354         if( iHandleSize.iWidth < min )
       
   355             {
       
   356             iHandleSize.iWidth = min;
       
   357             }
       
   358         iScrollLength = iScrollbarRect.Width() - iHandleSize.iWidth;
       
   359         }
       
   360     else
       
   361         {
       
   362         TInt min = 2*iHandleSize.iWidth;
       
   363         if( iHandleSize.iHeight < min )
       
   364             {
       
   365             iHandleSize.iHeight = min;
       
   366             }
       
   367         iScrollLength = iScrollbarRect.Height() - iHandleSize.iHeight;
       
   368         }
       
   369     
       
   370     delete iScrollbarHandle; iScrollbarHandle = NULL;
       
   371     delete iScrollbarHandleSelected; iScrollbarHandleSelected = NULL;
       
   372 
       
   373     CreateIconL(iScrollbarHandle, iHandleSize );
       
   374     CreateIconL(iScrollbarHandleSelected, iHandleSize );
       
   375     
       
   376     if( iLandscapeScrolling )
       
   377         {
       
   378         if( aInitBgIcons )
       
   379             {
       
   380             DrawIconL( *iScrollbarBg, 
       
   381                     KAknsIIDQsnCpScrollHorizontalBgTop, 
       
   382                     KAknsIIDQsnCpScrollHorizontalBgMiddle, 
       
   383                     KAknsIIDQsnCpScrollHorizontalBgBottom );
       
   384     
       
   385             // TODO, check if this is needed.
       
   386     //        DrawIconL( *iScrollbarHandleBg, 
       
   387     //                KAknsIIDQsnCpScrollHorizontalHandleBgTop, 
       
   388     //                KAknsIIDQsnCpScrollHorizontalHandleBgMiddle, 
       
   389     //                KAknsIIDQsnCpScrollHorizontalHandleBgBottom );
       
   390             
       
   391             DrawIconL( *iScrollbarBgSelected, 
       
   392                     KAknsIIDQsnCpScrollHorizontalBgTopPressed, 
       
   393                     KAknsIIDQsnCpScrollHorizontalBgMiddlePressed, 
       
   394                     KAknsIIDQsnCpScrollHorizontalBgBottomPressed );
       
   395             }
       
   396         
       
   397         DrawIconL( *iScrollbarHandle, 
       
   398                 KAknsIIDQsnCpScrollHorizontalHandleTop, 
       
   399                 KAknsIIDQsnCpScrollHorizontalHandleMiddle, 
       
   400                 KAknsIIDQsnCpScrollHorizontalHandleBottom);
       
   401 
       
   402         DrawIconL( *iScrollbarHandleSelected, 
       
   403                 KAknsIIDQsnCpScrollHorizontalHandleTopPressed, 
       
   404                 KAknsIIDQsnCpScrollHorizontalHandleMiddlePressed, 
       
   405                 KAknsIIDQsnCpScrollHorizontalHandleBottomPressed );        
       
   406         }
       
   407     else
       
   408         {
       
   409         if(aInitBgIcons)
       
   410             {
       
   411             DrawIconL( *iScrollbarBg, 
       
   412                     KAknsIIDQsnCpScrollBgTop, 
       
   413                     KAknsIIDQsnCpScrollBgMiddle, 
       
   414                     KAknsIIDQsnCpScrollBgBottom );
       
   415             
       
   416             DrawIconL( *iScrollbarHandleBg, 
       
   417                     KAknsIIDQsnCpScrollHandleBgTop, 
       
   418                     KAknsIIDQsnCpScrollHandleBgMiddle, 
       
   419                     KAknsIIDQsnCpScrollHandleBgBottom );
       
   420             
       
   421             DrawIconL( *iScrollbarBgSelected, 
       
   422                     KAknsIIDQsnCpScrollBgTopPressed, 
       
   423                     KAknsIIDQsnCpScrollBgMiddlePressed, 
       
   424                     KAknsIIDQsnCpScrollBgBottomPressed );
       
   425             }
       
   426         
       
   427         DrawIconL( *iScrollbarHandle, 
       
   428                 KAknsIIDQsnCpScrollHandleTop, 
       
   429                 KAknsIIDQsnCpScrollHandleMiddle, 
       
   430                 KAknsIIDQsnCpScrollHandleBottom);
       
   431 
       
   432         DrawIconL( *iScrollbarHandleSelected, 
       
   433                 KAknsIIDQsnCpScrollHandleTopPressed, 
       
   434                 KAknsIIDQsnCpScrollHandleMiddlePressed, 
       
   435                 KAknsIIDQsnCpScrollHandleBottomPressed );        
       
   436         }
       
   437     }
       
   438 
       
   439 // -----------------------------------------------------------------------------
       
   440 // CHgScrollbar::CreateIconL()
       
   441 // -----------------------------------------------------------------------------
       
   442 //
       
   443 void CHgScrollbar::CreateIconL( CGulIcon*& aIcon, TSize aSize)
       
   444     {
       
   445     CFbsBitmap* bmap = new (ELeave) CFbsBitmap;
       
   446     CleanupStack::PushL( bmap );
       
   447     User::LeaveIfError( bmap->Create( aSize , EColor64K));
       
   448     
       
   449     CFbsBitmap* mask = new (ELeave) CFbsBitmap;
       
   450     CleanupStack::PushL( mask );
       
   451     User::LeaveIfError( mask->Create( aSize , EGray256));
       
   452     
       
   453     aIcon = CGulIcon::NewL( bmap, mask );
       
   454     
       
   455     CleanupStack::Pop(2, bmap);
       
   456     }
       
   457 
       
   458 // -----------------------------------------------------------------------------
       
   459 // CHgScrollbar::DrawIconL()
       
   460 // -----------------------------------------------------------------------------
       
   461 //
       
   462 void CHgScrollbar::DrawIconL( CGulIcon& aIcon,
       
   463         const TAknsItemID& aTop,
       
   464         const TAknsItemID& aMiddle,
       
   465         const TAknsItemID& aBottom )
       
   466     {
       
   467     TRect rect;
       
   468     TSize iconSize(aIcon.Bitmap()->SizeInPixels());
       
   469     TSize tSize;
       
   470     TPoint point(0,0);
       
   471     if(iLandscapeScrolling)
       
   472         {
       
   473         tSize.SetSize(iconSize.iHeight, iconSize.iHeight);
       
   474         }
       
   475     else
       
   476         {
       
   477         tSize.SetSize(iconSize.iWidth, iconSize.iWidth);
       
   478         }
       
   479     
       
   480     // TOP
       
   481     rect.SetRect(point, tSize);
       
   482     DrawBitmapL( aIcon, aTop, rect );
       
   483 
       
   484     // MIDDLE
       
   485     TSize middlesize(iconSize);
       
   486     if(iLandscapeScrolling)
       
   487         {
       
   488         point.iX = tSize.iWidth;
       
   489         middlesize.iWidth -= 2*tSize.iWidth;
       
   490         }
       
   491     else
       
   492         {
       
   493         point.iY = tSize.iHeight;
       
   494         middlesize.iHeight -= 2*tSize.iHeight;
       
   495         }
       
   496     rect.SetRect(point, middlesize);
       
   497     DrawBitmapL( aIcon, aMiddle, rect);
       
   498     
       
   499     // BOTTOM
       
   500     point = iconSize.AsPoint()-tSize;
       
   501     rect.SetRect(point, tSize);
       
   502     DrawBitmapL( aIcon, aBottom, rect );
       
   503     }
       
   504 
       
   505 // -----------------------------------------------------------------------------
       
   506 // CHgScrollbar::DrawBitmapL()
       
   507 // -----------------------------------------------------------------------------
       
   508 //
       
   509 void CHgScrollbar::DrawBitmapL( CGulIcon& aIcon,
       
   510         const TAknsItemID& aItem,
       
   511         const TRect& aDestRect )
       
   512     {
       
   513     CFbsBitmap* bitmap = NULL;
       
   514     CFbsBitmap* mask = NULL;
       
   515     TRAP_IGNORE( AknsUtils::CreateIconL(AknsUtils::SkinInstance(), aItem, bitmap, mask, KNullDesC, -1, -1); )
       
   516 
       
   517     if(!bitmap)
       
   518         {
       
   519         AknsUtils::CreateIconL(AknsUtils::SkinInstance(), aItem, bitmap, KNullDesC, -1);        
       
   520         }
       
   521     
       
   522     AknIconUtils::SetSize(bitmap, aDestRect.Size(), EAspectRatioNotPreserved);
       
   523     ScaleBitmapL(aDestRect, aIcon.Bitmap(), bitmap);
       
   524     
       
   525     if(mask)
       
   526         {
       
   527         AknIconUtils::SetSize(mask, aDestRect.Size(), EAspectRatioNotPreserved);
       
   528         ScaleBitmapL(aDestRect, aIcon.Mask(), mask);
       
   529         }
       
   530     
       
   531     delete bitmap; bitmap = NULL;
       
   532     delete mask; mask = NULL;
       
   533     }
       
   534 
       
   535 
       
   536 // -----------------------------------------------------------------------------
       
   537 // CHgScrollbar::ScaleBitmapL()
       
   538 // -----------------------------------------------------------------------------
       
   539 //
       
   540 void CHgScrollbar::ScaleBitmapL( const TRect& aDestRect,
       
   541         CFbsBitmap* aDest,
       
   542         const CFbsBitmap* aSrc)
       
   543     {
       
   544     CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(aDest);
       
   545     CleanupStack::PushL(device);
       
   546 
       
   547     CFbsBitGc* gc = NULL;
       
   548     User::LeaveIfError(device->CreateContext(gc));
       
   549     CleanupStack::PushL(gc);
       
   550     
       
   551     gc->DrawBitmap(aDestRect, aSrc);
       
   552     
       
   553     CleanupStack::PopAndDestroy(2, device);
       
   554     }
       
   555 
       
   556 // -----------------------------------------------------------------------------
       
   557 // CHgScrollbar::ScrollbarBg()
       
   558 // -----------------------------------------------------------------------------
       
   559 //
       
   560 const CGulIcon* CHgScrollbar::ScrollbarBg() const
       
   561     {
       
   562     return iScrollbarBg;
       
   563     }   
       
   564 
       
   565 
       
   566 const CGulIcon* CHgScrollbar::ScrollbarHandleBg() const
       
   567     {
       
   568     return iScrollbarHandleBg;
       
   569     }
       
   570 
       
   571 const CGulIcon* CHgScrollbar::ScrollbarHandle() const
       
   572     {
       
   573     return iScrollbarHandle;
       
   574     }
       
   575 
       
   576 const CGulIcon* CHgScrollbar::ScrollbarBgSelected() const
       
   577     {
       
   578     return iScrollbarBgSelected;
       
   579     }
       
   580 
       
   581 const CGulIcon* CHgScrollbar::ScrollbarHandleSelected() const
       
   582     {
       
   583     return iScrollbarHandleSelected;
       
   584     }
       
   585 
       
   586 const TRect& CHgScrollbar::ScrollbarRect() const
       
   587     {
       
   588     return iScrollbarRect;
       
   589     }
       
   590 
       
   591 const TPoint& CHgScrollbar::HandlePosition() const
       
   592     {
       
   593     return iHandlePosition;
       
   594     }
       
   595 
       
   596 TBool CHgScrollbar::IsStatic() const
       
   597     {
       
   598     return iStatic;
       
   599     }
       
   600 
       
   601 TBool CHgScrollbar::IsDragging() const
       
   602     {
       
   603     return iDragging;
       
   604     }
       
   605 
       
   606 TBool CHgScrollbar::Handler() const
       
   607     {
       
   608     return iHandler;
       
   609     }
       
   610 
       
   611 void CHgScrollbar::Reset()
       
   612     {
       
   613     iHandler = iDragging = EFalse; 
       
   614     }
       
   615 
       
   616 // End of file