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