mulwidgets/mulsliderwidget/src/mulverticalslider.cpp
branchRCL_3
changeset 17 514d98f21c43
parent 15 125793e17004
equal deleted inserted replaced
15:125793e17004 17:514d98f21c43
    99     int mMarkerTexturePrtId;
    99     int mMarkerTexturePrtId;
   100     int mZoomInTexturePrtId;
   100     int mZoomInTexturePrtId;
   101     int mZoomInTextureLscId; 
   101     int mZoomInTextureLscId; 
   102     int mZoomOutTexturePrtId;
   102     int mZoomOutTexturePrtId;
   103     int mZoomOutTextureLscId;
   103     int mZoomOutTextureLscId;
       
   104     bool misSetModel;
   104     
   105     
   105     
   106     
   106     CAlfLayout* mMainLayout;
   107     CAlfLayout* mMainLayout;
   107     CAlfLayout* mBaseSliderLayout;// Slider Background
   108     CAlfLayout* mBaseSliderLayout;// Slider Background
   108     CAlfTexture* mTexture;
   109     CAlfTexture* mTexture;
   120 
   121 
   121     MulVerticalSliderDataImpl()
   122     MulVerticalSliderDataImpl()
   122         {
   123         {
   123         mOperation = false;
   124         mOperation = false;
   124         mSliderHit = false;
   125         mSliderHit = false;
       
   126         misSetModel = false;
   125         mTickInPixels = 0;
   127         mTickInPixels = 0;
   126         mRangeInPixels = 0;
   128         mRangeInPixels = 0;
   127         mCurrTickInPixels = 0;
   129         mCurrTickInPixels = 0;
   128         mVisual = NULL;
   130         mVisual = NULL;
   129         mDragPoint.SetXY(0,0);
   131         mDragPoint.SetXY(0,0);
   326 //  set the positions and images for the visual hierarchy
   328 //  set the positions and images for the visual hierarchy
   327 // ---------------------------------------------------------------------------
   329 // ---------------------------------------------------------------------------
   328 //
   330 //
   329 void MulSliderVertical::layoutVisuals( sliderTemplate /*aTemplateId*/)
   331 void MulSliderVertical::layoutVisuals( sliderTemplate /*aTemplateId*/)
   330     {
   332     {
   331     bool relayout = false;
   333 
       
   334     bool relayout = mData->misSetModel;
       
   335  
   332     if(mData->mLayoutMirrored != AknLayoutUtils::LayoutMirrored())
   336     if(mData->mLayoutMirrored != AknLayoutUtils::LayoutMirrored())
   333         {
   337         {
   334         mData->mOrientationLandScape = !mSliderModel->IsLandscape();
   338         mData->mOrientationLandScape = !mSliderModel->IsLandscape();
   335         mData->mLayoutMirrored = AknLayoutUtils::LayoutMirrored();
   339         mData->mLayoutMirrored = AknLayoutUtils::LayoutMirrored();
   336         }
   340         }
   340         relayout = true;
   344         relayout = true;
   341         mData->mOrientationLandScape = mSliderModel->IsLandscape();
   345         mData->mOrientationLandScape = mSliderModel->IsLandscape();
   342         }  
   346         }  
   343     if(relayout)
   347     if(relayout)
   344         {
   348         {
   345     
   349     mData->misSetModel = false; 
   346     CAlfControl* ctrl = (CAlfControl*)&control();  
   350     CAlfControl* ctrl = (CAlfControl*)&control();  
   347     TAknLayoutRect layoutRect;
   351     TAknLayoutRect layoutRect;
   348     //get the lct rect for mBaseSliderLayout and set it            
   352     //get the lct rect for mBaseSliderLayout and set it            
   349     // aaslider_pane(3)
   353     // aaslider_pane(3)
   350     layoutRect = MulSliderUtils::GetComponentRect(
   354     layoutRect = MulSliderUtils::GetComponentRect(
   792         mData->mTickInPixels = 
   796         mData->mTickInPixels = 
   793         (sliderCentreSize - sliderHandleSize) /
   797         (sliderCentreSize - sliderHandleSize) /
   794             (mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
   798             (mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
   795         }
   799         }
   796     // Get the track start pixel value    
   800     // Get the track start pixel value    
   797     mData->mTrackStartPoint = 
   801     mData->mTrackStartPoint = sliderCentrePos + sliderCentreSize - sliderHandleSize  ;  
   798     sliderCentrePos + 
       
   799     sliderCentreSize -   
       
   800     sliderHandleSize  ;  
       
   801     // Store current tick
   802     // Store current tick
   802     mData->mCurrTick =  mSliderModel->PrimaryValue() ; 
   803     mData->mCurrTick =  mSliderModel->PrimaryValue() ; 
   803     if(mSliderModel->MaxRange()== mSliderModel->MinRange())
   804     if(mSliderModel->MaxRange()== mSliderModel->MinRange())
   804         {
   805         {
   805         mData->mTrackStartPoint= sliderCentrePos;
   806         mData->mTrackStartPoint= sliderCentrePos;
   806         }
   807         }
   807     mData->mTick = mSliderModel->Tick();
   808     mData->mTick = mSliderModel->Tick();
   808     }
   809     }
   809     
   810     
       
   811 //----------------------------------------------------------------------------
       
   812 //  FeedbackIntensity
       
   813 //----------------------------------------------------------------------------
       
   814 //
       
   815 TInt MulSliderVertical::feedbackIntensity()
       
   816     {
       
   817        /*  We need to find the position of the thumb w.r.t the slider track.
       
   818         *  mData->mTickInPixels will give the no. of pixels each tick will 
       
   819         * 
       
   820         */ 
       
   821     
       
   822        int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) * 
       
   823                     mData->mTickInPixels;
       
   824        TInt intensity =  ( deltaY  * 100 )/ mData->mRangeInPixels  ;
       
   825        return intensity ;
       
   826     }
   810     
   827     
   811 // ---------------------------------------------------------------------------
   828 // ---------------------------------------------------------------------------
   812 //  createVisualization
   829 //  createVisualization
   813 // ---------------------------------------------------------------------------
   830 // ---------------------------------------------------------------------------
   814 //    
   831 //    
   819         mData->mLayoutMirrored = true;
   836         mData->mLayoutMirrored = true;
   820     else
   837     else
   821         mData->mLayoutMirrored = false;
   838         mData->mLayoutMirrored = false;
   822     // Create the visualization
   839     // Create the visualization
   823     CAlfControl* ctrl = (CAlfControl*)&control();
   840     CAlfControl* ctrl = (CAlfControl*)&control();
   824     mData->mOrientationLandScape = !mSliderModel->IsLandscape();
   841     mData->mOrientationLandScape = mSliderModel->IsLandscape();
       
   842     mData->misSetModel = true;
   825         
   843         
   826     // Visual Hierarchy creation
   844     // Visual Hierarchy creation
   827     // create the mMainLayout
   845     // create the mMainLayout
   828     mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL);
   846     mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL);
   829     // set the flag for Notifications 
   847     // set the flag for Notifications 
  1140                 mData->mDragStartStep;
  1158                 mData->mDragStartStep;
  1141             // Update the model hence update visualization
  1159             // Update the model hence update visualization
  1142             updateModelPrimaryValue(newPos); 
  1160             updateModelPrimaryValue(newPos); 
  1143             //Tactile Feedback For Thumb Drag
  1161             //Tactile Feedback For Thumb Drag
  1144             MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
  1162             MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
  1145             sldrcntrl.TactileEffectOnDrag(*aEvent);
  1163             int fdbintensity = feedbackIntensity();
       
  1164             sldrcntrl.TactileEffectOnDrag(*aEvent , fdbintensity );
  1146             ret = EEventHandled;    
  1165             ret = EEventHandled;    
  1147         }
  1166         }
  1148     
  1167     
  1149     else if(aEvent->PointerUp()  )
  1168     else if(aEvent->PointerUp()  )
  1150         {
  1169         {