mulwidgets/mulsliderwidget/src/mulsliderutils.cpp
branchRCL_3
changeset 19 4ea6f81c838a
parent 17 514d98f21c43
child 20 0e9bb658ef58
equal deleted inserted replaced
17:514d98f21c43 19:4ea6f81c838a
     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:  Utilities for slider widget.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <aknlayoutscalable_uiaccel.cdl.h>
       
    23 #include "mulsliderdefinitions.h"
       
    24 #include "mulsliderutils.h"
       
    25 #include <alf/alfimageloaderutil.h>
       
    26 #include <alf/alftexture.h>
       
    27 #include <alf/alfimage.h>
       
    28 #include <alf/alfenv.h>
       
    29 #include <utf.h>
       
    30 #include "mulutility.h"
       
    31 
       
    32 
       
    33 namespace Alf
       
    34     {
       
    35 
       
    36     //------------------------------------------------------------------------
       
    37     // GetComponentRect
       
    38     //------------------------------------------------------------------------
       
    39 	 TAknLayoutRect MulSliderUtils::GetComponentRect(
       
    40 	     SliderLCTIDs aId,CAlfLayout *aLayout,int aVariety)
       
    41 	 {
       
    42 	 	TAknLayoutRect layoutRect;
       
    43 	 	TPoint layoutRectSize = aLayout->Size().IntValueNow();
       
    44 	 	    
       
    45 	 	TRect rect2(0,
       
    46 	 	           0,
       
    47 	 	           layoutRectSize.iX,
       
    48 	 	           layoutRectSize.iY);
       
    49 		switch(aId)
       
    50 		    {
       
    51 			case EVSliderPane:  
       
    52 			{
       
    53 			TAknWindowLineLayout LayoutHandle =
       
    54 			    AknLayoutScalable_UiAccel::aaslider_pane(aVariety).LayoutLine();
       
    55 			layoutRect.LayoutRect( rect2,LayoutHandle);  
       
    56 			}
       
    57 			break;
       
    58 			
       
    59 			case EVSliderBackground:
       
    60 			{
       
    61 			TAknWindowLineLayout LayoutHandle = 
       
    62 			    AknLayoutScalable_UiAccel::
       
    63 			        aaslider_pane_g1(aVariety).LayoutLine();
       
    64 			layoutRect.LayoutRect( rect2,LayoutHandle);          
       
    65 			}
       
    66 			break;
       
    67 			
       
    68 			case EVSliderBgPane:
       
    69 			{
       
    70 			TAknWindowLineLayout LayoutHandle = 
       
    71 			    AknLayoutScalable_UiAccel::
       
    72 			        aaslider_bg_pane_cp001(aVariety).LayoutLine();
       
    73 			layoutRect.LayoutRect(rect2,LayoutHandle);
       
    74 			}
       
    75 			break;  
       
    76 			
       
    77 			case EVSliderTop:
       
    78 			{
       
    79 			TAknWindowLineLayout LayoutHandle = 
       
    80 			    AknLayoutScalable_UiAccel::
       
    81 			        aaslider_bg_pane_cp001_g1(aVariety).LayoutLine();
       
    82 			layoutRect.LayoutRect(rect2,LayoutHandle);
       
    83 			}
       
    84 			break;  
       
    85 			
       
    86 			case EVSliderMiddle:
       
    87 			{
       
    88 			TAknWindowLineLayout LayoutHandle = 
       
    89 			    AknLayoutScalable_UiAccel::
       
    90 			        aaslider_bg_pane_cp001_g3(aVariety).LayoutLine();
       
    91 			layoutRect.LayoutRect(rect2,LayoutHandle);
       
    92 			}
       
    93 			break;  
       
    94 			
       
    95 			case EVSliderEnd:
       
    96 			{
       
    97 			TAknWindowLineLayout LayoutHandle = 
       
    98 			    AknLayoutScalable_UiAccel::
       
    99 			        aaslider_bg_pane_cp001_g2(aVariety).LayoutLine();
       
   100 			layoutRect.LayoutRect(rect2,LayoutHandle);
       
   101 			}
       
   102 			break;  
       
   103 			
       
   104 			case EVSliderPlus:
       
   105 			{
       
   106 			TAknWindowLineLayout LayoutHandle = 
       
   107 			    AknLayoutScalable_UiAccel::aaslider_pane_g4(aVariety).LayoutLine();
       
   108 			layoutRect.LayoutRect( rect2,LayoutHandle);
       
   109 			}
       
   110 			break;
       
   111 			
       
   112 			case EVSliderMinus:
       
   113 			{
       
   114 			TAknWindowLineLayout LayoutHandle = 			                     
       
   115 			    AknLayoutScalable_UiAccel::
       
   116 			    aaslider_pane_g5(aVariety).LayoutLine();			        
       
   117 			layoutRect.LayoutRect( rect2,LayoutHandle);
       
   118 			}
       
   119 			break;
       
   120 			
       
   121 			case EVSliderMarker:
       
   122 			{
       
   123 			TAknWindowLineLayout LayoutHandle = 
       
   124                     AknLayoutScalable_UiAccel::
       
   125                     aaslider_pane_g2(aVariety).LayoutLine();
       
   126 			layoutRect.LayoutRect( rect2,LayoutHandle);
       
   127 			}
       
   128 			break;
       
   129 			
       
   130 			case EVSliderInnerRect:
       
   131 			{
       
   132 			TAknWindowLineLayout LayoutHandleInner = 
       
   133 			    AknLayoutScalable_UiAccel::
       
   134 			        aid_aaslider_pane_rect_inner(aVariety).LayoutLine();
       
   135 			layoutRect.LayoutRect( rect2,LayoutHandleInner);
       
   136 			}
       
   137 			break;
       
   138 			/*case EVSliderAudioImage:
       
   139 			{
       
   140 			TAknWindowLineLayout LayoutHandle =                                                   
       
   141 			    AknLayoutScalable_UiAccel::
       
   142 			        aaslider_pane_g3(aVariety).LayoutLine();                              
       
   143 			layoutRect.LayoutRect(rect2,LayoutHandle);
       
   144 			}   
       
   145 			break;*/
       
   146 
       
   147 			case EHSliderPane:
       
   148 			{
       
   149 			TAknWindowLineLayout TrackLayoutHandle = 
       
   150 			    AknLayoutScalable_UiAccel::
       
   151 			        aacf_slider_pane(aVariety).LayoutLine();
       
   152 			layoutRect.LayoutRect( rect2,TrackLayoutHandle);          
       
   153 			}
       
   154 			break;
       
   155 
       
   156 			case EHSliderBase:
       
   157 			{
       
   158 			TAknWindowLineLayout TrackLayoutHandle = 
       
   159 			    AknLayoutScalable_UiAccel::
       
   160 			        aacf_slider_pane(aVariety).LayoutLine();
       
   161 			layoutRect.LayoutRect( rect2,TrackLayoutHandle);          
       
   162 			}
       
   163 			break;
       
   164 
       
   165 			case EHSliderCenter:    
       
   166 			{
       
   167 			TAknWindowLineLayout TrackLayoutHandle = 
       
   168 			    AknLayoutScalable_UiAccel::
       
   169 			        aaslider_bg_pane(aVariety).LayoutLine();
       
   170 			layoutRect.LayoutRect(rect2, TrackLayoutHandle);
       
   171 			}
       
   172 			break;
       
   173 			
       
   174 		    case EHSliderLeft:
       
   175 			{
       
   176 			TAknWindowLineLayout TrackLayoutHandle = 
       
   177 			    AknLayoutScalable_UiAccel::
       
   178 			        aaslider_bg_pane_g1(aVariety).LayoutLine();
       
   179 			layoutRect.LayoutRect( rect2,TrackLayoutHandle);          
       
   180 			}
       
   181 			break;
       
   182 			
       
   183 			case EHSliderCentre:
       
   184 			{
       
   185 			TAknWindowLineLayout TrackLayoutHandle = 
       
   186 			    AknLayoutScalable_UiAccel::
       
   187 			        aaslider_bg_pane_g2_copy1(aVariety).LayoutLine();
       
   188 			layoutRect.LayoutRect( rect2,TrackLayoutHandle);          
       
   189 			}
       
   190 			break;
       
   191 
       
   192       case EHSliderRight:
       
   193 			{
       
   194 			TAknWindowLineLayout TrackLayoutHandle = 
       
   195 			    AknLayoutScalable_UiAccel::
       
   196 			        aaslider_bg_pane_g2(aVariety).LayoutLine();
       
   197 			layoutRect.LayoutRect( rect2,TrackLayoutHandle);          
       
   198 			}
       
   199 			break;
       
   200 			
       
   201 			/*case EHSliderHandle:    
       
   202 			{
       
   203 			TAknWindowLineLayout TrackLayoutHandle = 
       
   204 			    AknLayoutScalable_UiAccel::
       
   205 			    aaslider_pane_g2(aVariety).LayoutLine();
       
   206 			layoutRect.LayoutRect(rect2, TrackLayoutHandle);
       
   207 			}
       
   208 			break;*/
       
   209 			case EHSliderHandle:    
       
   210             {
       
   211             TAknWindowLineLayout TrackLayoutHandle = 
       
   212                 AknLayoutScalable_UiAccel::
       
   213                     aacf_slider_pane_g1(aVariety).LayoutLine();
       
   214             layoutRect.LayoutRect(rect2, TrackLayoutHandle);
       
   215             }
       
   216             break;
       
   217 			case EVSliderMarkerExtended:
       
   218             {
       
   219             TAknWindowLineLayout LayoutHandle = 
       
   220                 AknLayoutScalable_UiAccel::
       
   221                     aid_touch_size_slider_marker(aVariety).LayoutLine();
       
   222             layoutRect.LayoutRect( rect2,LayoutHandle);
       
   223             }
       
   224             break;
       
   225 			case EPSliderLeft:    
       
   226 			{
       
   227 			TAknWindowLineLayout ProgressPaneLeft = 
       
   228 			    AknLayoutScalable_UiAccel::
       
   229 			        aalist_progress_pane_g1(aVariety).LayoutLine();
       
   230 			layoutRect.LayoutRect(rect2, ProgressPaneLeft);
       
   231 			}
       
   232 			break;
       
   233 			
       
   234 			case EPSliderCentre:    
       
   235 			{
       
   236 			TAknWindowLineLayout ProgressPaneCentre = 
       
   237 			    AknLayoutScalable_UiAccel::
       
   238 			        aalist_progress_pane_g2(aVariety).LayoutLine();
       
   239 			layoutRect.LayoutRect(rect2, ProgressPaneCentre);
       
   240 			}
       
   241 			break;
       
   242 			
       
   243 			case EPSliderRight:    
       
   244 			{
       
   245 			TAknWindowLineLayout ProgressPaneRight = 
       
   246 			    AknLayoutScalable_UiAccel::
       
   247 			        aalist_progress_pane_g3(aVariety).LayoutLine();
       
   248 			layoutRect.LayoutRect(rect2, ProgressPaneRight);
       
   249 			}
       
   250 			break;
       
   251 			default: ;
       
   252 			         
       
   253 	        }// end of switch
       
   254      
       
   255 		  return layoutRect;
       
   256 
       
   257 	 }
       
   258 	 
       
   259 	//-------------------------------------------------------------------------
       
   260 	// GetTextComponentRect
       
   261 	//------------------------------------------------------------------------- 
       
   262 	 TAknLayoutText MulSliderUtils::GetTextComponentRect(
       
   263 	     SliderLCTIDs aId, CAlfLayout *aLayout, int aVariety)
       
   264 	 {
       
   265 	 	TAknLayoutText textRect;
       
   266     
       
   267 		TRect rect2(0,
       
   268 		           0,
       
   269 		           aLayout->Size().iX.ValueNow(),
       
   270 		           aLayout->Size().iY.ValueNow());
       
   271 		switch(aId)
       
   272 		    {
       
   273 			case EVSliderZoomText:  
       
   274 			{			     
       
   275 			TAknTextLineLayout textLayout =  
       
   276         	    AknLayoutScalable_UiAccel::aaslider_pane_t3(aVariety).LayoutLine();     		
       
   277     		textRect.LayoutText(rect2, textLayout );
       
   278 			}
       
   279 			break;
       
   280 			
       
   281 			default: ;
       
   282 			
       
   283 		    }
       
   284 		    
       
   285 		return textRect;
       
   286 	 }
       
   287 
       
   288 
       
   289 	} // End of namespace Alf
       
   290 	
       
   291