mulwidgets/mulsliderwidget/src/mulverticalslider.cpp
branchRCL_3
changeset 15 125793e17004
parent 11 65e535be25c8
child 17 514d98f21c43
equal deleted inserted replaced
14:03228bb411ae 15:125793e17004
    24 #include <alf/alfroster.h>
    24 #include <alf/alfroster.h>
    25 #include <alf/alfdisplay.h>
    25 #include <alf/alfdisplay.h>
    26 #include <alf/alfbrusharray.h>
    26 #include <alf/alfbrusharray.h>
    27 #include <alf/alftextvisual.h>
    27 #include <alf/alftextvisual.h>
    28 #include <alf/alfevent.h>
    28 #include <alf/alfevent.h>
    29 //#include <osn/alfptrvector.h>
    29 #include <alf/alftexture.h>
    30 #include <alf/alfframebrush.h>
    30 #include <alf/alfframebrush.h>
    31 
    31 
    32 //Widget Model Includes
    32 //Widget Model Includes
    33 #include <alf/alfwidgetevents.h>
    33 #include <alf/alfwidgetevents.h>
    34 #include <alf/alfwidgetenvextension.h>
    34 #include <alf/alfwidgetenvextension.h>
    65     int mRangeInPixels;// Range in Pixel
    65     int mRangeInPixels;// Range in Pixel
    66     int mCurrTickInPixels;// Current Tick posion in pixels
    66     int mCurrTickInPixels;// Current Tick posion in pixels
    67     CAlfVisual * mVisual;// Stores the current visual hit 
    67     CAlfVisual * mVisual;// Stores the current visual hit 
    68     TPoint mDragPoint;// Point at which drag started 
    68     TPoint mDragPoint;// Point at which drag started 
    69     TPoint mLongTapPos;// Point at which button down happened 
    69     TPoint mLongTapPos;// Point at which button down happened 
       
    70     TSize mTrackTopImageSizePrt;
       
    71     TSize mTrackTopImageSizeLsc;
       
    72     TSize mTrackMiddleImageSizePrt;
       
    73     TSize mTrackMiddleImageSizeLsc;
       
    74     TSize mTrackBottomImageSizePrt;
       
    75     TSize mTrackBottomImageSizeLsc;
       
    76     TSize mSliderHandleSizePrt;
       
    77     TSize mSliderHandleSizeLsc;
       
    78     TSize mImagePlusSizePrt;
       
    79     TSize mImagePlusSizeLsc;
       
    80     TSize mImageMinusSizePrt;
       
    81     TSize mImageMinusSizeLsc;
    70     int mDragStartStep;// Tick positon of Drag Start
    82     int mDragStartStep;// Tick positon of Drag Start
    71     int mCurrTick;// Stores current tick
    83     int mCurrTick;// Stores current tick
    72     int mTick;// Stores Tick Size
    84     int mTick;// Stores Tick Size
    73     int mTrackStartPoint;// Slider Track Start Point in pixel
    85     int mTrackStartPoint;// Slider Track Start Point in pixel
    74     int mHandleGhostHieghtDelta;
    86     int mHandleGhostHieghtDelta;
    75     bool mOrientationLandScape;
    87     bool mOrientationLandScape;
    76     bool mHasBackground; // for background only created once 
    88     bool mHasBackground; // for background only created once 
    77     int mdirection;// 0 - nomovement,1 up movement 2 down
    89     int mdirection;// 0 - nomovement,1 up movement 2 down
    78     bool mLayoutMirrored;// RTL if True else LTR
    90     bool mLayoutMirrored;// RTL if True else LTR
    79     int mImageTextureId; // to differtiate between textures 
    91     int mImageTextureId; // to differtiate between textures 
    80     int mTrackTopTextureId ;// to store the auto generated texture id's
    92     int mTrackTopTexturePrtId ;// to store the auto generated texture id's
    81     int mTrackBottomTextureId;
    93     int mTrackTopTextureLscId;
    82     int mTrackMiddleTextureId;
    94     int mTrackBottomTexturePrtId;
    83     int mMarkerTextureId;
    95     int mTrackBottomTextureLscId;
    84     int mZoomInTextureId;
    96     int mTrackMiddleTextureLscId;
    85     int mZoomOutTextureId;
    97     int mTrackMiddleTexturePrtId;
       
    98     int mMarkerTextureLscId;
       
    99     int mMarkerTexturePrtId;
       
   100     int mZoomInTexturePrtId;
       
   101     int mZoomInTextureLscId; 
       
   102     int mZoomOutTexturePrtId;
       
   103     int mZoomOutTextureLscId;
       
   104     
    86     
   105     
    87     CAlfLayout* mMainLayout;
   106     CAlfLayout* mMainLayout;
    88     CAlfLayout* mBaseSliderLayout;// Slider Background
   107     CAlfLayout* mBaseSliderLayout;// Slider Background
    89     CAlfTexture* mTexture;
   108     CAlfTexture* mTexture;
    90     CAlfLayout* mSliderCentre;// Track layout
   109     CAlfLayout* mSliderCentre;// Track layout
   112         mDragStartStep = 0;
   131         mDragStartStep = 0;
   113         mCurrTick = 0;
   132         mCurrTick = 0;
   114         mTick = 0;
   133         mTick = 0;
   115         mTrackStartPoint = 0;
   134         mTrackStartPoint = 0;
   116         mImageTextureId = 0;
   135         mImageTextureId = 0;
   117         mTrackTopTextureId = 0;
   136         mTrackTopTexturePrtId = 0;
   118         mTrackBottomTextureId = 0;
   137         mTrackTopTextureLscId = 0;
   119         mTrackMiddleTextureId = 0;
   138         mTrackBottomTexturePrtId = 0;
   120         mMarkerTextureId = 0;
   139         mTrackBottomTextureLscId = 0;
   121         mZoomInTextureId = 0;
   140         mTrackMiddleTexturePrtId = 0;
   122         mZoomOutTextureId = 0;
   141         mTrackMiddleTextureLscId = 0;
       
   142         mMarkerTexturePrtId = 0;
       
   143         mMarkerTextureLscId = 0;
       
   144         mZoomInTexturePrtId = 0;
       
   145         mZoomInTextureLscId = 0;
       
   146         mZoomOutTexturePrtId = 0;
       
   147         mZoomOutTextureLscId = 0;
   123         mMainLayout = NULL;
   148         mMainLayout = NULL;
   124         mBaseSliderLayout = NULL;
   149         mBaseSliderLayout = NULL;
   125         mSliderCentre = NULL;
   150         mSliderCentre = NULL;
   126         mTrackTopImage = NULL;
   151         mTrackTopImage = NULL;
   127         mTrackMiddleImage = NULL;
   152         mTrackMiddleImage = NULL;
   135         mHandleGhostHieghtDelta = 0;   
   160         mHandleGhostHieghtDelta = 0;   
   136         mOrientationLandScape = false;
   161         mOrientationLandScape = false;
   137         mdirection = 0;
   162         mdirection = 0;
   138         mLayoutMirrored = false;
   163         mLayoutMirrored = false;
   139         mHasBackground = false;
   164         mHasBackground = false;
       
   165         mTrackTopImageSizePrt.SetSize(0,0);
       
   166         mTrackTopImageSizeLsc.SetSize(0,0);
       
   167         mTrackBottomImageSizePrt.SetSize(0,0);
       
   168         mTrackBottomImageSizeLsc.SetSize(0,0);
       
   169         mTrackMiddleImageSizePrt.SetSize(0,0);
       
   170         mTrackMiddleImageSizeLsc.SetSize(0,0);
       
   171         mSliderHandleSizePrt.SetSize(0,0);
       
   172         mSliderHandleSizeLsc.SetSize(0,0);
       
   173         mImagePlusSizePrt.SetSize(0,0);
       
   174         mImagePlusSizeLsc.SetSize(0,0);
       
   175         mImageMinusSizePrt.SetSize(0,0);
       
   176         mImageMinusSizeLsc.SetSize(0,0);
   140         } 
   177         } 
   141 
   178 
   142     };
   179     };
   143     
   180     
   144 // bitmap file path
   181 // bitmap file path
   181 MulSliderVertical::~MulSliderVertical()
   218 MulSliderVertical::~MulSliderVertical()
   182     {
   219     {
   183     // Visualization Data
   220     // Visualization Data
   184     if(mData)
   221     if(mData)
   185         {
   222         {
   186         (&control().Env())->TextureManager().UnloadTexture(mData->mTrackTopTextureId);
   223             CAlfTextureManager& txtmanager = control().Env().TextureManager();
   187         (&control().Env())->TextureManager().UnloadTexture(mData->mTrackBottomTextureId);
   224             txtmanager.UnloadTexture(mData->mTrackTopTextureLscId);
   188         (&control().Env())->TextureManager().UnloadTexture(mData->mTrackTopTextureId);
   225             txtmanager.UnloadTexture(mData->mTrackTopTexturePrtId);
   189         (&control().Env())->TextureManager().UnloadTexture(mData->mMarkerTextureId);
   226             txtmanager.UnloadTexture(mData->mTrackMiddleTextureLscId);
   190         (&control().Env())->TextureManager().UnloadTexture(mData->mZoomInTextureId);
   227             txtmanager.UnloadTexture(mData->mTrackMiddleTexturePrtId);
   191         (&control().Env())->TextureManager().UnloadTexture(mData->mZoomOutTextureId);
   228             txtmanager.UnloadTexture(mData->mTrackBottomTextureLscId);
   192         delete mData;
   229             txtmanager.UnloadTexture(mData->mTrackBottomTexturePrtId);
       
   230             txtmanager.UnloadTexture(mData->mMarkerTexturePrtId);
       
   231             txtmanager.UnloadTexture(mData->mMarkerTextureLscId);
       
   232             txtmanager.UnloadTexture(mData->mZoomInTexturePrtId);
       
   233             txtmanager.UnloadTexture(mData->mZoomInTextureLscId);
       
   234             txtmanager.UnloadTexture(mData->mZoomOutTexturePrtId);
       
   235             txtmanager.UnloadTexture(mData->mZoomOutTextureLscId);
       
   236             delete mData;
   193         }
   237         }
   194     else
   238     else
   195         {
   239         {
   196 
   240 
   197         }
   241         }
   307             EVSliderPane,mData->mMainLayout,KVariety3);
   351             EVSliderPane,mData->mMainLayout,KVariety3);
   308     mData->mBaseSliderLayout->SetRect(
   352     mData->mBaseSliderLayout->SetRect(
   309             TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY  ),
   353             TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY  ),
   310                     TSize( layoutRect.Rect().Size().iWidth, 
   354                     TSize( layoutRect.Rect().Size().iWidth, 
   311                             layoutRect.Rect().Size().iHeight ))) ;
   355                             layoutRect.Rect().Size().iHeight ))) ;
       
   356         
   312    if(!mData->mHasBackground)
   357    if(!mData->mHasBackground)
   313             SetBackgroundBrush();
   358             SetBackgroundBrush();
   314     // Set Position and Size for Extended touch layout for track
   359     // Set Position and Size for Extended touch layout for track
   315     mData->mSliderCentreGhost->SetRect(
   360     mData->mSliderCentreGhost->SetRect(
   316             TRect( TPoint(0,0 ),
   361             TRect( TPoint(0,0 ),
   317                     TSize( layoutRect.Rect().Size().iWidth, 
   362                     TSize( layoutRect.Rect().Size().iWidth, 
   318                             layoutRect.Rect().Size().iHeight )));
   363                             layoutRect.Rect().Size().iHeight )));
   319 
   364 
   320 
   365 
   321     //get the lct rect for mImageMinus and set it            
   366     //get the lct rect for mSliderCentre and set it     
   322     // aid_touch_size_slider_min(2) 
   367     //aaslider_bg_pane_cp001(6)
   323     layoutRect = MulSliderUtils::GetComponentRect(
   368     layoutRect = MulSliderUtils::GetComponentRect(
   324             EVSliderMinus,mData->mBaseSliderLayout,KVariety2);
   369             EVSliderBgPane,
   325     mData->mImageMinus->SetRect(
   370             mData->mBaseSliderLayout,
   326             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
   371             KVariety6);
       
   372     
       
   373     mData->mSliderCentre->SetRect(
       
   374             TRect( TPoint( layoutRect.Rect().iTl.iX ,
       
   375                     layoutRect.Rect().iTl.iY),
   327                     TSize( layoutRect.Rect().Size().iWidth, 
   376                     TSize( layoutRect.Rect().Size().iWidth, 
   328                             layoutRect.Rect().Size().iHeight ))) ;
   377                             layoutRect.Rect().Size().iHeight )));
   329 
   378 
   330     //get the lct rect for mImagePlus and set it            
   379     //get the lct rect for mTrackTopImage and set it     
   331     // aid_touch_size_slider_max(1) 
   380     //aaslider_bg_pane_cp001_g1(0)
   332     layoutRect = MulSliderUtils::GetComponentRect(
   381     layoutRect = MulSliderUtils::GetComponentRect(
   333             EVSliderPlus,
   382             EVSliderTop,
   334             mData->mBaseSliderLayout,
   383             mData->mSliderCentre,
   335             KVariety1);
   384             KVariety0);
   336     mData->mImagePlus->SetRect(
   385     
   337             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
   386     mData->mTrackTopImage->SetRect(
       
   387             TRect( TPoint(0,layoutRect.Rect().iTl.iY),
   338                     TSize( layoutRect.Rect().Size().iWidth, 
   388                     TSize( layoutRect.Rect().Size().iWidth, 
   339                             layoutRect.Rect().Size().iHeight ))) ;
   389                             layoutRect.Rect().Size().iHeight )));
   340 
   390     
       
   391     mSliderModel->IsLandscape() ? mData->mTrackTopImageSizeLsc = layoutRect.Rect().Size():    
       
   392                                   mData->mTrackTopImageSizePrt = layoutRect.Rect().Size();    
       
   393 
       
   394     //get the lct rect for mTrackMiddleImage and set it     
       
   395     //aaslider_bg_pane_cp001_g3(0)
       
   396     layoutRect = MulSliderUtils::GetComponentRect(
       
   397             EVSliderMiddle,
       
   398             mData->mSliderCentre,
       
   399             KVariety0);
       
   400     mData->mTrackMiddleImage->SetRect(
       
   401             TRect( TPoint( 0,layoutRect.Rect().iTl.iY),
       
   402                     TSize( layoutRect.Rect().Size().iWidth, 
       
   403                             layoutRect.Rect().Size().iHeight )));
       
   404 
       
   405     mSliderModel->IsLandscape() ? mData->mTrackMiddleImageSizeLsc = layoutRect.Rect().Size():    
       
   406                                   mData->mTrackMiddleImageSizePrt = layoutRect.Rect().Size();    
       
   407     //get the lct rect for mTrackEndImage and set it     
       
   408     //aaslider_bg_pane_cp001_g2(0)
       
   409     layoutRect = MulSliderUtils::GetComponentRect(
       
   410             EVSliderEnd,
       
   411             mData->mSliderCentre,
       
   412             KVariety0);
       
   413     mData->mTrackEndImage->SetRect(
       
   414             TRect( TPoint(0,layoutRect.Rect().iTl.iY),
       
   415                     TSize( layoutRect.Rect().Size().iWidth, 
       
   416                             layoutRect.Rect().Size().iHeight )));
       
   417     mSliderModel->IsLandscape() ? mData->mTrackBottomImageSizeLsc = layoutRect.Rect().Size():    
       
   418                                   mData->mTrackBottomImageSizePrt = layoutRect.Rect().Size();
       
   419   
       
   420     if(mData->mTrackTopImage && mData->mTrackMiddleImage && mData->mTrackEndImage)
       
   421        {
       
   422         setTrackImage();
       
   423        }
       
   424 
       
   425     
   341     //get the lct rect for mSliderHandle and set it     
   426     //get the lct rect for mSliderHandle and set it     
   342     //aid_touch_size_slider_marker(5)
   427     //aid_touch_size_slider_marker(5)
   343     layoutRect = MulSliderUtils::GetComponentRect(
   428     layoutRect = MulSliderUtils::GetComponentRect(
   344             EVSliderMarker,
   429             EVSliderMarker,
   345             mData->mBaseSliderLayout,
   430             mData->mBaseSliderLayout,
   346             KVariety5);
   431             KVariety5);
   347     mData->mSliderHandle->SetRect(
   432     mData->mSliderHandle->SetRect(
   348             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
   433             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
   349                     TSize( layoutRect.Rect().Size().iWidth, 
   434                     TSize( layoutRect.Rect().Size().iWidth, 
   350                             layoutRect.Rect().Size().iHeight ))) ;
   435                             layoutRect.Rect().Size().iHeight ))) ;
       
   436     mSliderModel->IsLandscape() ? mData->mSliderHandleSizeLsc = layoutRect.Rect().Size():    
       
   437                                   mData->mSliderHandleSizePrt = layoutRect.Rect().Size();
   351     
   438     
   352     layoutRect = MulSliderUtils::GetComponentRect(
   439     layoutRect = MulSliderUtils::GetComponentRect(
   353                 EVSliderMarkerExtended,
   440                 EVSliderMarkerExtended,
   354                 mData->mBaseSliderLayout,
   441                 mData->mBaseSliderLayout,
   355                 KVariety5);
   442                 KVariety5);
   361             TRect( TPoint( mData->mBaseSliderLayout->Pos().iX.ValueNow(),
   448             TRect( TPoint( mData->mBaseSliderLayout->Pos().iX.ValueNow(),
   362                     mData->mSliderHandle->Pos().iY.ValueNow()- 
   449                     mData->mSliderHandle->Pos().iY.ValueNow()- 
   363                     mData->mHandleGhostHieghtDelta/2),
   450                     mData->mHandleGhostHieghtDelta/2),
   364                     TSize( mData->mBaseSliderLayout->Size().iX.ValueNow(), 
   451                     TSize( mData->mBaseSliderLayout->Size().iX.ValueNow(), 
   365                             layoutRect.Rect().Size().iHeight)));
   452                             layoutRect.Rect().Size().iHeight)));
   366 
   453     
   367     //get the lct rect for mSliderCentre and set it     
       
   368     //aaslider_bg_pane_cp001(6)
       
   369     layoutRect = MulSliderUtils::GetComponentRect(
       
   370             EVSliderBgPane,
       
   371             mData->mBaseSliderLayout,
       
   372             KVariety6);
       
   373     mData->mSliderCentre->SetRect(
       
   374             TRect( TPoint( layoutRect.Rect().iTl.iX ,
       
   375                     layoutRect.Rect().iTl.iY),
       
   376                     TSize( layoutRect.Rect().Size().iWidth, 
       
   377                             layoutRect.Rect().Size().iHeight )));
       
   378 
       
   379     //get the lct rect for mTrackTopImage and set it     
       
   380     //aaslider_bg_pane_cp001_g1(0)
       
   381     layoutRect = MulSliderUtils::GetComponentRect(
       
   382             EVSliderTop,
       
   383             mData->mSliderCentre,
       
   384             KVariety0);
       
   385     mData->mTrackTopImage->SetRect(
       
   386             TRect( TPoint(0,layoutRect.Rect().iTl.iY),
       
   387                     TSize( layoutRect.Rect().Size().iWidth, 
       
   388                             layoutRect.Rect().Size().iHeight )));
       
   389 
       
   390     //get the lct rect for mTrackMiddleImage and set it     
       
   391     //aaslider_bg_pane_cp001_g3(0)
       
   392     layoutRect = MulSliderUtils::GetComponentRect(
       
   393             EVSliderMiddle,
       
   394             mData->mSliderCentre,
       
   395             KVariety0);
       
   396     mData->mTrackMiddleImage->SetRect(
       
   397             TRect( TPoint( 0,layoutRect.Rect().iTl.iY),
       
   398                     TSize( layoutRect.Rect().Size().iWidth, 
       
   399                             layoutRect.Rect().Size().iHeight )));
       
   400 
       
   401     //get the lct rect for mTrackEndImage and set it     
       
   402     //aaslider_bg_pane_cp001_g2(0)
       
   403     layoutRect = MulSliderUtils::GetComponentRect(
       
   404             EVSliderEnd,
       
   405             mData->mSliderCentre,
       
   406             KVariety0);
       
   407     mData->mTrackEndImage->SetRect(
       
   408             TRect( TPoint(0,layoutRect.Rect().iTl.iY),
       
   409                     TSize( layoutRect.Rect().Size().iWidth, 
       
   410                             layoutRect.Rect().Size().iHeight )));
       
   411   
       
   412     if(mData->mTrackTopImage && 
       
   413                     mData->mTrackMiddleImage && 
       
   414                     mData->mTrackEndImage)
       
   415                 {
       
   416                 setTrackImage();
       
   417                 }
       
   418     if(mData->mSliderHandle)
   454     if(mData->mSliderHandle)
   419         {
   455         {
   420         mData->mImageTextureId = KAlfMarkerTextureId;
   456         mData->mImageTextureId = KAlfMarkerTextureId;
   421         // Create the texture from bitmap provider
   457         // Create the texture from bitmap provider
   422         mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
   458         mData->mSliderHandle->SetImage( skinTexture(mData->mSliderHandleSizePrt ,mData->mSliderHandleSizeLsc , mData->mMarkerTexturePrtId, mData->mMarkerTextureLscId ) );
   423                 KAlfAutoGeneratedTextureId/*KAlfMarkerTextureId*/,
   459         }
   424                 (MAlfBitmapProvider *)this,
   460 
   425                 (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|
   461     //get the lct rect for mImagePlus and set it            
   426                                    EAlfTextureFlagSkinContent)));
   462     // aid_touch_size_slider_max(1) 
   427         TAlfImage aImage(*mData->mTexture );                                                
   463     layoutRect = MulSliderUtils::GetComponentRect(
   428         mData->mSliderHandle->SetImage(aImage);
   464             EVSliderPlus,
   429 
   465             mData->mBaseSliderLayout,
   430         }
   466             KVariety1);
   431 
   467     mData->mImagePlus->SetRect(
       
   468             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
       
   469                     TSize( layoutRect.Rect().Size().iWidth, 
       
   470                             layoutRect.Rect().Size().iHeight ))) ;
       
   471     
       
   472     mSliderModel->IsLandscape() ? mData->mImagePlusSizeLsc = layoutRect.Rect().Size():    
       
   473                                   mData->mImagePlusSizePrt = layoutRect.Rect().Size();
   432     if(mData->mImagePlus)
   474     if(mData->mImagePlus)
   433         {
   475         {
   434         mData->mImageTextureId = KAlfZoomInTextureId;
   476         mData->mImageTextureId = KAlfZoomInTextureId;
   435         // Create the texture from bitmap provider
   477         // Create the texture from bitmap provider
   436         mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
   478         mData->mImagePlus->SetImage(skinTexture(mData->mImagePlusSizePrt ,mData->mImagePlusSizeLsc , mData->mZoomInTexturePrtId, mData->mZoomInTextureLscId ));
   437                 KAlfAutoGeneratedTextureId/*KAlfZoomInTextureId*/,
   479         }
   438                 (MAlfBitmapProvider *)this,
   480 
   439                 (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
   481     //get the lct rect for mImageMinus and set it            
   440         TAlfImage aImage(*mData->mTexture );
   482     // aid_touch_size_slider_min(2) 
   441         mData->mImagePlus->SetImage(aImage);
   483     layoutRect = MulSliderUtils::GetComponentRect(
   442         }
   484             EVSliderMinus,mData->mBaseSliderLayout,KVariety2);
   443 
   485     
       
   486     mData->mImageMinus->SetRect(
       
   487             TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
       
   488                     TSize( layoutRect.Rect().Size().iWidth, 
       
   489                             layoutRect.Rect().Size().iHeight ))) ;
       
   490 
       
   491     mSliderModel->IsLandscape() ? mData->mImageMinusSizeLsc = layoutRect.Rect().Size():    
       
   492                                   mData->mImageMinusSizePrt = layoutRect.Rect().Size();
   444     if(mData->mImageMinus)
   493     if(mData->mImageMinus)
   445         {
   494         {
   446         mData->mImageTextureId = KAlfZoomOutTextureId;
   495         mData->mImageTextureId = KAlfZoomOutTextureId;
   447         // Create the texture from bitmap provider
   496         // Create the texture from bitmap provider
   448         mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
   497         mData->mImageMinus->SetImage(skinTexture(mData->mImageMinusSizePrt ,mData->mImageMinusSizeLsc , mData->mZoomOutTexturePrtId, mData->mZoomOutTextureLscId ));
   449                 KAlfAutoGeneratedTextureId/*KAlfZoomOutTextureId*/,
       
   450                 (MAlfBitmapProvider *)this,
       
   451                 (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
       
   452         TAlfImage aImage(*mData->mTexture );
       
   453         mData->mImageMinus->SetImage(aImage);
       
   454 
   498 
   455         }
   499         }
   456     }
   500     }
   457     }
   501     }
   458 // ---------------------------------------------------------------------------
   502 // ---------------------------------------------------------------------------
   460 // ---------------------------------------------------------------------------
   504 // ---------------------------------------------------------------------------
   461 //
   505 //
   462 
   506 
   463 void MulSliderVertical::setTrackImage()
   507 void MulSliderVertical::setTrackImage()
   464     {
   508     {
   465     //Review
   509 
   466     TInt flags = EAlfTextureFlagSkinContent;
   510         CAlfControl* ctrl = (CAlfControl*)&control();
   467     flags |= EAlfTextureFlagAutoSize;
   511         //creating texture for topimage
   468 
   512         mData->mImageTextureId = KAlfTrackTopTextureId;
   469     CAlfControl* ctrl = (CAlfControl*)&control();
   513         mData->mTrackTopImage->SetImage( skinTexture(mData->mTrackTopImageSizePrt ,mData->mTrackTopImageSizeLsc , mData->mTrackTopTexturePrtId, mData->mTrackTopTextureLscId ) ) ;
   470     //creating texture for topimage
   514         
   471     mData->mImageTextureId = KAlfTrackTopTextureId;
   515         //creating texture for middleimage
   472     mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
   516         mData->mImageTextureId = KAlfTrackMiddleTextureId;
   473         KAlfAutoGeneratedTextureId/*KAlfTrackTopTextureId*/,
   517         mData->mTrackMiddleImage->SetImage(skinTexture(mData->mTrackMiddleImageSizePrt ,mData->mTrackMiddleImageSizeLsc , mData->mTrackMiddleTexturePrtId, mData->mTrackMiddleTextureLscId ));
   474         (MAlfBitmapProvider *)this,
   518         
   475         (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
   519         //creating texture for bottom image
   476 
   520         mData->mImageTextureId = KAlfTrackBottomTextureId;
   477     TAlfImage trackTopImage(*mData->mTexture );
   521         mData->mTrackEndImage->SetImage( skinTexture(mData->mTrackBottomImageSizePrt ,mData->mTrackBottomImageSizeLsc , mData->mTrackBottomTexturePrtId, mData->mTrackBottomTextureLscId ) );
   478     //creating texture for middleimage
       
   479     mData->mImageTextureId = KAlfTrackMiddleTextureId;
       
   480     mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
       
   481         KAlfAutoGeneratedTextureId/*KAlfTrackMiddleTextureId*/,
       
   482         (MAlfBitmapProvider *)this,
       
   483         (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
       
   484 
       
   485     TAlfImage trackMiddleImage(*mData->mTexture );
       
   486 
       
   487     //creating texture for bottom image
       
   488     mData->mImageTextureId = KAlfTrackBottomTextureId;
       
   489     mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
       
   490         KAlfAutoGeneratedTextureId/*KAlfTrackBottomTextureId*/,
       
   491         (MAlfBitmapProvider *)this,
       
   492         (TAlfTextureFlags)(EAlfTextureFlagDefault)));
       
   493 
       
   494 
       
   495     TAlfImage trackEndImage(*mData->mTexture );
       
   496     // Set Image on visuals
       
   497     mData->mTrackTopImage->SetImage(trackTopImage);
       
   498     mData->mTrackMiddleImage->SetImage(trackMiddleImage);                    
       
   499     mData->mTrackEndImage->SetImage(trackEndImage);
       
   500 
   522 
   501     }//End of setImage
   523     }//End of setImage
   502  
   524  
   503 // ---------------------------------------------------------------------------
   525 // ---------------------------------------------------------------------------
   504 // ProvideBitmapL()
   526 // ProvideBitmapL()
   526            AknIconUtils::SetSize( aBitmap,
   548            AknIconUtils::SetSize( aBitmap,
   527                                 TSize(layoutRect.Rect().Size().iWidth,
   549                                 TSize(layoutRect.Rect().Size().iWidth,
   528                                 layoutRect.Rect().Size().iHeight),
   550                                 layoutRect.Rect().Size().iHeight),
   529                                 EAspectRatioNotPreserved);
   551                                 EAspectRatioNotPreserved);
   530             mData->mImageTextureId = 0;
   552             mData->mImageTextureId = 0;
   531             mData->mTrackTopTextureId = aId;
   553             mSliderModel->IsLandscape() ? mData->mTrackTopTextureLscId = aId :
       
   554                                           mData->mTrackTopTexturePrtId = aId ;
   532             }
   555             }
   533             break;
   556             break;
   534         case KAlfTrackBottomTextureId:
   557         case KAlfTrackBottomTextureId:
   535             {
   558             {
   536             AknIconUtils::CreateIconL(
   559             AknIconUtils::CreateIconL(
   547             AknIconUtils::SetSize( aBitmap,
   570             AknIconUtils::SetSize( aBitmap,
   548                                     TSize(layoutRect.Rect().Size().iWidth,
   571                                     TSize(layoutRect.Rect().Size().iWidth,
   549                                     layoutRect.Rect().Size().iHeight),
   572                                     layoutRect.Rect().Size().iHeight),
   550                                     EAspectRatioNotPreserved);
   573                                     EAspectRatioNotPreserved);
   551             mData->mImageTextureId = 0;
   574             mData->mImageTextureId = 0;
   552             mData->mTrackBottomTextureId = aId;
   575             mSliderModel->IsLandscape() ?   mData->mTrackBottomTextureLscId = aId :
       
   576                                             mData->mTrackBottomTexturePrtId = aId ;     
   553             }
   577             }
   554             break;
   578             break;
   555         case KAlfTrackMiddleTextureId:
   579         case KAlfTrackMiddleTextureId:
   556             {
   580             {
   557             AknIconUtils::CreateIconL(
   581             AknIconUtils::CreateIconL(
   570                                    TSize(layoutRect.Rect().Size().iWidth,
   594                                    TSize(layoutRect.Rect().Size().iWidth,
   571                                    layoutRect.Rect().Size().iHeight),
   595                                    layoutRect.Rect().Size().iHeight),
   572                                    EAspectRatioNotPreserved);
   596                                    EAspectRatioNotPreserved);
   573 
   597 
   574             mData->mImageTextureId = 0;
   598             mData->mImageTextureId = 0;
   575             mData->mTrackMiddleTextureId = aId;
   599             mSliderModel->IsLandscape() ? mData->mTrackMiddleTextureLscId = aId :
       
   600                                           mData->mTrackMiddleTexturePrtId = aId ;
   576             }
   601             }
   577             break;
   602             break;
   578 
   603 
   579         case KAlfMarkerTextureId:
   604         case KAlfMarkerTextureId:
   580             {
   605             {
   594                                      TSize(layoutRect.Rect().Size().iWidth,
   619                                      TSize(layoutRect.Rect().Size().iWidth,
   595                                      layoutRect.Rect().Size().iHeight),
   620                                      layoutRect.Rect().Size().iHeight),
   596                                      EAspectRatioNotPreserved);
   621                                      EAspectRatioNotPreserved);
   597 
   622 
   598             mData->mImageTextureId = 0;
   623             mData->mImageTextureId = 0;
   599             mData->mMarkerTextureId = aId;
   624             mSliderModel->IsLandscape() ? mData->mMarkerTextureLscId = aId :
       
   625                                           mData->mMarkerTexturePrtId = aId ;
   600             }
   626             }
   601             break;
   627             break;
   602         case KAlfZoomInTextureId:
   628         case KAlfZoomInTextureId:
   603             {
   629             {
   604             AknIconUtils::CreateIconL(
   630             AknIconUtils::CreateIconL(
   614            AknIconUtils::SetSize( aBitmap,
   640            AknIconUtils::SetSize( aBitmap,
   615                                   TSize(layoutRect.Rect().Size().iWidth,
   641                                   TSize(layoutRect.Rect().Size().iWidth,
   616                                   layoutRect.Rect().Size().iHeight),
   642                                   layoutRect.Rect().Size().iHeight),
   617                                   EAspectRatioNotPreserved);
   643                                   EAspectRatioNotPreserved);
   618             mData->mImageTextureId = 0;
   644             mData->mImageTextureId = 0;
   619             mData->mZoomInTextureId = aId;
   645             mSliderModel->IsLandscape() ? mData->mZoomInTextureLscId = aId :
       
   646                                           mData->mZoomInTexturePrtId = aId;
   620             }
   647             }
   621             break;
   648             break;
   622          case KAlfZoomOutTextureId:
   649          case KAlfZoomOutTextureId:
   623              {
   650              {
   624              AknIconUtils::CreateIconL(
   651              AknIconUtils::CreateIconL(
   635                                      TSize(layoutRect.Rect().Size().iWidth,
   662                                      TSize(layoutRect.Rect().Size().iWidth,
   636                                      layoutRect.Rect().Size().iHeight),
   663                                      layoutRect.Rect().Size().iHeight),
   637                                      EAspectRatioNotPreserved);
   664                                      EAspectRatioNotPreserved);
   638 
   665 
   639            mData->mImageTextureId = 0;
   666            mData->mImageTextureId = 0;
   640            mData->mZoomOutTextureId = aId;
   667            mSliderModel->IsLandscape() ? mData->mZoomOutTextureLscId = aId :
       
   668                                          mData->mZoomOutTexturePrtId = aId ;
       
   669            
   641            }
   670            }
   642              break;
   671            break;
   643         default:
   672         default:
   644             break;
   673             break;
   645                
   674                
   646         }
   675         }
   647     
   676     
   689         CleanupStack::Pop(brush);
   718         CleanupStack::Pop(brush);
   690         }
   719         }
   691     mData->mHasBackground = true;
   720     mData->mHasBackground = true;
   692     }    
   721     }    
   693     
   722     
       
   723 // ----------------------------------------------------------------------------
       
   724 //  skinTexture()
       
   725 // ----------------------------------------------------------------------------
       
   726 //
       
   727 TAlfImage MulSliderVertical::skinTexture(TSize aPrtImageSize, TSize aLscImageSize, TInt aPrtSkinId, TInt aLscSkinId )
       
   728     {
       
   729         const CAlfControl* ctrl = (CAlfControl*)(&control());
       
   730         
       
   731         if ( aPrtImageSize != aLscImageSize )
       
   732             {
       
   733             if ( aPrtSkinId == 0 || aLscSkinId == 0 )
       
   734                 {
       
   735                 mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
       
   736                                     KAlfAutoGeneratedTextureId,
       
   737                                     (MAlfBitmapProvider *)this,
       
   738                                     (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
       
   739                 TAlfImage dummyImage(*mData->mTexture);
       
   740                 return dummyImage;
       
   741                 }
       
   742             }
       
   743         else if ( aPrtSkinId == 0 || aLscSkinId == 0 )
       
   744                 {
       
   745                 TInt id = aPrtSkinId > aLscSkinId ? aPrtSkinId : aLscSkinId;
       
   746                 mData->mTexture = ((ctrl->Env()).TextureManager().TextureL(id));
       
   747                 TAlfImage dummyImage(*mData->mTexture);
       
   748                 return dummyImage;
       
   749                 }
       
   750         
       
   751         TInt textureId = mSliderModel->IsLandscape() ? aLscSkinId : aPrtSkinId;
       
   752         mData->mTexture = ((ctrl->Env()).TextureManager().TextureL( textureId ));
       
   753         TAlfImage dummyImage(*mData->mTexture);
       
   754         return dummyImage;
       
   755     }
       
   756 
       
   757 
   694 // ---------------------------------------------------------------------------
   758 // ---------------------------------------------------------------------------
   695 //  MakeTransparent()
   759 //  MakeTransparent()
   696 // ---------------------------------------------------------------------------
   760 // ---------------------------------------------------------------------------
   697 //
   761 //
   698 void MulSliderVertical::MakeTransparent(bool aVal)
   762 void MulSliderVertical::MakeTransparent(bool aVal)
   713 //  ConvertDataToPixels
   777 //  ConvertDataToPixels
   714 // ---------------------------------------------------------------------------
   778 // ---------------------------------------------------------------------------
   715 //
   779 //
   716 void MulSliderVertical::ConvertDataToPixels()
   780 void MulSliderVertical::ConvertDataToPixels()
   717     {
   781     {
       
   782     float sliderCentreSize = mData->mSliderCentre->Size().iY.ValueNow();
       
   783     float sliderHandleSize = mData->mSliderHandle->Size().iY.ValueNow();
       
   784     float sliderCentrePos  = mData->mSliderCentre->Pos().iY.ValueNow();
       
   785     
   718     // Calculate the range in pixel values
   786     // Calculate the range in pixel values
   719     mData->mRangeInPixels = 
   787     mData->mRangeInPixels = sliderCentreSize - sliderHandleSize;
   720     (mData->mSliderCentre->Size().iY.ValueNow() - 
       
   721             mData->mSliderHandle->Size().iY.ValueNow());
       
   722 
   788 
   723     if(mSliderModel->MaxRange() - mSliderModel->MinRange() != 0)
   789     if(mSliderModel->MaxRange() - mSliderModel->MinRange() != 0)
   724         {
   790         {
   725         // Calculate Tick Size in Pixels
   791         // Calculate Tick Size in Pixels
   726         mData->mTickInPixels = 
   792         mData->mTickInPixels = 
   727         (mData->mSliderCentre->Size().iY.ValueNow() - 
   793         (sliderCentreSize - sliderHandleSize) /
   728                 mData->mSliderHandle->Size().iY.ValueNow()) /
   794             (mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
   729                 (mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
       
   730         }
   795         }
   731     // Get the track start pixel value    
   796     // Get the track start pixel value    
   732     mData->mTrackStartPoint = mData->mSliderCentre->Pos().iY.ValueNow() +
   797     mData->mTrackStartPoint = 
   733     mData->mSliderCentre->Size().iY.ValueNow() -   
   798     sliderCentrePos + 
   734     mData->mSliderHandle->Size().iY.ValueNow()  ;  
   799     sliderCentreSize -   
       
   800     sliderHandleSize  ;  
   735     // Store current tick
   801     // Store current tick
   736     mData->mCurrTick =  mSliderModel->PrimaryValue() ; 
   802     mData->mCurrTick =  mSliderModel->PrimaryValue() ; 
   737     if(mSliderModel->MaxRange()== mSliderModel->MinRange())
   803     if(mSliderModel->MaxRange()== mSliderModel->MinRange())
   738         {
   804         {
   739         mData->mTrackStartPoint= mData->mSliderCentre->Pos().iY.ValueNow();
   805         mData->mTrackStartPoint= sliderCentrePos;
   740         }
   806         }
   741     mData->mTick = mSliderModel->Tick();
   807     mData->mTick = mSliderModel->Tick();
   742     }
   808     }
   743     
   809     
   744     
   810