mulwidgets/common/src/mulvisualutility.cpp
branchRCL_3
changeset 19 4ea6f81c838a
parent 17 514d98f21c43
child 20 0e9bb658ef58
equal deleted inserted replaced
17:514d98f21c43 19:4ea6f81c838a
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Utility class for widgets visualization in terms of LCT data
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // includes
       
    20 // Class header
       
    21 #include "mulvisualutility.h"
       
    22 
       
    23 // Alf headers
       
    24 #include "alf/alfanchorlayoutattributesetter.h"
       
    25 #include "alf/alfattribute.h"
       
    26 #include "alf/alfattributecontainer.h"
       
    27 #include <alf/alfenv.h> 
       
    28 #include "alf/alftextvisualattributesetter.h"
       
    29 #include "alf/alfvisualtemplate.h"
       
    30 #include <alf/alfutil.h>
       
    31 
       
    32 // DUI headers for xml parser
       
    33 
       
    34 #include "alf/attrproperty.h"
       
    35 
       
    36 #include<aknlayoutscalable_uiaccel.cdl.h>
       
    37 
       
    38 // Local headers
       
    39 #include "mulimagevisualattributesetter.h"
       
    40 #include "mulassert.h"
       
    41 #include "mulutility.h"
       
    42 #include "mullog.h" //for logs
       
    43 using namespace duiuimodel;
       
    44 
       
    45 
       
    46 namespace Alf
       
    47 {
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Constructor
       
    51 // ---------------------------------------------------------------------------
       
    52 //	
       
    53 OSN_EXPORT MulVisualUtility::MulVisualUtility()
       
    54     {
       
    55     mData.reset(new (EMM) LCTData);                    
       
    56     }
       
    57     
       
    58 // ---------------------------------------------------------------------------
       
    59 // Destructor
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 OSN_EXPORT MulVisualUtility::~MulVisualUtility()
       
    63     {
       
    64 	// Nothing to destroy
       
    65     }
       
    66     
       
    67     
       
    68 // ---------------------------------------------------------------------------
       
    69 // parseLCTInfo 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 OSN_EXPORT void MulVisualUtility::parseLCTInfo(const LCTPair& aPair, CAlfLayout* aParentLayout)
       
    73 	{
       
    74 	TAknWindowLineLayout componentLayout;
       
    75 	TAknLayoutRect layoutRect;
       
    76 	UString lctId = aPair.mLctId;
       
    77 	TSize parentSize (0,0) ; 
       
    78 	if(aParentLayout )
       
    79 	{
       
    80 		parentSize = aParentLayout->Size().Target().AsSize();	
       
    81 	}
       
    82 	else
       
    83 	{
       
    84 		TSize size = AlfUtil::ScreenSize();
       
    85 		TAknWindowLineLayout parentLayout;
       
    86 		TAknLayoutRect layout;
       
    87 		bool isLandscape = MulUtility::IsLandscape();
       
    88 		if(!isLandscape)
       
    89 		{
       
    90 			parentLayout = AknLayoutScalable_UiAccel::main_pane(5).LayoutLine();
       
    91 		}
       
    92 		else
       
    93 		{
       
    94 			parentLayout = AknLayoutScalable_UiAccel::main_pane(6).LayoutLine();
       
    95 		}
       
    96 		
       
    97 		layout.LayoutRect( TRect(size), parentLayout );
       
    98 		parentSize.iWidth = layout.Rect().Width();
       
    99 		parentSize.iHeight = layout.Rect().Height();
       
   100 	}
       
   101 	
       
   102 	if(!lctId.compare(UString("uiaccel_main_aa_gridscroll_pane")))
       
   103 	    {
       
   104 	    componentLayout = AknLayoutScalable_UiAccel::main_aa_gridscroll_pane(aPair.mVariety).LayoutLine();
       
   105                 
       
   106 	    }
       
   107 	if(!lctId.compare(UString("uiaccel_aagrid_gene_pane")))
       
   108 	    {
       
   109 	    componentLayout = AknLayoutScalable_UiAccel::aagrid_gene_pane(aPair.mVariety).LayoutLine();
       
   110         
       
   111         	    
       
   112 	    }
       
   113 	if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane")))
       
   114 	    {
       
   115 	    componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane(aPair.mVariety, 0, 0 ).LayoutLine();
       
   116         
       
   117         }
       
   118 	if(!lctId.compare(UString("uiaccel_aa_scroll_pane_cp001")))
       
   119 	    {
       
   120 	    componentLayout = AknLayoutScalable_UiAccel::aa_scroll_pane_cp001(aPair.mVariety).LayoutLine();
       
   121         
       
   122         }
       
   123         
       
   124     if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g1")) )
       
   125     	{
       
   126     	componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g1(aPair.mVariety).LayoutLine();
       
   127     	}
       
   128     
       
   129     if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g2")) )
       
   130     	{
       
   131     	componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g2(aPair.mVariety).LayoutLine();
       
   132     	}
       
   133     	
       
   134     if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g3")) )
       
   135     	{
       
   136     	componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g3(aPair.mVariety).LayoutLine();
       
   137     	}			
       
   138 	    
       
   139 	if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g4")) )
       
   140     	{
       
   141     	componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g4(aPair.mVariety).LayoutLine();
       
   142     	}			
       
   143 	        
       
   144 	    
       
   145 	    layoutRect.LayoutRect( TRect(parentSize), componentLayout );
       
   146 	    
       
   147 	    mData->mPosX = layoutRect.Rect().iTl.iX;
       
   148         mData->mPosY = layoutRect.Rect().iTl.iY;
       
   149         mData->mWidth = layoutRect.Rect().Width();
       
   150         mData->mHeight = layoutRect.Rect().Height();
       
   151 	
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // parseLCTInfo 
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 OSN_EXPORT void MulVisualUtility::parseLCTTextInfo()
       
   159 	{
       
   160 	
       
   161 	}
       
   162 	
       
   163 // ---------------------------------------------------------------------------
       
   164 // Returns the structure containing width, height etc info
       
   165 // ---------------------------------------------------------------------------
       
   166 //	
       
   167 OSN_EXPORT const LCTData& MulVisualUtility::data() const
       
   168     {
       
   169     return *(mData.get());
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // Internal function to convert LCT IDs into absolute data for text
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 void MulVisualUtility::readLCTTextData()
       
   177 	{
       
   178 	
       
   179 	}
       
   180 	
       
   181 // ---------------------------------------------------------------------------
       
   182 // Internal function to concert LCT IDs into absolute data 
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 void MulVisualUtility::readLCTData()
       
   186 	{
       
   187 	
       
   188 	}
       
   189 	
       
   190 // ---------------------------------------------------------------------------
       
   191 // Internal function
       
   192 // ---------------------------------------------------------------------------
       
   193 //	
       
   194 bool MulVisualUtility::isParentRelative(int /*aVal*/) const
       
   195     {
       
   196     return false;
       
   197     }
       
   198 
       
   199 } // namespace Alf
       
   200 
       
   201 // End of file