mulwidgets/mulcoverflowwidget/src/mulbaseelement.cpp
branchRCL_3
changeset 26 0e9bb658ef58
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     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:  base element Implementation
       
    15  *
       
    16 */
       
    17 
       
    18 //  Include Files
       
    19 // Class Headers
       
    20 #include "mulbaseelement.h"
       
    21 
       
    22 #include <AknUtils.h>
       
    23 // Alf Headers
       
    24 #include <alf/alfbatchbuffer.h>
       
    25 #include <alf/alfbrusharray.h>
       
    26 #include <alf/alfgradientbrush.h>
       
    27 #include <alf/alfviewportlayout.h>
       
    28 #include <alf/alftextvisual.h>
       
    29 #include <alf/alfimagevisual.h>
       
    30 #include <alf/alfutil.h>
       
    31 #include <alf/alftransformation.h>
       
    32 
       
    33 // Mul Headers
       
    34 #include "mul/mulmodelutility.h"
       
    35 #include "imulmodelaccessor.h"
       
    36 #include <mul/imulsliderwidget.h>
       
    37 #include <mul/mulevent.h>
       
    38 #include "mulassert.h"
       
    39 #include "mulleave.h"
       
    40 #include "mullog.h" //for logs
       
    41 
       
    42 // Local Cover Flow Headers
       
    43 #include "mulcoverflowcontrol.h"
       
    44 #include "mulcoverflowtemplate.h"
       
    45 
       
    46 namespace Alf
       
    47     {
       
    48 //Internal base element structure implementation
       
    49 struct TMulBaseElementImpl
       
    50     {        
       
    51     
       
    52     UString mEmptyText;       // empty text to be displayed when number of items is 0.
       
    53 	
       
    54 	int mPadding;            //Padding between item 
       
    55     
       
    56   	TMulCoverFlowItem mHighlightItemStruct;
       
    57 	TMulCoverFlowItem mItemStruct;
       
    58 	int mVisibleCount;
       
    59     int	mScrollAnimationTime; // animation time for highlight transition set by the application.
       
    60 	bool mUiOn;    // true if in UiOnMode
       
    61     
       
    62     bool mTextVisible;  // not suppose to be displayed in template 4
       
    63 
       
    64 	
       
    65 	// To keep a pointer of iconFlow layout.Not owned, created at construction. 
       
    66 	// The below 4 layouts will never be null. No need to validate before using	
       
    67 	CAlfFlowLayout* mIconFlowLayout; 
       
    68 	CAlfLayout* mTextLayout;
       
    69     CAlfFlowLayout* mVerticalFlow;
       
    70     CAlfLayout* mSliderLayout ; // stores visual of the slider widget
       
    71     
       
    72     // Can be null when the template doesnt have counter.
       
    73     CAlfTextVisual* mCounterVisual ;
       
    74     CAlfTextVisual* mEmptyTextVisual;
       
    75     
       
    76     //Stores current slider opacity. 
       
    77     float mSliderOpacity;
       
    78     TItemScroll mScrollDir;
       
    79     float mEmptyTextOpacity;
       
    80     // whether to apply default fit mode(fitinside) or not. 
       
    81     // if false apply default fit mode , else based on the image size.
       
    82     bool mFitMode;
       
    83     
       
    84     // different visuals color properties
       
    85     TMulVisualColorProperty mIconBgColor;
       
    86     TMulVisualColorProperty mCounterColor;
       
    87     TMulVisualColorProperty mTextColor;
       
    88     TMulRotationProperty mRotation;
       
    89 
       
    90 	bool mChangeSize;
       
    91 	// whether user has swiped multiple times.
       
    92 	TNumberofSwipes mNumSwipes;
       
    93 	// total number of digits in counter visual at every highlight.
       
    94 	int mNumOfDigitsInCounter;
       
    95 	// marquee animation time
       
    96 	int mMarqueeAnimTime;
       
    97 	// Titletext extents
       
    98 	TSize mTitleExt;
       
    99 	// Detailtext extents
       
   100 	TSize mDetailExt;
       
   101 	//Dummy text visual for getting text extents
       
   102 	CAlfTextVisual* mDummyVisual;
       
   103 	bool mIsMirrored;
       
   104 	
       
   105 	//Constructor of the structure
       
   106 	TMulBaseElementImpl()
       
   107 		{
       
   108 		//Intialisation
       
   109 		mPadding                 = -1;   
       
   110 		mNumOfDigitsInCounter    = -1;
       
   111 		mVisibleCount            = 0;
       
   112 		mScrollAnimationTime     = 200;
       
   113 		mEmptyText 	= "";
       
   114 		mCounterVisual = NULL;
       
   115 		mIconFlowLayout = NULL;
       
   116 		mTextLayout = NULL;
       
   117 	    mVerticalFlow = NULL;
       
   118 	    mSliderLayout = NULL;
       
   119 	    mEmptyTextVisual = NULL;
       
   120 	    mSliderOpacity = 0.0f;
       
   121 	    mTextVisible   = true;
       
   122 	    mScrollDir = EItemNoDirection;
       
   123 	    mEmptyTextOpacity = 0.0f;
       
   124 	    mFitMode = false;
       
   125 	    mUiOn = false;
       
   126 	    mChangeSize = false;
       
   127 	    mNumSwipes = ESingleSwipe;
       
   128 	    mMarqueeAnimTime = 0;
       
   129 	    mDummyVisual = NULL;
       
   130 	    mIsMirrored = false;
       
   131 		}
       
   132 	~TMulBaseElementImpl()
       
   133 		{		
       
   134 		}
       
   135     }; //end of the structure
       
   136 
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // MulBaseElement
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 MulBaseElement::MulBaseElement( CAlfWidgetControl& aControl,
       
   143 			                    const char* aName )
       
   144     {
       
   145     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MulBaseElement");
       
   146     mData.reset( new (EMM)TMulBaseElementImpl );
       
   147     //Call the base class method      
       
   148     construct( aControl,aName );
       
   149     CreateBaseLayoutStructure();
       
   150     (static_cast<MulCoverFlowControl&>(aControl)).UpdateBaseElement(this);
       
   151     if (AknLayoutUtils::LayoutMirrored())
       
   152     	{
       
   153     	mData->mIsMirrored = true;
       
   154     	}
       
   155     else
       
   156 		{
       
   157 		mData->mIsMirrored = false;
       
   158 		}
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // ~MulBaseElement
       
   163 // ---------------------------------------------------------------------------
       
   164 //	
       
   165 MulBaseElement::~MulBaseElement()
       
   166     {
       
   167     // Nothing to delete .
       
   168     }
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 // accept
       
   172 // ---------------------------------------------------------------------------
       
   173 //	
       
   174 bool MulBaseElement::accept( CAlfWidgetControl& /*aControl*/,
       
   175 		                     const TAlfEvent& aEvent ) const
       
   176      {
       
   177      MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::accept");
       
   178      uint eventID; 
       
   179      if(!aEvent.IsCustomEvent())
       
   180        {
       
   181        return false;
       
   182        }
       
   183     eventID = aEvent.CustomParameter();
       
   184 
       
   185     //Events handled by the base element
       
   186 	if( eventID == ETypeHighlight 
       
   187 			|| eventID == EEventWidgetInitialized 
       
   188 			|| eventID == ETypePrimaryValueChange )
       
   189         {
       
   190         return true;
       
   191         }
       
   192     else
       
   193         {
       
   194         return false;	
       
   195         }
       
   196     }
       
   197 
       
   198 // ---------------------------------------------------------------------------
       
   199 // offerEvent
       
   200 // ---------------------------------------------------------------------------
       
   201 //	
       
   202 AlfEventStatus MulBaseElement::offerEvent( CAlfWidgetControl& aControl,
       
   203 			const TAlfEvent& aEvent )
       
   204     {
       
   205     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::offerEvent");
       
   206     if ( !accept( aControl, aEvent ) )
       
   207         {
       
   208         //return false;
       
   209 		return EEventNotHandled;
       
   210         }
       
   211     
       
   212     uint eventID = aEvent.CustomParameter();
       
   213     
       
   214     MulCoverFlowControl* coverflowControl = static_cast<MulCoverFlowControl*>(&control());
       
   215       
       
   216     if( eventID == EEventWidgetInitialized )
       
   217         {
       
   218         // some of the member variable needs to be reset
       
   219         // to support dynamic template change with model change.
       
   220         mData->mNumOfDigitsInCounter = -1;
       
   221         
       
   222         UpdateTextAndCounter();
       
   223         CalculatePadding();
       
   224         ArrangeItems();
       
   225 		// Show empty text if coverflow is empty
       
   226 	    int totalModelCount = coverflowControl->TotalModelCount();
       
   227 	    IMulModelAccessor* model = coverflowControl->ModelAccessor(); 
       
   228 	    if( (totalModelCount <= 0) || (model == NULL))
       
   229 	        {
       
   230 	        ShowEmptyText( true );
       
   231 	        return EEventConsumed;
       
   232 	        }
       
   233 	    else
       
   234 	    	{
       
   235 	    	ShowEmptyText( false );
       
   236 	    	} 		
       
   237  		return EEventConsumed;
       
   238         }
       
   239         
       
   240     else if( eventID == ETypeHighlight )
       
   241         {
       
   242         // Update the text and counter values according to the new highlight
       
   243         int newHighlight = coverflowControl->HighlightIndex(); 
       
   244         int animationTime = aEvent.CustomEventData();
       
   245         animationTime = animationTime > 0 ? animationTime : mData->mScrollAnimationTime;
       
   246 
       
   247         if(mData->mScrollDir != EItemNoDirection)
       
   248             {
       
   249             if(coverflowControl->IsFastScrollMode())
       
   250 	            {
       
   251 	            animationTime = coverflowControl->FastScrollTransitionTime();
       
   252 	            SetHighlight(newHighlight,animationTime);   	
       
   253 	            }
       
   254             else
       
   255 	            {
       
   256 	            SetHighlight(newHighlight,animationTime );   	
       
   257 	            }
       
   258             }
       
   259         else
       
   260             {
       
   261             //@TODO: update all the items 
       
   262             animationTime = KZeroAnimation;
       
   263             SetHighlight(newHighlight,animationTime);    
       
   264             }
       
   265         
       
   266         UpdateTextAndCounter(animationTime);
       
   267             
       
   268 		return EEventConsumed;
       
   269         }
       
   270     else if( eventID == ETypePrimaryValueChange )
       
   271     	{
       
   272  		IMulSliderModel* mulSliderModel = coverflowControl->GetSliderModel();
       
   273  		if( mulSliderModel )
       
   274 	        {
       
   275 	    	int primaryValue = mulSliderModel->PrimaryValue();
       
   276 	  	    coverflowControl->SetHighlightIndex( primaryValue , false);
       
   277     	    }
       
   278 		return EEventConsumed;
       
   279     	}
       
   280     	 	
       
   281 	return EEventNotHandled;    
       
   282     }
       
   283 
       
   284 // ---------------------------------------------------------------------------
       
   285 // setActiveStates
       
   286 // ---------------------------------------------------------------------------
       
   287 //	
       
   288 void MulBaseElement::setActiveStates( unsigned int /*aStates*/ )
       
   289     {
       
   290     //No implementation required
       
   291     }
       
   292 
       
   293 //----------------- Creating the visuals and layout structure ----------------
       
   294 
       
   295 
       
   296 // ---------------------------------------------------------------------------
       
   297 // CreateBaseLayoutStructure
       
   298 // ---------------------------------------------------------------------------
       
   299 //	
       
   300 void  MulBaseElement::CreateBaseLayoutStructure()
       
   301 	{
       
   302 	THROW_IF_LEAVES
       
   303 	( 
       
   304 	 MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateBaseLayoutStructure");
       
   305 	   
       
   306 	 CAlfLayout* main = CAlfLayout::AddNewL(control()); 
       
   307     
       
   308      // set this flag, to recieve layout change events ,that are handled 
       
   309 	 // by the ovverriden VisualLayoutUpdated method of the alfwidgetcontrol.
       
   310      main->SetFlags( EAlfVisualFlagLayoutUpdateNotification );
       
   311      main->SetTagL( mainlayout );
       
   312      main->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
       
   313 	 main->SetClipping(ETrue); 
       
   314      
       
   315     CAlfDeckLayout* deckLayout = CAlfDeckLayout::AddNewL( (CAlfControl &)control(),main);
       
   316     deckLayout->SetTagL( decklayout );
       
   317     deckLayout->SetFlag( EAlfVisualFlagManualLayout );
       
   318     
       
   319     CAlfGradientBrush* deckBrush = CAlfGradientBrush::NewL( control().Env() );
       
   320     // Set the brush colour
       
   321     deckBrush->SetColor( KRgbBlack );
       
   322     deckLayout->EnableBrushesL( ETrue );
       
   323     // Apply brush and set the opacity .
       
   324     deckLayout->Brushes()->AppendL( deckBrush, EAlfHasOwnership ); 
       
   325     deckLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
       
   326 	deckLayout->SetClipping(ETrue);
       
   327     
       
   328     
       
   329     // Create a vertical flow layout which has two horizontal layouts 
       
   330     mData->mVerticalFlow = CAlfFlowLayout::AddNewL((CAlfControl&)control(), deckLayout );
       
   331 
       
   332     // Set the Layout Direction
       
   333     mData->mVerticalFlow->SetFlowDirection( CAlfFlowLayout::EFlowVertical );
       
   334     mData->mVerticalFlow->SetFlag( EAlfVisualFlagManualLayout );
       
   335     mData->mVerticalFlow->SetTagL( verticalflowlayout );
       
   336     mData->mVerticalFlow->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
       
   337 
       
   338     // Create flow layout,all the item visuals are added to this layout.
       
   339     // make this layout as the child to the vertical flow layout at index 1.
       
   340     mData->mIconFlowLayout = CAlfFlowLayout::AddNewL( (CAlfControl&)control(), mData->mVerticalFlow );
       
   341    
       
   342     // Set the Layout Direction
       
   343     mData->mIconFlowLayout->SetFlowDirection( CAlfFlowLayout::EFlowHorizontal );
       
   344     mData->mIconFlowLayout->SetTagL( iconflowlayout );
       
   345     mData->mIconFlowLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
       
   346     
       
   347     // stores visuals of all the items(text visuals) 
       
   348     mData->mTextLayout = CAlfLayout::AddNewL((CAlfControl&)control(),mData->mVerticalFlow);
       
   349     mData->mTextLayout->SetTagL( textflowlayout );
       
   350     mData->mTextLayout->SetFlag(EAlfVisualFlagIgnorePointer);
       
   351     mData->mTextLayout->SetFlag( EAlfVisualFlagManualLayout );    
       
   352     mData->mTextLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
       
   353     //Add main layout to the base visual tree
       
   354     addVisualTree( main, KInitialvalueZero );
       
   355     
       
   356      );       
       
   357 	}
       
   358 
       
   359 // ---------------------------------------------------------------------------
       
   360 // SetDefaultSize
       
   361 // ---------------------------------------------------------------------------
       
   362 //
       
   363 void MulBaseElement::SetDefaultSize( TSize aSize )
       
   364 	{
       
   365 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetDefaultSize");
       
   366 	CAlfLayout* main  = (CAlfLayout*)findVisual( KMainLayoutIndex );
       
   367 	main->SetSize(aSize );
       
   368 	CAlfDeckLayout& deckLayout = static_cast<CAlfDeckLayout&> (main->Visual(KMainLayoutIndex) );
       
   369 	deckLayout.SetSize(aSize);
       
   370 	CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual);
       
   371     if(backgroundVisual)
       
   372 		{
       
   373 		backgroundVisual->SetSize(aSize);				
       
   374 		}	
       
   375 	if( mData->mEmptyTextVisual && mData->mEmptyTextOpacity == 1 )
       
   376 		{
       
   377 		mData->mEmptyTextVisual->SetSize(aSize);		
       
   378 		}
       
   379 	}
       
   380 
       
   381 // ---------------------------------------------------------------------------
       
   382 // TextAnchorLayout
       
   383 // ---------------------------------------------------------------------------
       
   384 //	        
       
   385 CAlfLayout& MulBaseElement::TextLayout()
       
   386 	{
       
   387 	__MUL_ASSERT( mData->mTextLayout != 0,KNullPointer);
       
   388 	return *mData->mTextLayout;
       
   389 	}
       
   390 
       
   391   
       
   392 //----------------------Empty text related visualisation---------------------
       
   393 // ---------------------------------------------------------------------------
       
   394 // SetEmptyText
       
   395 // ---------------------------------------------------------------------------
       
   396 //
       
   397 void MulBaseElement::SetEmptyText( const UString& aDefaultText )
       
   398 	{
       
   399 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetEmptyText");
       
   400 
       
   401 	mData->mEmptyText = aDefaultText;
       
   402 	int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount();
       
   403 
       
   404 	if( mData->mEmptyTextVisual )
       
   405 		{
       
   406 		THROW_IF_LEAVES
       
   407 		 ( 
       
   408 		  TBuf<KTempBufferSize> desc; 
       
   409 		   
       
   410 		  MulModelUtility::ConvertUStringToTDes(mData->mEmptyText, desc);   
       
   411 		  mData->mEmptyTextVisual->SetTextL(desc);
       
   412 		 );
       
   413 		}
       
   414 		
       
   415     if( totalModelCount <= KInitialvalueZero )
       
   416         {
       
   417         ShowEmptyText( true );
       
   418         }
       
   419 	}
       
   420 
       
   421 // ---------------------------------------------------------------------------
       
   422 // ShowEmptyText
       
   423 // ---------------------------------------------------------------------------
       
   424 //
       
   425 void MulBaseElement::ShowEmptyText( bool aShowText  )
       
   426     {
       
   427     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowEmptyText");
       
   428     	
       
   429      // If the application has not set any empty text , then no need to do anything 
       
   430     if( mData->mEmptyText.isEmpty() )
       
   431     	{
       
   432     	if( aShowText )
       
   433     		{
       
   434     		ShowHideVisualsForEmptyText(false);
       
   435     		HandleSizeChangeOnMain();
       
   436     		}
       
   437     	else
       
   438     		{
       
   439     		ShowHideVisualsForEmptyText(true);
       
   440     		}
       
   441     	return;
       
   442     	}
       
   443     	
       
   444     if( aShowText )
       
   445     	{
       
   446     	if( !mData->mEmptyTextVisual )
       
   447     		{
       
   448     		CreateEmptyTextVisualisation();		
       
   449     		}
       
   450     		    	
       
   451     	// This function is called twice only when an empty model is set and the app sets the empty text twice .	
       
   452     	ShowHideVisualsForEmptyText(false);	
       
   453     	if( mData->mEmptyTextOpacity == KBackGroundOpacity && mData->mEmptyTextVisual )
       
   454     		{
       
   455 	    	mData->mEmptyTextVisual->SetOpacity(KHighlightOpacity);
       
   456 	    	mData->mEmptyTextOpacity = KHighlightOpacity;
       
   457 	    	}
       
   458     	HandleSizeChangeOnMain();
       
   459 	    	
       
   460     	}
       
   461     else
       
   462     	{
       
   463     	ShowHideVisualsForEmptyText(true);
       
   464     	if( mData->mEmptyTextVisual && mData->mEmptyTextOpacity == 1 )
       
   465     		{
       
   466     		mData->mEmptyTextVisual->SetOpacity(KBackGroundOpacity);
       
   467     		mData->mEmptyTextOpacity = KBackGroundOpacity;
       
   468     		}
       
   469     	}
       
   470     }
       
   471  
       
   472 // ---------------------------------------------------------------------------
       
   473 // HandleSizeChangeOnMain()
       
   474 // ---------------------------------------------------------------------------
       
   475 // 
       
   476 void  MulBaseElement::HandleSizeChangeOnMain()
       
   477 	{
       
   478 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleSizeChangeOnMain");
       
   479 
       
   480 	IMulModelAccessor* model = ((MulCoverFlowControl*)&control())->ModelAccessor(); 
       
   481 	CAlfLayout* main  = (CAlfLayout*)findVisual( KMainLayoutIndex );
       
   482 	TSize topLayoutSize = main->Size().Target().AsSize(); ;
       
   483 	
       
   484 	if( !model )
       
   485 		{
       
   486 		if (topLayoutSize != TSize(0,0))
       
   487 			{
       
   488 			SetDefaultSize(topLayoutSize);
       
   489 			}
       
   490 		else
       
   491 			{
       
   492 			SetDefaultSize( control().DisplayArea().Size() );
       
   493 			}
       
   494 			
       
   495 		}
       
   496 	else
       
   497 	    {
       
   498 	    SetDefaultSize(topLayoutSize);		
       
   499 	    }
       
   500 	}
       
   501 
       
   502 // ---------------------------------------------------------------------------
       
   503 // IsEmptyText
       
   504 // ---------------------------------------------------------------------------
       
   505 // 
       
   506 bool  MulBaseElement::IsEmptyText()
       
   507 	{
       
   508 	return !(mData->mEmptyText.isEmpty());
       
   509 	}  
       
   510 // ---------------------------------------------------------------------------
       
   511 // ShowHideVisualsForEmptyText
       
   512 // ---------------------------------------------------------------------------
       
   513 // 
       
   514 void  MulBaseElement::ShowHideVisualsForEmptyText( bool aShow )
       
   515 	{
       
   516 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowHideVisualsForEmptyText");
       
   517 
       
   518 	if( !aShow )
       
   519 		{
       
   520 		SetTextVisualOpacity( KBackGroundOpacity );
       
   521 		SetCounterTextOpacity( KBackGroundOpacity);   
       
   522 		}
       
   523 	else 
       
   524 		{
       
   525 		if(mData->mTextVisible)
       
   526 			{
       
   527 			SetTextVisualOpacity( KHighlightOpacity );	
       
   528 			}		
       
   529 		// if ui on off template is enabled then reset the counter 
       
   530 		// opacity depending on the current ui on/off value
       
   531 		if( Template2D()->IsUiOnOffFlagEnabled() )
       
   532 			{
       
   533 			ResetUiOnOff();	
       
   534 			}
       
   535 		else
       
   536 			{
       
   537 			SetCounterTextOpacity( KHighlightOpacity);   
       
   538 			}	
       
   539 		}
       
   540 	}
       
   541 	
       
   542 // ---------------------------------------------------------------------------
       
   543 // CreateEmptyTextVisualisation
       
   544 // ---------------------------------------------------------------------------
       
   545 //	
       
   546 void MulBaseElement::CreateEmptyTextVisualisation() 
       
   547 	{
       
   548 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateEmptyTextVisualisation");
       
   549  
       
   550 	if( !mData->mEmptyTextVisual )
       
   551 		{
       
   552 		THROW_IF_LEAVES
       
   553 		 ( 
       
   554 		 	CAlfLayout* main = static_cast<CAlfLayout*>(findVisual( KMainLayoutIndex ));
       
   555 		    mData->mEmptyTextVisual = CAlfTextVisual::AddNewL(control(),main);
       
   556 		    
       
   557 		    TBuf<KTempBufferSize> desc; 
       
   558 		   
       
   559 		    MulModelUtility::ConvertUStringToTDes(mData->mEmptyText, desc);   
       
   560 		    mData->mEmptyTextVisual->SetTextL(desc);
       
   561 		    mData->mEmptyTextVisual->SetTagL(KEmptyText);
       
   562 		    mData->mEmptyTextVisual->SetWrapping(CAlfTextVisual::ELineWrapBreak);
       
   563 		       
       
   564 		    TInt fontId =control().Env().TextStyleManager()
       
   565 				.CreatePlatformTextStyleL(EAknLogicalFontSecondaryFont,-1);	
       
   566 		    // check if user has set any different color for text.
       
   567 			if (mData->mTextColor.mIsColorSet)
       
   568 				{
       
   569 				// apply the color set by the application
       
   570 				mData->mEmptyTextVisual->SetColor(mData->mTextColor.mColor);
       
   571 				}
       
   572 			else
       
   573 				{
       
   574 				// apply the default color
       
   575 				mData->mEmptyTextVisual->SetColor(KRgbWhite);
       
   576 				}
       
   577 			
       
   578 			mData->mEmptyTextVisual->SetLineSpacing(KTextRowsz);
       
   579 			mData->mEmptyTextVisual->SetTextStyle(fontId);
       
   580 		    mData->mEmptyTextVisual->SetFlag(EAlfVisualFlagIgnorePointer);
       
   581 		 );
       
   582 		
       
   583 		}
       
   584     }
       
   585 
       
   586 
       
   587 
       
   588 // ---------------------------------------------------------------------------
       
   589 // DisplayIndicatorIcon
       
   590 // ---------------------------------------------------------------------------
       
   591 // 
       
   592 void MulBaseElement::DisplayIndicatorIcon(const MulVisualItem & aVisualItem, int aIndex)
       
   593     {
       
   594     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::DisplayIndicatorIcon");
       
   595     CAlfDeckLayout& layout = static_cast<CAlfDeckLayout&>(mData->mIconFlowLayout->Visual(aIndex));
       
   596     CAlfImageVisual* visual =static_cast<CAlfImageVisual*>(layout.FindTag(KCoverflowIndicator));    
       
   597     IMulVariantType* varData = aVisualItem.Attribute(mulvisualitem::KMulIndicator2); 
       
   598     
       
   599     if(varData)
       
   600         {
       
   601         if(!visual)
       
   602             {
       
   603             visual = CreateIndicatorIconVisual(layout);   
       
   604             }
       
   605         ((MulCoverFlowControl*)&control())->DoSetImage(varData,visual);
       
   606         visual->ClearFlag(EAlfVisualFlagIgnorePointer);
       
   607         }
       
   608 
       
   609     else if(visual)
       
   610         {
       
   611         CAlfTextureManager& textureMgr = control().Env().TextureManager();
       
   612         TAlfImage image = TAlfImage(textureMgr.BlankTexture()); 
       
   613         visual->SetImage(image); 
       
   614         visual->SetFlag(EAlfVisualFlagIgnorePointer);
       
   615         }
       
   616 
       
   617     }
       
   618  
       
   619 // ---------------------------------------------------------------------------
       
   620 // CreateIndicatorIconVisual
       
   621 // ---------------------------------------------------------------------------
       
   622 //    
       
   623 CAlfImageVisual*  MulBaseElement::CreateIndicatorIconVisual(CAlfDeckLayout& aLayout) 
       
   624     {
       
   625     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateIndicatorIconVisual");
       
   626     CAlfImageVisual* indicatorVisual = CAlfImageVisual::AddNewL(control(), &aLayout);
       
   627     indicatorVisual->SetTagL(KCoverflowIndicator); 
       
   628     SetIndicatorDimensions(*indicatorVisual);
       
   629     indicatorVisual->SetScaleMode(CAlfImageVisual::EScaleNormal);
       
   630     
       
   631     return indicatorVisual;
       
   632     }
       
   633 
       
   634 // ---------------------------------------------------------------------------
       
   635 // SetIndicatorDimensions
       
   636 // ---------------------------------------------------------------------------
       
   637 //  
       
   638 void  MulBaseElement::SetIndicatorDimensions(CAlfImageVisual& aIndicatorVisual)
       
   639     {
       
   640     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetIndicatorDimensions");
       
   641     TMulCoverFlowItem indicatorDimensions = Template2D()->IndicatorDimension();
       
   642     aIndicatorVisual.SetPos(TAlfRealPoint(indicatorDimensions.posx,indicatorDimensions.posy));
       
   643     aIndicatorVisual.SetSize(TAlfRealSize(indicatorDimensions.width ,indicatorDimensions.height));    
       
   644     }
       
   645     
       
   646 // ---------------------------------------------------------------------------
       
   647 // StoreVisualDimensions
       
   648 // ---------------------------------------------------------------------------
       
   649 // 
       
   650 void MulBaseElement::StoreVisualDimensions( TMulCoverFlowItem aHighlightItemDimensions, TMulCoverFlowItem aNonHighlightItemDimensions,int aVisibleIconCount )
       
   651  	{
       
   652  	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StoreVisualDimensions");
       
   653  	mData->mHighlightItemStruct = aHighlightItemDimensions;
       
   654 	mData->mItemStruct = aNonHighlightItemDimensions;
       
   655 	mData->mVisibleCount = aVisibleIconCount;
       
   656 	((MulCoverFlowControl*)&control())->StoreVisibleItemCount(mData->mVisibleCount);
       
   657 	if (mData->mVisibleCount > 1)
       
   658 		{
       
   659 		mData->mChangeSize = true;	
       
   660 		}
       
   661 	else
       
   662 		{
       
   663 		mData->mChangeSize = false;	
       
   664 		}
       
   665  	}
       
   666 
       
   667 // ---------------------------------------------------------------------------
       
   668 // StoreTextVisibility
       
   669 // ---------------------------------------------------------------------------
       
   670 //	
       
   671 void MulBaseElement::StoreTextVisibility( bool aIsTextVisible )
       
   672 	{
       
   673 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StoreTextVisibility");
       
   674 	mData->mTextVisible = aIsTextVisible;
       
   675 	}
       
   676 
       
   677 
       
   678 // ---------------------------------------------------------------------------
       
   679 // IsTextVisibile
       
   680 // ---------------------------------------------------------------------------
       
   681 //  
       
   682 bool MulBaseElement::IsTextVisibile( )const
       
   683     {
       
   684     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::IsTextVisible");
       
   685     return mData->mTextVisible ;
       
   686     }
       
   687 
       
   688 
       
   689 // ---------------------------------------------------------------------------
       
   690 // OrientationChange
       
   691 // ---------------------------------------------------------------------------
       
   692 //
       
   693 void MulBaseElement::OrientationChange()
       
   694 	{
       
   695 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::OrientationChange");
       
   696 
       
   697 	mData->mVerticalFlow->SetOpacity(0);
       
   698 	if (mData->mDummyVisual)
       
   699 		{
       
   700 		// deleting since the textextents being zero.
       
   701 		mData->mDummyVisual->RemoveAndDestroyAllD();
       
   702 		mData->mDummyVisual = NULL;
       
   703 		}
       
   704 
       
   705 	// update the attribute of visuals
       
   706 	Template2D()->CreateVisualisation(((MulCoverFlowControl*)&control())->IsLandscape(),true);
       
   707     
       
   708     CalculatePadding();    
       
   709     CreateAndInitializeVisuals(true);
       
   710 	
       
   711 	// Redraw the visuals after orientation changes
       
   712 	int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount();    		
       
   713 	if( totalModelCount == 0 )
       
   714 		{
       
   715 		CAlfLayout* main  = (CAlfLayout*)findVisual( KMainLayoutIndex );
       
   716 		SetDefaultSize(main->Size().ValueNow().AsSize());		
       
   717 		}
       
   718 	ArrangeItems();
       
   719 	SetNewCounterPosition(Template2D()->CounterDimensions(),true);
       
   720 	UpdateRotation();
       
   721 	mData->mVerticalFlow->SetOpacity(1);   
       
   722 	}
       
   723 
       
   724 
       
   725 //------------------Counter and Text related----------------------------------
       
   726 
       
   727 // ---------------------------------------------------------------------------
       
   728 // CreateCounterVisual
       
   729 // ---------------------------------------------------------------------------
       
   730 // 
       
   731 CAlfTextVisual& MulBaseElement::CounterVisual()
       
   732     {
       
   733     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CounterVisual");
       
   734    	__MUL_ASSERT( mData->mVerticalFlow != 0,KNullPointer);
       
   735 
       
   736     mData->mCounterVisual = &CreateTextVisual(KCoverflowCounter,*mData->mVerticalFlow);
       
   737     mData->mCounterVisual->SetAlign(EAlfAlignHCenter,EAlfAlignVCenter);
       
   738 	return *mData->mCounterVisual;
       
   739     }
       
   740 
       
   741 // ---------------------------------------------------------------------------
       
   742 // CreateVisual
       
   743 // ---------------------------------------------------------------------------
       
   744 // 
       
   745 CAlfTextVisual& MulBaseElement::CreateTextVisual(const TDesC8& aName, 
       
   746         CAlfLayout& aLayout) 
       
   747 	{
       
   748 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateTextVisual");
       
   749 	
       
   750 	CAlfTextVisual* textVisual =static_cast<CAlfTextVisual*>(aLayout.FindTag(aName));
       
   751 
       
   752 	if(textVisual == NULL)
       
   753 	   {
       
   754 	   THROW_IF_LEAVES
       
   755 	        (
       
   756 	   		textVisual = CAlfTextVisual::AddNewL( (CAlfControl &)control(),&aLayout); 
       
   757 	        textVisual->SetTagL(aName);
       
   758 	        ); 
       
   759 	    textVisual->SetFlag(EAlfVisualFlagIgnorePointer);
       
   760 	    textVisual->SetFlag(EAlfVisualFlagClipping);
       
   761 	   }
       
   762 	return *textVisual;  
       
   763 	}
       
   764     
       
   765     
       
   766 // ---------------------------------------------------------------------------
       
   767 // UpdateTextAndCounter
       
   768 // ---------------------------------------------------------------------------
       
   769 //	
       
   770 void MulBaseElement::UpdateTextAndCounter(int animationTime)
       
   771     {
       
   772     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateTextAndCounter");
       
   773     
       
   774 	UpdateTextValue(animationTime);	
       
   775     
       
   776     //After highlight is changed then the counter text should be updated
       
   777     SetCounterText();
       
   778     } 
       
   779     
       
   780 // ---------------------------------------------------------------------------
       
   781 // SetCounterTextOpacity
       
   782 // ---------------------------------------------------------------------------
       
   783 //  
       
   784 void MulBaseElement::SetCounterTextOpacity( int aOpacity)
       
   785     {
       
   786     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetCounterTextOpacity");
       
   787     if(mData->mCounterVisual)
       
   788         {
       
   789         mData->mCounterVisual->SetOpacity( aOpacity ); 		
       
   790         }	    
       
   791 	}
       
   792 
       
   793     
       
   794 // ---------------------------------------------------------------------------
       
   795 // ResetUiOnOff
       
   796 // ---------------------------------------------------------------------------
       
   797 //	
       
   798 void MulBaseElement::ResetUiOnOff(int aTransitionTime)
       
   799     {
       
   800     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ResetUiOnOff");
       
   801     
       
   802 	int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount();
       
   803     if(mData->mCounterVisual && Template2D() && Template2D()->IsUiOnOffFlagEnabled() && totalModelCount>0 )
       
   804         {
       
   805         int opacity = mData->mUiOn? KHighlightOpacity: KBackGroundOpacity;
       
   806         mData->mCounterVisual->SetOpacity( TAlfTimedValue(opacity,aTransitionTime)  ); 
       
   807         // Every time In template4 Ui on off mode toggles we should set the enable holding flag 
       
   808 		// to gesture helper to recieve the hold events.
       
   809 		((MulCoverFlowControl*)&control())->SetHoldingEnabled(); 
       
   810         }
       
   811     } 
       
   812     
       
   813 // ---------------------------------------------------------------------------
       
   814 // UIOnOffMode
       
   815 // ---------------------------------------------------------------------------
       
   816 //
       
   817 void MulBaseElement::UIOnOffMode(bool aUiOn, int aTransitionTime)
       
   818     {
       
   819     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UIOnOffMode");
       
   820       
       
   821     mData->mUiOn = aUiOn;
       
   822     ResetUiOnOff( aTransitionTime );
       
   823     }
       
   824     
       
   825 // ---------------------------------------------------------------------------
       
   826 // IsUiOnMode
       
   827 // ---------------------------------------------------------------------------
       
   828 //  
       
   829 bool MulBaseElement::IsUiOnMode()
       
   830 	{
       
   831     return mData->mUiOn;	
       
   832 	}
       
   833 
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // SetTextVisualOpacity
       
   837 // ---------------------------------------------------------------------------
       
   838 //
       
   839 void MulBaseElement::SetTextVisualOpacity( int aOpacity , int aTransitionTime )
       
   840 	{
       
   841 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetTextVisualOpacity"); 
       
   842 	if(mData->mTextLayout)
       
   843 		{
       
   844     	mData->mTextLayout->SetOpacity(TAlfTimedValue (aOpacity,aTransitionTime));
       
   845     	}	
       
   846 	}
       
   847 
       
   848 // ---------------------------------------------------------------------------
       
   849 // UpdateTextValue
       
   850 // ---------------------------------------------------------------------------
       
   851 //
       
   852 void MulBaseElement::UpdateTextValue(int aAnimationTime)
       
   853 	{
       
   854 	MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::UpdateTextValue");
       
   855 	if( !mData->mTextVisible )
       
   856     	{
       
   857     	return;
       
   858     	}
       
   859     	
       
   860 	IMulModelAccessor* modelAccessor = ((MulCoverFlowControl*)&control())->ModelAccessor();
       
   861 	int highlightindex = static_cast<MulCoverFlowControl*>(&control())->HighlightIndex();
       
   862     
       
   863 	if(highlightindex>=0  )
       
   864         {
       
   865         //set text to title
       
   866         try
       
   867             {
       
   868 			const MulVisualItem& item = modelAccessor->Item(highlightindex);
       
   869 			IMulVariantType* varData = item.Attribute(mulvisualitem::KMulTitle);
       
   870             MUL_LOG_INFO("MUL::UpdateTextValue::UpdateTiltle");
       
   871             SetTextToVisual( mulvisualitem::KMulTitle, varData  ); 
       
   872             
       
   873             // SetVirtualSize if required.
       
   874             SetVirtualViewPortSize(mulvisualitem::KMulTitle);  
       
   875             }
       
   876         catch(...)
       
   877             {
       
   878             IMulVariantType* varData = NULL;
       
   879             SetTextToVisual( mulvisualitem::KMulTitle, varData  );
       
   880             }
       
   881          
       
   882          //set text to detail
       
   883          try
       
   884             {
       
   885 			const MulVisualItem& item = modelAccessor->Item(highlightindex);
       
   886 			IMulVariantType* varData = item.Attribute(mulvisualitem::KMulDetail);
       
   887             MUL_LOG_INFO("MUL::UpdateTextValue::UpdateDetail");
       
   888             SetTextToVisual( mulvisualitem::KMulDetail, varData );
       
   889             
       
   890             // SetVirtualSize if required.
       
   891             SetVirtualViewPortSize(mulvisualitem::KMulDetail);  
       
   892             }
       
   893         catch(...)
       
   894             {
       
   895             IMulVariantType* varData = NULL;
       
   896             SetTextToVisual( mulvisualitem::KMulDetail,varData );
       
   897             } 
       
   898         
       
   899         // Cancel if any command is in process before start marquee.
       
   900         CancelAllCommands();
       
   901         
       
   902         // Before orientaion change stop marquee on the text
       
   903         if(!((static_cast<MulCoverFlowControl&>(control())).IsFastScrollMode())) 
       
   904             {            
       
   905             control().Env().Send(
       
   906                 TAlfCustomEventCommand(ECustomEventMarqueeStart, 
       
   907                 &control()), KMarqueeTime1000 + aAnimationTime);
       
   908             
       
   909             }
       
   910         }
       
   911 	}
       
   912 // ---------------------------------------------------------------------------
       
   913 // SetTextToVisual
       
   914 // ---------------------------------------------------------------------------
       
   915 //
       
   916 void MulBaseElement::SetTextToVisual( mulvisualitem::TVisualAttribute aName,IMulVariantType* aText )
       
   917 	{
       
   918 	MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::SetTextToVisual");
       
   919 
       
   920 	if(mData->mTextLayout)
       
   921 		{
       
   922 		CAlfTextVisual* textVisual = 
       
   923 			static_cast<CAlfTextVisual*> (mData->mTextLayout->FindTag( IdToTag(aName) ));
       
   924 
       
   925 		if(textVisual)
       
   926 			{
       
   927 			if ( aText )
       
   928 				{  
       
   929 				// set text to visual
       
   930 				THROW_IF_LEAVES
       
   931 					(
       
   932 					MUL_LOG_INFO("MUL::SetTextToVisual::Set New Data");
       
   933 					textVisual->SetTextL(aText->DesC());
       
   934 					textVisual->SetWrapping(CAlfTextVisual::ELineWrapTruncate);
       
   935 					);
       
   936 				    // A workaround till the text visual starts giving the correct text extents value.
       
   937 		            if(!mData->mDummyVisual)
       
   938 		                {
       
   939 		                mData->mDummyVisual = CAlfTextVisual::AddNewL(control(), NULL);
       
   940 		                mData->mDummyVisual->SetWrapping(CAlfTextVisual::ELineWrapManual);
       
   941 		                mData->mDummyVisual->SetOpacity(0);
       
   942 		                mData->mDummyVisual->SetFlags(EAlfVisualFlagIgnorePointer);
       
   943 		                }
       
   944 		            
       
   945 		            // Setting the style same as our text visual.
       
   946 		            mData->mDummyVisual->SetTextStyle(textVisual->TextStyle()); 
       
   947 		            mData->mDummyVisual->SetTextL(aText->DesC()); // Setting the text
       
   948 		            	        
       
   949 		            if(aName == mulvisualitem::KMulDetail)
       
   950 		                {
       
   951 		                mData->mDetailExt = mData->mDummyVisual->TextExtents();
       
   952 		                }
       
   953 		            else
       
   954 		                {
       
   955 		                mData->mTitleExt = mData->mDummyVisual->TextExtents();
       
   956 		                }
       
   957 				}
       
   958 			else
       
   959 				{
       
   960 				// reset to null value .
       
   961 				THROW_IF_LEAVES
       
   962 					(
       
   963 					textVisual->SetTextL(_L(""));
       
   964 					);
       
   965 				}
       
   966 			}
       
   967 		else
       
   968 			{
       
   969 			mData->mTextLayout->SetOpacity(TAlfTimedValue(KBackGroundOpacity,0));   
       
   970 			}   
       
   971 		}
       
   972 	}
       
   973 
       
   974 // ---------------------------------------------------------------------------
       
   975 // SetVirtualViewPortSize()
       
   976 // ---------------------------------------------------------------------------
       
   977 //    
       
   978 void MulBaseElement::SetVirtualViewPortSize(mulvisualitem::TVisualAttribute aName)
       
   979     {
       
   980     MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::SetVirtualViewPortSize");
       
   981 	CAlfViewportLayout* viewportLayout = NULL ;
       
   982 	CAlfTextVisual* text = NULL ;
       
   983 	TSize textExtent ;
       
   984 	TSize parentSize;
       
   985 	if (aName == mulvisualitem::KMulDetail)
       
   986 	    {
       
   987 	    viewportLayout = static_cast<CAlfViewportLayout*>(
       
   988 	            mData->mTextLayout->FindTag(KDetailViewPortLayout));
       
   989 	    if(!viewportLayout)
       
   990 	        {
       
   991 	        return; // return if no viewport
       
   992 	        }
       
   993         textExtent = mData->mDetailExt;
       
   994         parentSize = Template2D()->DetailWindowSize();
       
   995 	          
       
   996 	    }
       
   997 	else
       
   998 	    {
       
   999 	    viewportLayout = static_cast<CAlfViewportLayout*>(
       
  1000 	            mData->mTextLayout->FindTag(KTitleViewPortLayout));
       
  1001 	    if(!viewportLayout)
       
  1002 	        {
       
  1003 	        return; // return if no viewport
       
  1004 	        }
       
  1005        textExtent = mData->mTitleExt;
       
  1006        parentSize = Template2D()->TitleWindowSize();
       
  1007 	        
       
  1008 	    }
       
  1009 	text = static_cast<CAlfTextVisual*>(
       
  1010 	        viewportLayout->FindTag( IdToTag(aName) ));
       
  1011 	if(!text)
       
  1012 	    {
       
  1013 	    return; // if text visual is not found we will not set viewportsize.
       
  1014 	    }
       
  1015 	
       
  1016 	viewportLayout->SetViewportPos((TAlfRealPoint(0, 0)), 0);
       
  1017     viewportLayout->SetVirtualSize(
       
  1018             (TAlfRealPoint(parentSize.iWidth, parentSize.iHeight)),0);   
       
  1019 	
       
  1020 	//Tollerance is 15 pixel, it might happen that
       
  1021 	// the text is big but while wrapping it not filling the whole
       
  1022 	// width of the layout because the remaining space is less to
       
  1023 	// accomodate a character.
       
  1024 	// As for QFN_PRIMARY the max character width is 15 pixel
       
  1025 	// so I am keeping tollerance as 15 
       
  1026 	// @TODO: Insted of hard coding to 15 pixel use max charecter 
       
  1027 	// width for QFN_PRIMARY.
       
  1028 	if ((parentSize.iWidth - textExtent.iWidth) > 15)
       
  1029 		{
       
  1030 		text->SetAlign(EAlfAlignHCenter, EAlfAlignVCenter); 	
       
  1031 		}
       
  1032 	else
       
  1033 		{
       
  1034 		text->SetAlign(EAlfAlignHLocale,EAlfAlignVCenter);
       
  1035 		}
       
  1036     }
       
  1037 
       
  1038 // ---------------------------------------------------------------------------
       
  1039 // StartMarquee()
       
  1040 // ---------------------------------------------------------------------------
       
  1041 //
       
  1042 void MulBaseElement::StartMarquee(mulvisualitem::TVisualAttribute aName)
       
  1043     {
       
  1044     MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::StartMarquee");
       
  1045     // start marquee.
       
  1046     int widthOffScreen = 0;
       
  1047     CAlfViewportLayout* viewportLayout = NULL ;
       
  1048     CAlfTextVisual* text =  NULL ;
       
  1049 	TSize textExtent ;
       
  1050 	TSize parentSize;
       
  1051 	int maxCharWidth ;
       
  1052 	if (aName == mulvisualitem::KMulDetail)
       
  1053         {
       
  1054         viewportLayout =static_cast<CAlfViewportLayout*>(
       
  1055                 mData->mTextLayout->FindTag(KDetailViewPortLayout));
       
  1056         if(!viewportLayout)
       
  1057             {
       
  1058             return;// return if no viewport
       
  1059             }                  
       
  1060        textExtent = mData->mDetailExt;
       
  1061        parentSize = Template2D()->DetailWindowSize();
       
  1062        maxCharWidth = Template2D()->DetailMaxCharWidth();         
       
  1063         }
       
  1064     else
       
  1065         {
       
  1066         viewportLayout = static_cast<CAlfViewportLayout*>(
       
  1067                 mData->mTextLayout->FindTag(KTitleViewPortLayout));
       
  1068         if(!viewportLayout)
       
  1069             {
       
  1070             return;// return if no viewport
       
  1071             }
       
  1072        textExtent = mData->mTitleExt;
       
  1073        parentSize = Template2D()->TitleWindowSize();
       
  1074        maxCharWidth = Template2D()->TitleMaxCharWidth();
       
  1075         }
       
  1076 	text = static_cast<CAlfTextVisual*>(
       
  1077 	        viewportLayout->FindTag( IdToTag(aName) ));
       
  1078 	if(!text)
       
  1079 	    {
       
  1080 	    return; // if no text.
       
  1081 	    }
       
  1082 	
       
  1083     text->SetWrapping(CAlfTextVisual::ELineWrapManual);
       
  1084    
       
  1085     widthOffScreen= textExtent.iWidth - parentSize.iWidth;
       
  1086     int nDbMaxChars = (widthOffScreen/(2*maxCharWidth)) + 1;
       
  1087 	          	        
       
  1088     // Schedule a update event, when the visual has finished marquee text scrolling.
       
  1089     if (aName == mulvisualitem::KMulDetail)
       
  1090         {
       
  1091         if (nDbMaxChars > 0 )
       
  1092             {
       
  1093 			viewportLayout->SetVirtualSize(
       
  1094 			        (TAlfRealPoint(textExtent.iWidth, parentSize.iHeight)),0);                  
       
  1095             // to avoid negative time value
       
  1096             mData->mMarqueeAnimTime = (nDbMaxChars*KMarqueeTime1000);
       
  1097             viewportLayout->SetViewportPos((TAlfRealPoint(widthOffScreen , 0)), 
       
  1098                     nDbMaxChars * KMarqueeTime1000);
       
  1099             // delay after completion of the marquee for titlte.
       
  1100             mData->mMarqueeAnimTime += KMarqueeTime1000;
       
  1101             control().Env().Send(
       
  1102                 TAlfCustomEventCommand(ECustomEventMarqueeFinished, 
       
  1103                 static_cast<CAlfControl*>(&(control()))), 
       
  1104                 mData->mMarqueeAnimTime);
       
  1105             }
       
  1106         }
       
  1107     else
       
  1108         {
       
  1109         // reset the marquee animation time
       
  1110         mData->mMarqueeAnimTime = 0;  
       
  1111         if(nDbMaxChars > 0)
       
  1112             {
       
  1113 			viewportLayout->SetVirtualSize(
       
  1114 			        (TAlfRealPoint(textExtent.iWidth, parentSize.iHeight)),0);  
       
  1115             
       
  1116             // to avoid negative time value
       
  1117             mData->mMarqueeAnimTime = (nDbMaxChars*KMarqueeTime1000);  
       
  1118             viewportLayout->SetViewportPos((TAlfRealPoint(widthOffScreen , 0)), 
       
  1119                     nDbMaxChars * KMarqueeTime1000);
       
  1120             // delay after completion of the marquee for titlte.
       
  1121             mData->mMarqueeAnimTime += KMarqueeTime1000;
       
  1122             control().Env().Send(
       
  1123                 TAlfCustomEventCommand(ECustomEventTitleMarqueeFinished, 
       
  1124                 static_cast<CAlfControl*>(&(control()))), 
       
  1125                 mData->mMarqueeAnimTime );
       
  1126             // delay before start the marquee for detail.
       
  1127             mData->mMarqueeAnimTime += KMarqueeTime1000;
       
  1128             }
       
  1129         control().Env().Send(
       
  1130             TAlfCustomEventCommand(ECustomEventDetailMarqueeStart, 
       
  1131             (&(control()))), mData->mMarqueeAnimTime );
       
  1132         }
       
  1133     } 	
       
  1134     
       
  1135 // ---------------------------------------------------------------------------
       
  1136 // StopMarquee()
       
  1137 // ---------------------------------------------------------------------------
       
  1138 //
       
  1139 void MulBaseElement::StopMarquee(mulvisualitem::TVisualAttribute aName)
       
  1140     {
       
  1141     MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::StopMarquee");
       
  1142     CAlfViewportLayout* viewPortLayout = NULL; 
       
  1143     CAlfTextVisual* text = NULL;
       
  1144     TSize parentSize;
       
  1145     if (aName == mulvisualitem::KMulDetail)
       
  1146         {
       
  1147         viewPortLayout =
       
  1148             static_cast<CAlfViewportLayout*>(mData->mTextLayout->FindTag(KDetailViewPortLayout));
       
  1149         parentSize = Template2D()->DetailWindowSize();
       
  1150         }
       
  1151     else
       
  1152         {
       
  1153         viewPortLayout =
       
  1154             static_cast<CAlfViewportLayout*>(mData->mTextLayout->FindTag(KTitleViewPortLayout));
       
  1155         parentSize = Template2D()->TitleWindowSize();
       
  1156         }
       
  1157    if(!viewPortLayout)
       
  1158        {
       
  1159        return;
       
  1160        }
       
  1161    text = static_cast<CAlfTextVisual*>(viewPortLayout->FindTag( IdToTag(aName) ));
       
  1162    if(!text)
       
  1163        {
       
  1164        return;
       
  1165        }
       
  1166    const TDesC textDesc = text->Text();
       
  1167    if(!textDesc.Length())
       
  1168        {
       
  1169        return;
       
  1170        }
       
  1171   
       
  1172     viewPortLayout->SetViewportPos((TAlfRealPoint(0, 0)), 0);
       
  1173     viewPortLayout->SetVirtualSize((TAlfRealPoint(parentSize.iWidth, parentSize.iHeight)),0);   
       
  1174     text->SetWrapping(CAlfTextVisual::ELineWrapTruncate);
       
  1175                
       
  1176     }
       
  1177 
       
  1178 // ---------------------------------------------------------------------------
       
  1179 // CancelAllCommands
       
  1180 // ---------------------------------------------------------------------------
       
  1181 //  
       
  1182 void MulBaseElement::CancelAllCommands( )
       
  1183     {
       
  1184     MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::CancelAllCommands");
       
  1185     CAlfWidgetControl * cntrl = &control();
       
  1186     control().Env().CancelCustomCommands( cntrl, ECustomEventMarqueeFinished);
       
  1187     control().Env().CancelCustomCommands( cntrl, ECustomEventMarqueeStart);
       
  1188     control().Env().CancelCustomCommands( cntrl, ECustomEventTitleMarqueeFinished);
       
  1189     control().Env().CancelCustomCommands( cntrl, ECustomEventDetailMarqueeStart); 
       
  1190     }
       
  1191 
       
  1192 // ---------------------------------------------------------------------------
       
  1193 // SetCounterText
       
  1194 // ---------------------------------------------------------------------------
       
  1195 //	
       
  1196 void MulBaseElement::SetCounterText( int /*aTransitionTime*/ )
       
  1197 	{
       
  1198 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetCounterText");
       
  1199 	   
       
  1200     if( mData->mCounterVisual )
       
  1201     	{
       
  1202     	SetNewCounterPosition(Template2D()->CounterDimensions());
       
  1203     	int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount();
       
  1204     	int currHighlightIndex = ((MulCoverFlowControl*)&control())->HighlightIndex();
       
  1205 		
       
  1206 		// this code will work for model count upto 99999.
       
  1207 		// done for performance improvement , no need to calculate 
       
  1208 		// no of digits in highlight index and total model count.
       
  1209     	auto_ptr<HBufC> countbuffer(HBufC::NewL (12)); 
       
  1210       
       
  1211         //settin value for counter text visual
       
  1212         /// @bug critical:avanhata:7/7/2008 in arabic/hebrew the text should flow
       
  1213         /// from right to left (totalCount / highlight) => the string format needs
       
  1214         /// to come from a resource file, and use stringloader (and arabic indic number
       
  1215         /// conversion if stringloader does not do it automatically)
       
  1216         countbuffer->Des().AppendNum(currHighlightIndex+1);
       
  1217         countbuffer->Des().Append(KSlash);
       
  1218         countbuffer->Des().AppendNum(totalModelCount);
       
  1219 
       
  1220         mData->mCounterVisual->SetTextL(*countbuffer);
       
  1221     	}    
       
  1222 	}
       
  1223 
       
  1224 //--------------------------------------------------------------------------
       
  1225 // SetNewCounterPosition
       
  1226 //--------------------------------------------------------------------------
       
  1227 //
       
  1228 void MulBaseElement::SetNewCounterPosition( const TMulCoverFlowItem& aCounterLctDimension, bool aOrientationChanged)
       
  1229 	{
       
  1230 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetNewCounterPosition");
       
  1231 	MulCoverFlowControl* coverflowControl = ((MulCoverFlowControl*)&control());
       
  1232 	int totalModelCount = coverflowControl->TotalModelCount();
       
  1233 	int currHighlightIndex = coverflowControl->HighlightIndex();
       
  1234 	bool isLandScape = static_cast<MulCoverFlowControl&>(control()).IsLandscape();
       
  1235     
       
  1236     if( totalModelCount > 0 && currHighlightIndex >= 0 )
       
  1237     	{
       
  1238     	int numOfDigits = NumberOfDigits(totalModelCount);
       
  1239     	numOfDigits += NumberOfDigits(currHighlightIndex);
       
  1240    		
       
  1241    		if( mData->mNumOfDigitsInCounter!= numOfDigits || aOrientationChanged )
       
  1242    			{
       
  1243         	mData->mNumOfDigitsInCounter = numOfDigits;
       
  1244         	int maxCharWidth = coverflowControl->Template2D()->CounterMaxCharWidth();
       
  1245         	int numOfPixels = numOfDigits*maxCharWidth + 20; // 10 is the tolerance.
       
  1246   
       
  1247         	int rightPosx =0; 
       
  1248         	int leftPosx = 0;
       
  1249         	// if mirroring is enabled(ie for RTL Language)
       
  1250         	if (mData->mIsMirrored)
       
  1251         		{
       
  1252         			
       
  1253 	        		CAlfLayout* main  = (CAlfLayout*)findVisual( KMainLayoutIndex );
       
  1254 							TSize topLayoutSize = main->Size().Target().AsSize();
       
  1255 							if(!isLandScape)
       
  1256         			{
       
  1257 	        		rightPosx = topLayoutSize.iWidth - aCounterLctDimension.posx ;
       
  1258 	        		leftPosx = rightPosx - numOfPixels;
       
  1259 	        		}
       
  1260 	        		else
       
  1261 	        		{
       
  1262 	        		leftPosx = topLayoutSize.iWidth - aCounterLctDimension.posx  ;
       
  1263 	        		}
       
  1264         		}
       
  1265         	else
       
  1266         		{
       
  1267         				if(!isLandScape)
       
  1268         					{
       
  1269         					rightPosx = aCounterLctDimension.posx + aCounterLctDimension.width; 
       
  1270         					leftPosx = rightPosx - numOfPixels;
       
  1271         					}
       
  1272         				else	
       
  1273         					leftPosx = aCounterLctDimension.posx;
       
  1274         		}
       
  1275 	   		mData->mCounterVisual->SetPos(TAlfRealPoint(leftPosx,aCounterLctDimension.posy));
       
  1276 		    mData->mCounterVisual->SetSize(TAlfRealPoint(numOfPixels ,aCounterLctDimension.height));
       
  1277    			}
       
  1278     	}
       
  1279 	}
       
  1280 // ---------------------------------------------------------------------------
       
  1281 // NumberOfDigits
       
  1282 // ---------------------------------------------------------------------------
       
  1283 //
       
  1284 int MulBaseElement::NumberOfDigits(int aNumber)
       
  1285     {
       
  1286     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::NumberOfDigits");
       
  1287     int num_digits = 0;
       
  1288     int number = aNumber;
       
  1289     do 
       
  1290     	{
       
  1291     	num_digits++;
       
  1292 		number/=10;	
       
  1293     	}
       
  1294     while ( number > 0 );
       
  1295     
       
  1296     return 	num_digits;
       
  1297     }
       
  1298     	
       
  1299 // ---------------------------------------------------------------------------
       
  1300 // ApplyScaleMode
       
  1301 // ---------------------------------------------------------------------------
       
  1302 //
       
  1303 void MulBaseElement::ApplyScaleMode( CAlfImageVisual& aImageVisual)
       
  1304 	{
       
  1305 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ApplyScaleMode");
       
  1306     CAlfImageVisual::TScaleMode scaleMode; 
       
  1307 
       
  1308     if (mData->mFitMode)
       
  1309 	    {
       
  1310 	    if(aImageVisual.Image().HasTexture())
       
  1311 	        {
       
  1312 	        CAlfTexture* texture = const_cast<CAlfTexture*>(&aImageVisual.Image().Texture());
       
  1313 	        TInt imageWidth = texture->Size().iWidth;
       
  1314 	        TInt imageHeight = texture->Size().iHeight;
       
  1315 	        // when animation is not complete sizes will not be correct.
       
  1316 	        // so sizes are taken from template   
       
  1317 	        if(imageWidth == 0 || imageHeight == 0) 
       
  1318 		        {
       
  1319 		        scaleMode = CAlfImageVisual::EScaleFitInside;
       
  1320 		        }
       
  1321 	        else if( imageWidth <= mData->mHighlightItemStruct.width && 
       
  1322 	        	imageHeight <= mData->mHighlightItemStruct.height )
       
  1323 	            {
       
  1324 	            scaleMode = CAlfImageVisual::EScaleNormal;
       
  1325 	            }
       
  1326 	        else
       
  1327 	            {
       
  1328 		        scaleMode = CAlfImageVisual::EScaleFitInside;
       
  1329 	            }
       
  1330 	        }
       
  1331 	    else
       
  1332 	        {
       
  1333 		    scaleMode = CAlfImageVisual::EScaleFitInside;
       
  1334 	        }
       
  1335 	    }
       
  1336 	else
       
  1337 		{
       
  1338 		// Apply default scale mode
       
  1339 		scaleMode = CAlfImageVisual::EScaleFitInside;
       
  1340 		}
       
  1341      
       
  1342 	if (aImageVisual.ScaleMode() != scaleMode) 
       
  1343 		{
       
  1344 	    aImageVisual.SetScaleMode( scaleMode ); 	
       
  1345 		}
       
  1346 	 ApplyBrushOnIcon( aImageVisual );	
       
  1347     }
       
  1348     
       
  1349 // ---------------------------------------------------------------------------
       
  1350 // ApplyBrushOnIcon
       
  1351 // ---------------------------------------------------------------------------
       
  1352 //
       
  1353 void MulBaseElement::ApplyBrushOnIcon( CAlfImageVisual& aImageVisual )
       
  1354     { 
       
  1355     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ApplyBrushOnIcon");  
       
  1356     if( mData->mIconBgColor.mIsColorSet )
       
  1357     	{
       
  1358     	aImageVisual.EnableBrushesL(ETrue); 
       
  1359     	CAlfBrushArray* brushArray = aImageVisual.Brushes();
       
  1360 	    if( (brushArray->Count()==0))
       
  1361 	        {
       
  1362 	        CAlfGradientBrush* brush = CAlfGradientBrush::NewL(aImageVisual.Env());     
       
  1363 	    	brush->SetColor( mData->mIconBgColor.mColor );         
       
  1364 	    	aImageVisual.Brushes()->AppendL( brush, EAlfHasOwnership );
       
  1365 	        }
       
  1366 	     else
       
  1367 	     	{
       
  1368 	     	CAlfGradientBrush* brush = static_cast<CAlfGradientBrush*>(&brushArray->At(0));
       
  1369 	     	if ( brush->Color(0) != mData->mIconBgColor.mColor )
       
  1370 		     	{
       
  1371 		     	brush->SetColor( mData->mIconBgColor.mColor );  	
       
  1372 		     	}
       
  1373 	     	}
       
  1374     	}
       
  1375     }
       
  1376     
       
  1377 // ---------------------------------------------------------------------------
       
  1378 // RemoveBrushOnIcon
       
  1379 // ---------------------------------------------------------------------------
       
  1380 //
       
  1381 void MulBaseElement::RemoveBrushOnIcon( CAlfImageVisual& aImageVisual )
       
  1382     {  
       
  1383     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RemoveBrushOnIcon"); 
       
  1384 	CAlfBrushArray* brushArray = aImageVisual.Brushes();
       
  1385     if(brushArray && (brushArray->Count()!=0))
       
  1386         {
       
  1387      	brushArray->Remove(0);
       
  1388         }
       
  1389     }    
       
  1390 
       
  1391 // ---------------------------------------------------------------------------
       
  1392 // Template2D
       
  1393 // ---------------------------------------------------------------------------
       
  1394 //
       
  1395 MulCoverFlowTemplate*  MulBaseElement::Template2D()
       
  1396 	{
       
  1397 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::Template2D");
       
  1398 	return ((MulCoverFlowControl*)&control())->Template2D(); 
       
  1399 	}
       
  1400 
       
  1401 // ---------------------------------------------------------------------------
       
  1402 // SetScrollAnimationTime
       
  1403 // ---------------------------------------------------------------------------
       
  1404 //	    
       
  1405 void MulBaseElement::SetScrollAnimationTime( int aScrollAnimationTime )
       
  1406     {
       
  1407     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetScrollAnimationTime");
       
  1408     mData->mScrollAnimationTime = aScrollAnimationTime;    
       
  1409     }
       
  1410    
       
  1411 // ---------------------------------------------------------------------------
       
  1412 // ArrangeItems
       
  1413 // ---------------------------------------------------------------------------
       
  1414 //	    
       
  1415 void MulBaseElement::ArrangeItems()
       
  1416     { 
       
  1417 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ArrangeItems");
       
  1418 		
       
  1419 	control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); 
       
  1420 
       
  1421 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  1422 	int highlightIndex = mData->mVisibleCount;
       
  1423 	CAlfImageVisual* imageVisual = NULL;	
       
  1424 
       
  1425 
       
  1426 	int posX = mData->mHighlightItemStruct.posx - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding);
       
  1427 	
       
  1428 	TAlfRealPoint highlightItemSize(mData->mHighlightItemStruct.width, mData->mHighlightItemStruct.height);
       
  1429 	TAlfRealPoint nonHighlightItemSize(mData->mItemStruct.width, mData->mItemStruct.height);
       
  1430 
       
  1431 	for (int i=0; i < totalVisual ; i++)  
       
  1432 	    {
       
  1433 	    CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i);		
       
  1434 		imageVisual = (CAlfImageVisual*)deckLayout.FindTag(KCoverflowIcon);
       
  1435 	    
       
  1436 		if (i != highlightIndex)
       
  1437 			{
       
  1438 			deckLayout.SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy));
       
  1439 		 	deckLayout.SetSize(nonHighlightItemSize);
       
  1440 		   	imageVisual->SetSize(nonHighlightItemSize);
       
  1441 		   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  1442 			}
       
  1443 		else
       
  1444 			{
       
  1445 		    deckLayout.SetPos( TAlfRealPoint(mData->mHighlightItemStruct.posx,mData->mHighlightItemStruct.posy));
       
  1446 		 	deckLayout.SetSize(highlightItemSize);
       
  1447 		   	imageVisual->SetSize(highlightItemSize);
       
  1448 		   	posX = posX + mData->mHighlightItemStruct.width + mData->mPadding;
       
  1449 			}
       
  1450 		if (mData->mFitMode)
       
  1451 			{
       
  1452 			ApplyScaleMode(*imageVisual);
       
  1453 			}
       
  1454 	   	CAlfImageVisual* indicatorVisual =static_cast<CAlfImageVisual*>(deckLayout.FindTag(KCoverflowIndicator));    
       
  1455         if (indicatorVisual)
       
  1456             {
       
  1457             SetIndicatorDimensions(*indicatorVisual);    
       
  1458             }
       
  1459 	
       
  1460 	    }
       
  1461 	    
       
  1462 	control().Env().BatchBufferHandler().FlushBatchBuffer();            
       
  1463 	control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred);           
       
  1464 	        
       
  1465     }
       
  1466 
       
  1467 // ---------------------------------------------------------------------------
       
  1468 // SetScrollDir
       
  1469 // ---------------------------------------------------------------------------
       
  1470 //    
       
  1471 void MulBaseElement::SetScrollDir( TItemScroll aScrollDir )
       
  1472     {
       
  1473     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetScrollDir");
       
  1474     mData->mScrollDir = aScrollDir;   
       
  1475     }
       
  1476 
       
  1477 // ---------------------------------------------------------------------------
       
  1478 // SetScrollDir
       
  1479 // ---------------------------------------------------------------------------
       
  1480 //    
       
  1481 TItemScroll MulBaseElement::ScrollDir()
       
  1482     {
       
  1483     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ScrollDir");
       
  1484     return mData->mScrollDir;   
       
  1485     }    
       
  1486 
       
  1487 // ---------------------------------------------------------------------------
       
  1488 // CalculatePadding
       
  1489 // ---------------------------------------------------------------------------
       
  1490 //	
       
  1491 void MulBaseElement::CalculatePadding()
       
  1492     {
       
  1493     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CalculatePadding");
       
  1494     
       
  1495     // The vector has already been created when the template was set. 
       
  1496      if( mData->mVisibleCount == 1)
       
  1497         {
       
  1498         if( mData->mHighlightItemStruct.posx > KInitialvalueZero )
       
  1499             {
       
  1500             mData->mPadding = mData->mHighlightItemStruct.posx;
       
  1501             }
       
  1502         else
       
  1503             {
       
  1504             // full screen template ..photos
       
  1505             // padding between the highlight and non highlight item is considered to be 2 pixel for 
       
  1506             // full screen template as only one visual is visible.
       
  1507             mData->mPadding = 2;
       
  1508             }
       
  1509         }
       
  1510    else
       
  1511         {
       
  1512         int startx = mData->mHighlightItemStruct.posx+ mData->mHighlightItemStruct.width;
       
  1513         mData->mPadding = mData->mItemStruct.posx - startx;
       
  1514         } 
       
  1515     }
       
  1516 
       
  1517 
       
  1518 // ---------------------------------------------------------------------------
       
  1519 // GetIconSize
       
  1520 // ---------------------------------------------------------------------------
       
  1521 //
       
  1522 void MulBaseElement::GetIconSize( mulwidget::TLogicalTemplate aTemplateId, 
       
  1523 		    mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth)
       
  1524 	{
       
  1525 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::GetIconSize");
       
  1526 
       
  1527 	bool isLandscape = ((MulCoverFlowControl*)&control())->IsLandscape();
       
  1528 	switch(aTemplateId)
       
  1529 		{
       
  1530 		case mulwidget::KTemplate1:
       
  1531 			{
       
  1532 			MulCoverFlowTemplate1::GetIconSize(aAttribute,isLandscape,aHeight,aWidth);
       
  1533 			}
       
  1534 		break;
       
  1535 		case mulwidget::KTemplate4:
       
  1536 			{
       
  1537 			MulCoverFlowTemplate4::GetIconSize(aAttribute,isLandscape,aHeight,aWidth);
       
  1538 			}
       
  1539 		break;
       
  1540 		default:
       
  1541 			{
       
  1542 			// Invalid template id
       
  1543 			// raise exception
       
  1544 			__MUL_ASSERT(false,KInvalidTemplate);
       
  1545 			}
       
  1546 		break;
       
  1547 		}
       
  1548 	}
       
  1549 
       
  1550 
       
  1551 // ---------------------------------------------------------------------------
       
  1552 // ShowWidget
       
  1553 // ---------------------------------------------------------------------------
       
  1554 //		
       
  1555 void MulBaseElement::ShowWidget( bool aShow, int aTransitionTime ) 
       
  1556 	{
       
  1557 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowWidget");
       
  1558 	float opacity ;
       
  1559 	CAlfLayout* main = (CAlfLayout*) findVisual( KMainLayoutIndex );
       
  1560 
       
  1561     if( aShow )
       
  1562 		{
       
  1563 		opacity =  KHighlightOpacity;
       
  1564 		}
       
  1565 	else
       
  1566 		{
       
  1567 		opacity =  KBackGroundOpacity;
       
  1568 		}
       
  1569 	main->SetOpacity(TAlfTimedValue(opacity,aTransitionTime));
       
  1570 	}
       
  1571 
       
  1572 // ---------------------------------------------------------------------------
       
  1573 // makeInterface
       
  1574 // ---------------------------------------------------------------------------
       
  1575 //	        
       
  1576 IAlfInterfaceBase* MulBaseElement::makeInterface( const IfId& aType )
       
  1577     {
       
  1578     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::makeInterface");
       
  1579     UString param(aType.mImplementationId);
       
  1580      
       
  1581     if(param == MulBaseElement::Type().mImplementationId )
       
  1582         {
       
  1583         return static_cast<IAlfElement*>(this);  
       
  1584         }    
       
  1585    else if(param == IAlfWidgetEventHandler::type().mImplementationId )
       
  1586         {
       
  1587         return static_cast<IAlfWidgetEventHandler*>(this);  
       
  1588         }
       
  1589     else 
       
  1590         {
       
  1591         return AlfElement::makeInterface(aType);    
       
  1592         }
       
  1593     }
       
  1594 
       
  1595 // ---------------------------------------------------------------------------
       
  1596 // setEventHandlerData
       
  1597 // ---------------------------------------------------------------------------
       
  1598 //
       
  1599 void MulBaseElement::setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ )
       
  1600 	{
       
  1601 	//No implementation required		
       
  1602 	}
       
  1603 
       
  1604 // ---------------------------------------------------------------------------
       
  1605 // eventHandlerData
       
  1606 // ---------------------------------------------------------------------------
       
  1607 //
       
  1608 AlfWidgetEventHandlerInitData* MulBaseElement::eventHandlerData()
       
  1609 	{
       
  1610     return NULL;		
       
  1611 	}
       
  1612 	
       
  1613 // ----------------------------------------------------------------------------
       
  1614 // eventHandlerType
       
  1615 // ----------------------------------------------------------------------------
       
  1616 //
       
  1617  IAlfWidgetEventHandler::AlfEventHandlerType MulBaseElement::eventHandlerType() 
       
  1618 	{
       
  1619 	return IAlfWidgetEventHandler::ELogicalEventHandler ;
       
  1620 	}
       
  1621 // ----------------------------------------------------------------------------
       
  1622 // eventExecutionPhase
       
  1623 // ----------------------------------------------------------------------------
       
  1624 //
       
  1625 
       
  1626 IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulBaseElement::eventExecutionPhase()
       
  1627 	{
       
  1628 	return EBubblingPhaseEventHandler;
       
  1629 	}   
       
  1630 	
       
  1631 //------------------------Slider related Api's -------------------------	
       
  1632 
       
  1633 //--------------------------------------------------------------------------
       
  1634 // UpdateSliderTick
       
  1635 //--------------------------------------------------------------------------
       
  1636 //
       
  1637 void MulBaseElement::UpdateSliderTick(int aUpdateTick)
       
  1638 	{
       
  1639 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MulBaseElement");
       
  1640 	IMulSliderModel* mulSliderModel = ((MulCoverFlowControl*)&control())->GetSliderModel();
       
  1641     if( mulSliderModel && Template2D()->IsSliderVisible() )
       
  1642 		{
       
  1643 		 // Creating a reference Visual Item
       
  1644     	//@todo remove const from Data api in slider model
       
  1645 		const MulVisualItem& item = mulSliderModel->Data();
       
  1646 		//auto_ptr<MulVisualItem> tempItem( new (EMM) MulVisualItem());
       
  1647 		MulVisualItem* tempItem  = const_cast<MulVisualItem*> (&item);
       
  1648 		  
       
  1649 		tempItem->SetAttribute( mulvisualitem::KMulMaxRange, --aUpdateTick );
       
  1650 		tempItem->SetAttribute (mulvisualitem::KMulMinRange, 0);
       
  1651 		tempItem->SetAttribute ( mulvisualitem::KMulTick,1);
       
  1652 		
       
  1653 		// Add the newly created visual item to the model
       
  1654 		// Model takes the ownership of the visual item
       
  1655 		mulSliderModel->SetData(*tempItem);   
       
  1656 		}
       
  1657 		
       
  1658 	// Set the opacity to the slider widget after verifyiny all the conditions.
       
  1659 	SetSliderOpacity();
       
  1660 	}
       
  1661 //--------------------------------------------------------------------------
       
  1662 // SetSliderOpacity
       
  1663 //--------------------------------------------------------------------------
       
  1664 //	
       
  1665 void MulBaseElement::SetSliderOpacity()
       
  1666 	{
       
  1667 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetSliderOpacity");
       
  1668 	
       
  1669 	if (mData->mSliderLayout)
       
  1670 		{
       
  1671 		if ( Template2D()->IsSliderVisible() )
       
  1672 	    	{
       
  1673 	    	if( static_cast<MulCoverFlowControl&>(control()).TotalModelCount() > 1 && mData->mSliderOpacity == KBackGroundOpacity)
       
  1674 		    	{
       
  1675 		     	ShowSlider(true);	    	
       
  1676 		    	}
       
  1677 		    else if((static_cast<MulCoverFlowControl&>(control()).TotalModelCount() <= 1) && mData->mSliderOpacity == KHighlightOpacity)
       
  1678 		    	{
       
  1679 		    	ShowSlider(false);	    	
       
  1680 		    	}
       
  1681 	    	}
       
  1682 	     else if(mData->mSliderOpacity == KHighlightOpacity)
       
  1683 	     	{
       
  1684 	     	 ShowSlider(false);	
       
  1685 	     	}
       
  1686 		}
       
  1687 	}
       
  1688 
       
  1689 //--------------------------------------------------------------------------
       
  1690 //CreateSlider
       
  1691 //--------------------------------------------------------------------------
       
  1692 //	
       
  1693 void MulBaseElement::CreateSlider()
       
  1694 	{
       
  1695 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateSlider");
       
  1696 	if ( Template2D()->IsSliderVisible() )
       
  1697     	{
       
  1698     	MulCoverFlowControl* coverflowControl = static_cast<MulCoverFlowControl*>(&control());
       
  1699     	IAlfWidget* sliderwidget = coverflowControl->GetSliderWidget();
       
  1700     	if(!sliderwidget)
       
  1701 			{
       
  1702 			ConstructSliderWidget();
       
  1703 			}
       
  1704 
       
  1705 		const TMulCoverFlowItem sliderStruct = Template2D()->SliderDimension();
       
  1706 		mData->mSliderLayout->SetPos(TAlfRealPoint(sliderStruct.posx,sliderStruct.posy));
       
  1707 		mData->mSliderLayout->SetSize(TAlfRealPoint(sliderStruct.width,sliderStruct.height));
       
  1708 		int totalModelCount = coverflowControl->TotalModelCount();
       
  1709 		if( totalModelCount > 1 )
       
  1710 			{
       
  1711 			UpdateSliderTick(totalModelCount);	
       
  1712 			coverflowControl->SetSliderTickPosition();
       
  1713 			ShowSlider(true);
       
  1714 			}
       
  1715 		else
       
  1716 			{
       
  1717 			ShowSlider(false);
       
  1718 			}
       
  1719 	    mData->mSliderLayout->UpdateChildrenLayout();
       
  1720     	}
       
  1721     else
       
  1722     	{
       
  1723     	if (!mData->mSliderLayout)
       
  1724 	    	{
       
  1725 	    	return;	
       
  1726 	    	}
       
  1727 	    ShowSlider(false);
       
  1728     	}
       
  1729 	}
       
  1730 
       
  1731 //--------------------------------------------------------------------------
       
  1732 //ConstructSliderWidget
       
  1733 //--------------------------------------------------------------------------	
       
  1734 void MulBaseElement::ConstructSliderWidget()
       
  1735 	{
       
  1736 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ConstructSliderWidget");
       
  1737 	IAlfWidget* alfSliderWidget = ((MulCoverFlowControl*)&control())->CreateSliderWidget();
       
  1738 	IMulSliderWidget* mulSliderWidget = static_cast<IMulSliderWidget*>(alfSliderWidget);
       
  1739 	mData->mSliderLayout = const_cast<CAlfLayout*>(&mulSliderWidget->ContainerLayout());
       
  1740 	mData->mVerticalFlow->Insert(mData->mSliderLayout, mData->mVerticalFlow->Count());
       
  1741 	}
       
  1742 	
       
  1743 
       
  1744 //--------------------------------------------------------------------------
       
  1745 //ShowSlider
       
  1746 //--------------------------------------------------------------------------
       
  1747 void MulBaseElement::ShowSlider(bool aFlag)
       
  1748 	{
       
  1749 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowSlider");
       
  1750 	if(mData->mSliderLayout)
       
  1751 		{
       
  1752 		IAlfWidget* alfSliderWidget = ((MulCoverFlowControl*)&control())->GetSliderWidget();
       
  1753 		IMulSliderWidget* mulSliderWidget = static_cast<IMulSliderWidget*>(alfSliderWidget);
       
  1754 		mulSliderWidget->ShowWidget(aFlag);
       
  1755 		if(aFlag)
       
  1756 			{
       
  1757 			mData->mSliderLayout->SetOpacity(TAlfTimedValue(KHighlightOpacity));
       
  1758 			mData->mSliderOpacity = KHighlightOpacity;							
       
  1759 			}
       
  1760 		else
       
  1761 			{
       
  1762     		mData->mSliderLayout->SetOpacity(TAlfTimedValue(KBackGroundOpacity));
       
  1763     		mData->mSliderOpacity = KBackGroundOpacity;			
       
  1764 			}
       
  1765 		}
       
  1766 	}	
       
  1767 	
       
  1768     
       
  1769 //--------------------------------------------------------------------------
       
  1770 // StartBounce
       
  1771 //--------------------------------------------------------------------------
       
  1772 void MulBaseElement::StartBounce(int aBounceDirection) 
       
  1773     {
       
  1774     int bounceDistance = (mData->mHighlightItemStruct.width/4) * aBounceDirection; 	
       
  1775     control().Env().Send(TAlfCustomEventCommand(ECustomEventBounceBack,&control()),KBounceTime); 
       
  1776  	StartDoodling(bounceDistance,KBounceTime);
       
  1777     }
       
  1778 
       
  1779 
       
  1780 // ---------------------------------------------------------------------------
       
  1781 // CalculateDistanceChangeFactor
       
  1782 // ---------------------------------------------------------------------------
       
  1783 //
       
  1784 int MulBaseElement::CalculateDistanceChangeFactor()
       
  1785     {
       
  1786     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CalculateDistanceChangeFactor");
       
  1787    
       
  1788     int firstVisualMidPoint = mData->mHighlightItemStruct.posx + (mData->mHighlightItemStruct.width/2);
       
  1789     int secVisualMidPoint =  mData->mItemStruct.posx + (mData->mItemStruct.width/2);
       
  1790    
       
  1791     return Abs(secVisualMidPoint-firstVisualMidPoint);
       
  1792     }
       
  1793 
       
  1794 
       
  1795 // ---------------------------------------------------------------------------
       
  1796 // SetBackground
       
  1797 // ---------------------------------------------------------------------------
       
  1798 //
       
  1799 void MulBaseElement::SetBackground(const TRgb& aColor)
       
  1800 	{
       
  1801 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetBackground");
       
  1802 	
       
  1803 	CAlfLayout* main = static_cast<CAlfLayout*>(findVisual( KMainLayoutIndex ));
       
  1804 	CAlfDeckLayout& deckLayout = static_cast<CAlfDeckLayout&> (main->Visual(KMainLayoutIndex) );
       
  1805 	
       
  1806 	CAlfVisual* oldVisual = deckLayout.FindTag(backgroundvisual);
       
  1807 	if(oldVisual)
       
  1808 		{
       
  1809 		CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(oldVisual);
       
  1810 		if(imageVisual->Image().HasTexture())
       
  1811 			{
       
  1812 			const CAlfTexture& textureToUnload = imageVisual->Image().Texture();
       
  1813 			CAlfTextureManager& textureMgr = control().Env().TextureManager();    
       
  1814 			textureMgr.UnloadTexture(textureToUnload.Id());		
       
  1815 			}
       
  1816 					
       
  1817 		deckLayout.Remove( oldVisual );
       
  1818 		oldVisual->RemoveAndDestroyAllD();
       
  1819 		}
       
  1820 		
       
  1821     deckLayout.EnableBrushesL( ETrue );
       
  1822     CAlfBrushArray* brushArray = deckLayout.Brushes();
       
  1823     if(brushArray)
       
  1824         {
       
  1825 		if( brushArray->Count()!=0)
       
  1826 		    {
       
  1827 			CAlfGradientBrush& brush = static_cast<CAlfGradientBrush&>(brushArray->At(0));		    
       
  1828 		    brush.SetColor( aColor ); 
       
  1829 		    }
       
  1830 		else
       
  1831 			{
       
  1832 			THROW_IF_LEAVES
       
  1833 				(
       
  1834 				CAlfGradientBrush* brush = CAlfGradientBrush::NewL( control().Env() );
       
  1835 				// Set the brush colour
       
  1836 				brush->SetColor( aColor );
       
  1837 				// Apply brush and set the opacity .
       
  1838 				deckLayout.Brushes()->AppendL( brush, EAlfHasOwnership ); 
       
  1839 				); 	
       
  1840 			}
       
  1841         }
       
  1842 	}
       
  1843 
       
  1844 // ---------------------------------------------------------------------------
       
  1845 // SetBackground
       
  1846 // ---------------------------------------------------------------------------
       
  1847 //
       
  1848 void MulBaseElement::SetBackground(const TAknsItemID& aIID)
       
  1849 	{
       
  1850 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetBackground");
       
  1851 	
       
  1852 	CAlfLayout* main = static_cast<CAlfLayout*>(findVisual( KMainLayoutIndex ));
       
  1853 	CAlfDeckLayout& deckLayout = static_cast<CAlfDeckLayout&> (main->Visual(KMainLayoutIndex) );
       
  1854 
       
  1855 	CAlfBrushArray* brushArray = deckLayout.Brushes();
       
  1856     if(brushArray)
       
  1857         {     
       
  1858 		if( brushArray->Count()!=0)
       
  1859 		    {
       
  1860 		    brushArray->Reset();            
       
  1861 		    }
       
  1862         }
       
  1863 		    
       
  1864 	TAlfRealSize layoutSize = deckLayout.Size().ValueNow();
       
  1865 	const TAlfImage image(aIID,TSize(layoutSize),EAspectRatioPreserved,NULL,-1,-1,0.f,0.f,1.f,
       
  1866 					1.f, TAlfTextureFlags(EAlfTextureFlagAutoSize | EAlfTextureFlagSkinContent),
       
  1867 					KAlfAutoGeneratedTextureId,NULL);							 
       
  1868                     
       
  1869 	CAlfVisual* oldVisual = deckLayout.FindTag(backgroundvisual);
       
  1870 	if(oldVisual)
       
  1871 		{
       
  1872 		CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(oldVisual);
       
  1873 		if(imageVisual->Image().HasTexture())
       
  1874 			{
       
  1875 			const CAlfTexture& textureToUnload = imageVisual->Image().Texture();
       
  1876 			CAlfTextureManager& textureMgr = control().Env().TextureManager();    
       
  1877 			textureMgr.UnloadTexture(textureToUnload.Id());		
       
  1878 			}		
       
  1879 		imageVisual->SetImage(image);	
       
  1880 		}
       
  1881 	else
       
  1882 		{
       
  1883 		THROW_IF_LEAVES
       
  1884 			(
       
  1885 			CAlfImageVisual* imagevisual(CAlfImageVisual::AddNewL((CAlfControl&)control(), &deckLayout));
       
  1886 			deckLayout.MoveVisualToBack(*imagevisual);
       
  1887 			imagevisual->SetImage(image);
       
  1888 			imagevisual->SetFlag(EAlfVisualFlagIgnorePointer);
       
  1889 			imagevisual->SetPos(TPoint(0,0));
       
  1890 		    imagevisual->SetSize(layoutSize);
       
  1891 		    imagevisual->SetOpacity( KHighlightOpacity );
       
  1892 		    imagevisual->SetTagL( backgroundvisual );
       
  1893 			);	
       
  1894 		}	
       
  1895 	}
       
  1896 
       
  1897 // ---------------------------------------------------------------------------
       
  1898 // SetItemBrush
       
  1899 // ---------------------------------------------------------------------------
       
  1900 //
       
  1901 void MulBaseElement::SetItemBrush(const TRgb& aColor)
       
  1902     {
       
  1903     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetItemBrush");
       
  1904 	mData->mIconBgColor.mIsColorSet = true;
       
  1905 	mData->mIconBgColor.mColor = aColor;
       
  1906 	
       
  1907 	int itemCount = 2*mData->mVisibleCount + 1;
       
  1908 	
       
  1909 	itemCount = itemCount > mData->mIconFlowLayout->Count() ? mData->mIconFlowLayout->Count() : itemCount;
       
  1910 	
       
  1911 	for(int i =0 ;i<itemCount;i++)
       
  1912     	{
       
  1913     	CAlfVisual& visual = mData->mIconFlowLayout->Visual( i );
       
  1914         CAlfImageVisual* imageVisual = ( CAlfImageVisual* )visual.FindTag(KCoverflowIcon);
       
  1915         ApplyBrushOnIcon( *imageVisual);    
       
  1916     	}
       
  1917     }
       
  1918 
       
  1919 	
       
  1920 // ---------------------------------------------------------------------------
       
  1921 // SetTextColor
       
  1922 // ---------------------------------------------------------------------------
       
  1923 //
       
  1924 void MulBaseElement::SetTextColor(TTextVisualType aVisualType, const TRgb& aColor)
       
  1925     {
       
  1926     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetTextColor");
       
  1927     
       
  1928     switch(aVisualType)
       
  1929 	    {
       
  1930 	    case ECounterVisual:
       
  1931 		    {
       
  1932 		    // save the values set by the application
       
  1933 		    mData->mCounterColor.mIsColorSet = true;
       
  1934 		    mData->mCounterColor.mColor = aColor;
       
  1935 		    
       
  1936 		    // apply the property if the visuals are already created
       
  1937 		    if(mData->mCounterVisual)
       
  1938 			    {
       
  1939 			    mData->mCounterVisual->SetColor(aColor);	
       
  1940 			    }
       
  1941 		    break;	
       
  1942 		    }
       
  1943 	    case ETilteDetailTextVisual:
       
  1944 		    {
       
  1945 		    // save the values set by the application
       
  1946 		    mData->mTextColor.mIsColorSet = true;
       
  1947 		    mData->mTextColor.mColor = aColor;
       
  1948 
       
  1949 		    // apply the property if the visuals are already created
       
  1950 		    CAlfTextVisual* titleTextVisual =static_cast<CAlfTextVisual*>(mData->mTextLayout->FindTag(KCoverflowTitle));
       
  1951 	        if(titleTextVisual)
       
  1952 	            {
       
  1953 	            titleTextVisual->SetColor(aColor);
       
  1954 	            }
       
  1955 	        CAlfViewportLayout* viewPortLayout =static_cast<CAlfViewportLayout*>(mData->mTextLayout->FindTag(KDetailViewPortLayout));
       
  1956 	        if(viewPortLayout)
       
  1957 	            {
       
  1958 	            CAlfTextVisual* detailTextVisual =static_cast<CAlfTextVisual*>(viewPortLayout->FindTag(KCoverflowDetail));
       
  1959 	            if(detailTextVisual)
       
  1960 	                {
       
  1961 	                detailTextVisual->SetColor(aColor);
       
  1962 	                }
       
  1963 	            }
       
  1964             // Apply the same color for empty text also
       
  1965             if(mData->mEmptyTextVisual)
       
  1966 	            {
       
  1967 	            mData->mEmptyTextVisual->SetColor(aColor);	
       
  1968 	            }
       
  1969 		    break;	
       
  1970 		    }
       
  1971 		default:
       
  1972 			break;
       
  1973 	    }
       
  1974     }
       
  1975 
       
  1976 // ---------------------------------------------------------------------------
       
  1977 // TextColor
       
  1978 // ---------------------------------------------------------------------------
       
  1979 //
       
  1980 TMulVisualColorProperty MulBaseElement::TextColor(TTextVisualType aVisualType)
       
  1981     {
       
  1982     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::TextColor");
       
  1983     TMulVisualColorProperty colorProperty;
       
  1984     
       
  1985     switch(aVisualType)
       
  1986 	    {
       
  1987 	    case ECounterVisual:
       
  1988 		    {
       
  1989 		    colorProperty = mData->mCounterColor;
       
  1990 		    break;
       
  1991 		    }
       
  1992 	    case ETilteDetailTextVisual:
       
  1993 		    {
       
  1994 		    colorProperty = mData->mTextColor;
       
  1995 		    break;
       
  1996 		    }
       
  1997 		default:
       
  1998 			break;
       
  1999 	    }
       
  2000 	return colorProperty;
       
  2001     }
       
  2002 
       
  2003 // ---------------------------------------------------------------------------
       
  2004 // FlowLayout
       
  2005 // ---------------------------------------------------------------------------
       
  2006 //
       
  2007 CAlfLayout& MulBaseElement::FlowLayout( int aLayoutIndex )
       
  2008       {
       
  2009       MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::FlowLayout");
       
  2010       
       
  2011       return static_cast<CAlfLayout&>(mData->mVerticalFlow->Visual( aLayoutIndex ));
       
  2012       }
       
  2013 
       
  2014 // ---------------------------------------------------------------------------
       
  2015 // SetFitMode
       
  2016 // ---------------------------------------------------------------------------
       
  2017 //      
       
  2018 void MulBaseElement::SetFitMode(bool aFlag)
       
  2019 	{
       
  2020 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetFitMode");
       
  2021 	mData->mFitMode = aFlag;
       
  2022 	}
       
  2023 	
       
  2024 // ----------------------------------------------------------------------------
       
  2025 // CreateAndInitializeVisuals
       
  2026 // ----------------------------------------------------------------------------
       
  2027 //
       
  2028 void MulBaseElement::CreateAndInitializeVisuals(bool aIsOrientationChange)
       
  2029 	{
       
  2030 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateAndInitializeVisuals");
       
  2031 	CreateVisuals();
       
  2032 
       
  2033 	// Specific to template 4 don't update the visuals
       
  2034 	// during orientation change
       
  2035 	// done for performance improvement.
       
  2036 	if (!(aIsOrientationChange &&mData->mFitMode))
       
  2037 		{
       
  2038 		UpdateVisuals();
       
  2039 		CreateSlider();
       
  2040 		}
       
  2041 	
       
  2042 	// For template 4 set model case
       
  2043 	// cancel the rotation if any.
       
  2044 	if (!aIsOrientationChange && mData->mFitMode)
       
  2045 		{
       
  2046 		if (mData->mRotation.mIsApplied)
       
  2047 			{
       
  2048 			if (mData->mRotation.mIndex >= 0)
       
  2049 				{
       
  2050 				CancelRotation(mData->mRotation.mIndex);
       
  2051 				}
       
  2052 			else
       
  2053 				{
       
  2054 				// rotation applied on highlight index.
       
  2055 				// so cancel it.
       
  2056 				mData->mRotation.mIndex = 1;
       
  2057 				CancelRotation(mData->mRotation.mIndex);
       
  2058 				}
       
  2059 			}
       
  2060 		}
       
  2061 	}
       
  2062 	
       
  2063 // ----------------------------------------------------------------------------
       
  2064 // CreateVisuals
       
  2065 // ----------------------------------------------------------------------------
       
  2066 //
       
  2067 void MulBaseElement::CreateVisuals()
       
  2068 	{
       
  2069 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateVisuals");
       
  2070 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  2071 	int visualIndex = 0;
       
  2072 	
       
  2073 	// if there are less visuals than required tehn create the extra visauls and
       
  2074 	// set opacity 1 for already existing visuals
       
  2075 	if(totalVisual > mData->mIconFlowLayout->Count())
       
  2076     	{
       
  2077     	visualIndex = mData->mIconFlowLayout->Count(); 	
       
  2078         for(; visualIndex < totalVisual;visualIndex++) 
       
  2079             {
       
  2080             CreateIconStructure(mData->mIconFlowLayout); 
       
  2081             }
       
  2082     	}
       
  2083     // if the number of visuals are more, then set opacity 0 for the extra visuals
       
  2084     else if (totalVisual < mData->mIconFlowLayout->Count())
       
  2085         {
       
  2086         IMulModelAccessor* accessor = ((MulCoverFlowControl*)&control())->ModelAccessor();
       
  2087         if(accessor)
       
  2088             {
       
  2089             if(accessor->CurrentItemCount() < totalVisual)
       
  2090 	            {
       
  2091 	            for(; visualIndex < totalVisual;visualIndex++) 
       
  2092 	                {
       
  2093 	                CAlfVisual& visual = mData->mIconFlowLayout->Visual(visualIndex);
       
  2094         			static_cast<MulCoverFlowControl&>(control()).UpdateItemAtIndex(visualIndex);	
       
  2095 	                }
       
  2096 	            }
       
  2097 	            
       
  2098     	    CAlfTextureManager& textureMgr = control().Env().TextureManager();
       
  2099     	    TAlfImage image = TAlfImage(textureMgr.BlankTexture());
       
  2100     	    // position those visuals to some other location.
       
  2101     	    int posX = mData->mHighlightItemStruct.posx + totalVisual * mData->mHighlightItemStruct.width;
       
  2102             for(; visualIndex < mData->mIconFlowLayout->Count();visualIndex++) 
       
  2103                 {
       
  2104 	            CAlfVisual& visual = mData->mIconFlowLayout->Visual(visualIndex);
       
  2105 	            visual.SetPos(TAlfRealPoint(posX,mData->mHighlightItemStruct.posy));
       
  2106 	            CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(visual.FindTag(KCoverflowIcon));
       
  2107 		        // remove the icon brush if any.
       
  2108 		        RemoveBrushOnIcon(*imageVisual);        
       
  2109 		        imageVisual->SetImage(image); 
       
  2110                 CAlfImageVisual* indicatorVisual =static_cast<CAlfImageVisual*>(visual.FindTag(KCoverflowIndicator));    
       
  2111                 if(indicatorVisual)
       
  2112                     {
       
  2113                     indicatorVisual->SetImage(image);   
       
  2114                     }
       
  2115 	            }
       
  2116             }
       
  2117         }
       
  2118 	}
       
  2119 
       
  2120 // ----------------------------------------------------------------------------
       
  2121 // UpdateVisuals
       
  2122 // ----------------------------------------------------------------------------
       
  2123 //
       
  2124 void MulBaseElement::UpdateVisuals()
       
  2125 	{
       
  2126 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateVisuals");
       
  2127 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  2128 	MulCoverFlowControl* coverflowControl = static_cast<MulCoverFlowControl*>(&control());
       
  2129 	IMulModelAccessor* accessor = coverflowControl->ModelAccessor();
       
  2130 	if(accessor)
       
  2131     	{
       
  2132     	for(int i = 0; i < totalVisual; i++) 
       
  2133             {
       
  2134             CAlfVisual& visual = mData->mIconFlowLayout->Visual(i);
       
  2135         	coverflowControl->UpdateItemAtIndex(i);	          
       
  2136             }
       
  2137     	}
       
  2138 	}
       
  2139 	
       
  2140 // ----------------------------------------------------------------------------
       
  2141 // CreateIconStructure
       
  2142 // ----------------------------------------------------------------------------
       
  2143 //
       
  2144 CAlfVisual* MulBaseElement::CreateIconStructure(CAlfLayout* aParentLayout)
       
  2145     { 
       
  2146     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateIconStructure");       
       
  2147     //create the deck layout.
       
  2148     CAlfDeckLayout* deck =CAlfDeckLayout::AddNewL((CAlfControl &)control(),aParentLayout);
       
  2149     CAlfImageVisual* imageVisual =CAlfImageVisual::AddNewL((CAlfControl &)control(),deck);
       
  2150     imageVisual->SetTagL(KCoverflowIcon);
       
  2151 	deck->SetFlag( EAlfVisualFlagManualLayout );
       
  2152     return deck;
       
  2153     }
       
  2154 	
       
  2155 	
       
  2156 // ----------------------------------------------------------------------------
       
  2157 // SetHighlight
       
  2158 // This function is used to change the highlight by 1 with animation.
       
  2159 // This function also takes care whether we need to change the size or only the position.
       
  2160 // it takes into consideration the current direction and the current highlight index.
       
  2161 // The logic is , we are always keeping the highlight visual index fixed (its equal to
       
  2162 // the no of visible item in the screen), Depending on the scroll direction we reorder
       
  2163 // the last or first visual and then position all visuals keeping the highlight visual
       
  2164 // in its position. Then update the last or 1st visual with appropriate data.
       
  2165 // ----------------------------------------------------------------------------
       
  2166 //
       
  2167 void MulBaseElement::SetHighlight(int /*aHighlightIndex*/, int aAnimationTime)
       
  2168 	{
       
  2169 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetHighlight");
       
  2170 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  2171 	int highlightIndex = mData->mVisibleCount;
       
  2172 	CAlfVisual* deckLayout = NULL;
       
  2173 	CAlfVisual* imageVisual = NULL;	
       
  2174 	
       
  2175 	int highlightPosX = mData->mHighlightItemStruct.posx;
       
  2176 
       
  2177     if(mData->mScrollDir == EItemScrollLeft)
       
  2178     	{
       
  2179     	CancelRotation(totalVisual - 1);
       
  2180 		control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced);     	
       
  2181 		deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(totalVisual - 1);
       
  2182     	mData->mIconFlowLayout->Reorder(*deckLayout,0);
       
  2183     	
       
  2184 		int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding);
       
  2185 		deckLayout->SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy));
       
  2186 		posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2187 		for (int i=1; i < totalVisual ; i++)  
       
  2188 		    {
       
  2189 			deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(i);
       
  2190 			imageVisual = deckLayout->FindTag(KCoverflowIcon);
       
  2191 			if (i != highlightIndex)
       
  2192 				{
       
  2193 				deckLayout->SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime));
       
  2194 			   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2195 			   
       
  2196 			   	// Change the size if required
       
  2197 				if((i == highlightIndex+1 || i == highlightIndex-1) && mData->mChangeSize)
       
  2198 					{
       
  2199 					deckLayout->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2200 					imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2201 					}
       
  2202 				}
       
  2203 			else
       
  2204 				{
       
  2205 			    deckLayout->SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime));
       
  2206 			   	posX = posX + mData->mHighlightItemStruct.width + mData->mPadding;
       
  2207 			   	
       
  2208 			   	// Change the size if required
       
  2209 			   	if(mData->mChangeSize)
       
  2210 				   	{
       
  2211 					deckLayout->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width,
       
  2212 														mData->mHighlightItemStruct.height,
       
  2213 														aAnimationTime));
       
  2214 					imageVisual->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width,
       
  2215 														mData->mHighlightItemStruct.height,
       
  2216 														aAnimationTime));
       
  2217 				   	}
       
  2218 				}
       
  2219 		    }
       
  2220 	    control().Env().BatchBufferHandler().FlushBatchBuffer();            
       
  2221 	  	control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred);           
       
  2222 		((MulCoverFlowControl*)&control())->UpdateItemAtIndex(0, aAnimationTime);
       
  2223 
       
  2224     	}
       
  2225     else if (mData->mScrollDir == EItemScrollRight)
       
  2226 	    {
       
  2227 	    CancelRotation(0);
       
  2228 		control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); 	    
       
  2229 		deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(0);
       
  2230     	mData->mIconFlowLayout->Reorder(*deckLayout,totalVisual-1);
       
  2231     	
       
  2232 		int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding);
       
  2233 
       
  2234 		for (int i=0; i < totalVisual-1 ; i++)  
       
  2235 		    {
       
  2236 			deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(i);
       
  2237 			imageVisual = deckLayout->FindTag(KCoverflowIcon);
       
  2238 		    
       
  2239 			if (i != highlightIndex)
       
  2240 				{
       
  2241 				deckLayout->SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime));
       
  2242 			   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2243 			   	// Change the size if required
       
  2244 				if((i == highlightIndex+1 || i == highlightIndex-1) && mData->mChangeSize)
       
  2245 					{
       
  2246 					deckLayout->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2247 					imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2248 					}			   	
       
  2249 				}
       
  2250 			else
       
  2251 				{
       
  2252 			    deckLayout->SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime));
       
  2253 			   	posX = posX + mData->mHighlightItemStruct.width + mData->mPadding;
       
  2254 			   	// Change the size if required
       
  2255 			   	if(mData->mChangeSize)
       
  2256 				   	{
       
  2257 					deckLayout->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width,
       
  2258 														mData->mHighlightItemStruct.height,
       
  2259 														aAnimationTime));
       
  2260 					imageVisual->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width,
       
  2261 														mData->mHighlightItemStruct.height,
       
  2262 														aAnimationTime));
       
  2263 				   	}
       
  2264 				}
       
  2265 		    }
       
  2266 		deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(totalVisual-1);
       
  2267 		deckLayout->SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy));
       
  2268 	    control().Env().BatchBufferHandler().FlushBatchBuffer();            
       
  2269 	    control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred);           
       
  2270 		((MulCoverFlowControl*)&control())->UpdateItemAtIndex(totalVisual-1, aAnimationTime);
       
  2271 	    }
       
  2272 	    
       
  2273 	}
       
  2274 	
       
  2275 // ----------------------------------------------------------------------------
       
  2276 // StartDoodling
       
  2277 // This function is used in doodling case. it calls the appropriate function to
       
  2278 // handle doodling based on whether we have to only change the position or both
       
  2279 // position and size.
       
  2280 // ----------------------------------------------------------------------------
       
  2281 //
       
  2282 void MulBaseElement::StartDoodling(int aDistance, int aAnimationTime)
       
  2283 	{
       
  2284 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StartDoodling");
       
  2285 	if (mData->mChangeSize)
       
  2286 		{
       
  2287 		MoveVisualsWithSizeChange(aDistance,aAnimationTime);
       
  2288 		}
       
  2289 	else
       
  2290 		{
       
  2291 		MoveVisuals(aDistance,aAnimationTime);
       
  2292 		}
       
  2293 	}
       
  2294 	
       
  2295 // ----------------------------------------------------------------------------
       
  2296 // StopDoodling
       
  2297 // it calls when we get a gestureunknown or to do a bounce back.
       
  2298 // it basically repositions the visuals based on current highlight.
       
  2299 // it simply calls a startdoodling function with 0 distance and with
       
  2300 //  animation time if required.
       
  2301 // ----------------------------------------------------------------------------
       
  2302 //
       
  2303 void MulBaseElement::StopDoodling(int aAnimationTime)
       
  2304 	{
       
  2305 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StopDoodling");
       
  2306 	StartDoodling(0,aAnimationTime);
       
  2307 	}
       
  2308 	
       
  2309 	
       
  2310 // ----------------------------------------------------------------------------
       
  2311 // MoveVisuals
       
  2312 // This function is used in doodling when only position needs to be change, usefull
       
  2313 // in potrait where 1 visible item is in the screen. 
       
  2314 // The logic is to change the position of all visuals by doodling distance.
       
  2315 // ----------------------------------------------------------------------------
       
  2316 //
       
  2317 void MulBaseElement::MoveVisuals(int aDistance, int aAnimationTime)
       
  2318 	{
       
  2319 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MoveVisuals");
       
  2320 	CancelRotation();
       
  2321 		
       
  2322 	control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); 
       
  2323 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  2324 	int highlightIndex = mData->mVisibleCount;
       
  2325 	
       
  2326 	int highlightPosX = mData->mHighlightItemStruct.posx;
       
  2327 	
       
  2328 	highlightPosX += aDistance;
       
  2329 
       
  2330 	int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding);
       
  2331 	for (int i=0; i < totalVisual ; i++)  
       
  2332 	    {
       
  2333 		CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i);
       
  2334 		
       
  2335 		if (i != mData->mVisibleCount)
       
  2336 			{
       
  2337 			deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime));
       
  2338 		   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2339 			}
       
  2340 		else
       
  2341 			{
       
  2342 		    deckLayout.SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime));
       
  2343 		   	posX = posX + mData->mHighlightItemStruct.width + mData->mPadding;
       
  2344 			}
       
  2345 	    }
       
  2346   	control().Env().BatchBufferHandler().FlushBatchBuffer();            
       
  2347     control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred);           
       
  2348 	}
       
  2349 
       
  2350 // ----------------------------------------------------------------------------
       
  2351 // NumberOfSwipe
       
  2352 // ----------------------------------------------------------------------------
       
  2353 //	
       
  2354 TNumberofSwipes MulBaseElement::NumberOfSwipes()
       
  2355 	{
       
  2356 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::NumberOfSwipes");
       
  2357 	return mData->mNumSwipes;
       
  2358 	}
       
  2359 	
       
  2360 // ----------------------------------------------------------------------------
       
  2361 // FinalSwipeDirection
       
  2362 // ----------------------------------------------------------------------------
       
  2363 //
       
  2364 int MulBaseElement::FinalSwipeDirection(int aDistance, int aLastSwipeDirection)
       
  2365 	{
       
  2366 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::FinalSwipeDirection");
       
  2367 	
       
  2368 	int NewHighlightPos = NearestPoint(FinalMidPoints(ReferenceMidPoints(),aDistance),aLastSwipeDirection);
       
  2369 	
       
  2370 	int scrollDir = EItemNoDirection;
       
  2371 	mData->mNumSwipes = ESingleSwipe;
       
  2372 	
       
  2373 	// now depending on the new highlight position make a decission
       
  2374 	// whether to double swipe or single swipe and in which direction.
       
  2375 	if(mData->mVisibleCount == 1)
       
  2376 		{
       
  2377 		switch(NewHighlightPos)
       
  2378 			{
       
  2379 			case 0:
       
  2380 				{
       
  2381 				scrollDir = EItemScrollLeft;	
       
  2382 				}
       
  2383 			break;
       
  2384 			case 2:
       
  2385 				{
       
  2386 				scrollDir = EItemScrollRight;	
       
  2387 				}
       
  2388 			break;
       
  2389 			case 1:
       
  2390 			default:
       
  2391 			break;				
       
  2392 			}
       
  2393 		}
       
  2394 	else
       
  2395 		{
       
  2396 		switch(NewHighlightPos)
       
  2397 			{
       
  2398 			case 0:
       
  2399 				{
       
  2400 				mData->mNumSwipes = ETripleSwipe; // triple swipe
       
  2401 				scrollDir = EItemScrollLeft;	
       
  2402 				}
       
  2403 			break;
       
  2404 			case 1:
       
  2405 				{
       
  2406 				mData->mNumSwipes = EDoubleSwipe;
       
  2407 				scrollDir = EItemScrollLeft;	
       
  2408 				}
       
  2409 			break;	
       
  2410 			case 2:
       
  2411 				{
       
  2412 				scrollDir = EItemScrollLeft;	
       
  2413 				}
       
  2414 			break;					
       
  2415 			case 4:
       
  2416 				{
       
  2417 				scrollDir = EItemScrollRight;	
       
  2418 				}
       
  2419 			break;
       
  2420 			case 5:
       
  2421 				{
       
  2422 				mData->mNumSwipes = EDoubleSwipe;
       
  2423 				scrollDir = EItemScrollRight;
       
  2424 				}
       
  2425 			break;
       
  2426 			case 6:
       
  2427 				{
       
  2428 				mData->mNumSwipes = ETripleSwipe; // triple swipe
       
  2429 				scrollDir = EItemScrollRight;
       
  2430 				}
       
  2431 			break;									
       
  2432 			case 3:
       
  2433 			default:
       
  2434 			break;				
       
  2435 			}
       
  2436 		}
       
  2437 	return scrollDir;							
       
  2438 	}	
       
  2439 
       
  2440 // ----------------------------------------------------------------------------
       
  2441 // NearestPoint
       
  2442 // ----------------------------------------------------------------------------
       
  2443 //
       
  2444 int MulBaseElement::NearestPoint(std::vector<int> aFinalMidPoints,int aLastSwipeDirection)
       
  2445 	{
       
  2446 	int referencePoint = mData->mHighlightItemStruct.posx + mData->mHighlightItemStruct.width/2;
       
  2447 	int i = 0;
       
  2448 	while(i < aFinalMidPoints.size())
       
  2449 		{
       
  2450 		int temp = 	aFinalMidPoints[i];
       
  2451 		if(aFinalMidPoints[i] > referencePoint)
       
  2452 			{
       
  2453 			break;	
       
  2454 			}
       
  2455 		i++;
       
  2456 		}
       
  2457       
       
  2458 	if(aLastSwipeDirection == EEventScrollLeft)
       
  2459 		{
       
  2460 		return --i;
       
  2461 		}
       
  2462 	return i;
       
  2463 	}
       
  2464 	
       
  2465 // ----------------------------------------------------------------------------
       
  2466 // ReferenceMidPoints
       
  2467 // ----------------------------------------------------------------------------
       
  2468 //
       
  2469 std::vector<int> MulBaseElement::ReferenceMidPoints()
       
  2470 	{
       
  2471 	std::vector<int> referenceMidPoints;
       
  2472 	int highlightMidPoint = mData->mHighlightItemStruct.posx + mData->mHighlightItemStruct.width/2;
       
  2473 	int differnce = mData->mHighlightItemStruct.width/2
       
  2474 			+ mData->mPadding + mData->mItemStruct.width/2 ;
       
  2475 			
       
  2476 	int doubleDiff = mData->mPadding + mData->mItemStruct.width;
       
  2477 	if(mData->mVisibleCount != 1)
       
  2478 		{
       
  2479 		referenceMidPoints.push_back(highlightMidPoint - (differnce
       
  2480 			+ 2 * doubleDiff));
       
  2481 			
       
  2482 		referenceMidPoints.push_back(highlightMidPoint - (differnce
       
  2483 			+ doubleDiff));
       
  2484 		}
       
  2485 	referenceMidPoints.push_back(highlightMidPoint - differnce);
       
  2486 	referenceMidPoints.push_back(highlightMidPoint);
       
  2487 	referenceMidPoints.push_back(highlightMidPoint + differnce);
       
  2488 
       
  2489 	if(mData->mVisibleCount != 1)
       
  2490 		{
       
  2491 		referenceMidPoints.push_back(highlightMidPoint + (differnce
       
  2492 			+ 2 * doubleDiff));	
       
  2493 			
       
  2494 		referenceMidPoints.push_back(highlightMidPoint + (differnce
       
  2495 			+ doubleDiff));						
       
  2496 		}	
       
  2497 	return referenceMidPoints;
       
  2498 	}
       
  2499 
       
  2500 // ----------------------------------------------------------------------------
       
  2501 // FinalMidPoints
       
  2502 // ----------------------------------------------------------------------------
       
  2503 //
       
  2504 std::vector<int> MulBaseElement::FinalMidPoints(std::vector<int> aReferenceMidPoints,int aDistance)
       
  2505 	{
       
  2506 	std::vector<int> newMidPoints;
       
  2507 	for(int i = 0; i < aReferenceMidPoints.size(); i++)
       
  2508 		{
       
  2509 		newMidPoints.push_back(aReferenceMidPoints[i] + aDistance);
       
  2510 		int temp = 	newMidPoints[i];
       
  2511 		}
       
  2512 	return newMidPoints;	
       
  2513 	}
       
  2514 
       
  2515 // ----------------------------------------------------------------------------
       
  2516 // MoveVisualsWithSizeChange
       
  2517 // This function used when during doodling size changes also required.
       
  2518 // ie in case of landscape and visible items are 3 during doodling position as well
       
  2519 // as size change requird.
       
  2520 // The basic logic is we are keeping a reference distance for a complete highlight 
       
  2521 // change (that means the highlight becomes nonhighlight and vice versa). so at 
       
  2522 // any point of time there will be only two visuals whose size needs to be change.
       
  2523 // one to grow and other to shrink. so we  calculate the % of grow and shrink of
       
  2524 // visual keeping the doodling distance and reference distance into consideration.
       
  2525 // ----------------------------------------------------------------------------
       
  2526 //
       
  2527 void MulBaseElement::MoveVisualsWithSizeChange(int aDistance, int aAnimationTime)
       
  2528 	{
       
  2529 	MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MoveVisualsWithSizeChange");
       
  2530 	int totalVisual = 2*mData->mVisibleCount + 1;
       
  2531 	int highlightIndex = mData->mVisibleCount;
       
  2532 	CAlfVisual* imageVisual = NULL;	
       
  2533 	int visualIndexToShrink = -1;
       
  2534 	int visualIndexToGrow = -1;  
       
  2535 	int updateSpecialIndex = -1;  
       
  2536 	int distancefactor = CalculateDistanceChangeFactor ();
       
  2537 	
       
  2538 	int highlightPosX = mData->mHighlightItemStruct.posx;
       
  2539 	highlightPosX += aDistance;
       
  2540 	
       
  2541 	
       
  2542 	if (Abs(aDistance) < distancefactor)
       
  2543 		{
       
  2544 		// user has doodled to change the highlight by 1.Single swipe.
       
  2545 		if (aDistance < 0)
       
  2546 			{
       
  2547 			visualIndexToGrow = highlightIndex +1;
       
  2548 			}
       
  2549 		else if (aDistance > 0)
       
  2550 			{
       
  2551 			visualIndexToGrow = highlightIndex -1;
       
  2552 			}
       
  2553 		else
       
  2554 			{
       
  2555 			// for stop doodling case
       
  2556 			visualIndexToGrow = highlightIndex - 1;
       
  2557 			updateSpecialIndex = highlightIndex + 1;
       
  2558 			}
       
  2559 		visualIndexToShrink = highlightIndex;
       
  2560 		}
       
  2561 	else
       
  2562 		{
       
  2563 		// user has doodled to change the highlight by 2. Double swipe.
       
  2564 		if (aDistance < 0)
       
  2565 			{
       
  2566 			visualIndexToShrink = highlightIndex +1;
       
  2567 			visualIndexToGrow = highlightIndex +2;
       
  2568 			aDistance +=distancefactor;
       
  2569 			}
       
  2570 		else
       
  2571 			{
       
  2572 			visualIndexToShrink = highlightIndex -1;
       
  2573 			visualIndexToGrow = highlightIndex -2;
       
  2574 			aDistance -=distancefactor;
       
  2575 			}
       
  2576 		}
       
  2577 	int changeInPosY = (((mData->mItemStruct.posy - mData->mHighlightItemStruct.posy)*Abs(aDistance))/distancefactor);
       
  2578 	int changeInWidth = (((mData->mHighlightItemStruct.width - mData->mItemStruct.width)*Abs(aDistance))/distancefactor);
       
  2579 	int changeInHeight = (((mData->mHighlightItemStruct.height - mData->mItemStruct.height)*Abs(aDistance))/distancefactor);
       
  2580 
       
  2581 
       
  2582 	int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding);
       
  2583 	for (int i=0; i < totalVisual && i < mData->mIconFlowLayout->Count(); i++)  
       
  2584 	    {
       
  2585 		CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i);
       
  2586 		if (i == visualIndexToShrink)
       
  2587 			{
       
  2588 			int posY = mData->mHighlightItemStruct.posy + changeInPosY;
       
  2589 			int width =mData->mHighlightItemStruct.width - changeInWidth;
       
  2590 			int height =mData->mHighlightItemStruct.height - changeInHeight;
       
  2591 			deckLayout.SetPos( TAlfTimedPoint(posX,posY,aAnimationTime));
       
  2592 			imageVisual = deckLayout.FindTag(KCoverflowIcon);
       
  2593 			deckLayout.SetSize(TAlfTimedPoint(width,height,aAnimationTime));
       
  2594 			imageVisual->SetSize(TAlfTimedPoint(width,height,aAnimationTime));
       
  2595 			posX = posX + width + mData->mPadding;
       
  2596 			}
       
  2597 		else if (i == visualIndexToGrow)
       
  2598 			{
       
  2599 			int posY = mData->mItemStruct.posy - changeInPosY;
       
  2600 			int width = mData->mItemStruct.width + changeInWidth;
       
  2601 			int height = mData->mItemStruct.height + changeInHeight;
       
  2602 			deckLayout.SetPos( TAlfTimedPoint(posX,posY,aAnimationTime));
       
  2603 			imageVisual = deckLayout.FindTag(KCoverflowIcon);
       
  2604 			deckLayout.SetSize(TAlfTimedPoint(width,height,aAnimationTime));
       
  2605 			imageVisual->SetSize(TAlfTimedPoint(width,height,aAnimationTime));
       
  2606 			posX = posX + width + mData->mPadding;
       
  2607 			}
       
  2608 		else if (i == updateSpecialIndex)
       
  2609 			{
       
  2610 			deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime));
       
  2611 			imageVisual = deckLayout.FindTag(KCoverflowIcon);
       
  2612 			deckLayout.SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2613 			imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime));
       
  2614 		   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2615 			}
       
  2616 		else
       
  2617 			{
       
  2618 			deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime));
       
  2619 		   	posX = posX + mData->mItemStruct.width + mData->mPadding;
       
  2620 			}
       
  2621 	    }
       
  2622 	}
       
  2623 
       
  2624 // ----------------------------------------------------------------------------
       
  2625 //RecycleIconVisuals
       
  2626 // ----------------------------------------------------------------------------
       
  2627 //
       
  2628 void MulBaseElement::RecycleIconVisuals()
       
  2629     {
       
  2630     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RecycleIconVisuals");
       
  2631     CAlfTextureManager& textureMgr = control().Env().TextureManager();
       
  2632     TAlfImage image = TAlfImage(textureMgr.BlankTexture());
       
  2633     
       
  2634     for(int i=0; i<mData->mIconFlowLayout->Count(); i++)
       
  2635         {
       
  2636         CAlfVisual& visual = mData->mIconFlowLayout->Visual(i);
       
  2637         CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(visual.FindTag(KCoverflowIcon)); 
       
  2638         // remove the icon brush if any.
       
  2639         RemoveBrushOnIcon(*imageVisual);        
       
  2640         imageVisual->SetImage(image);
       
  2641         
       
  2642         CAlfImageVisual* indicatorVisual =static_cast<CAlfImageVisual*>(visual.FindTag(KCoverflowIndicator));    
       
  2643         if(indicatorVisual)
       
  2644             {
       
  2645             indicatorVisual->SetImage(image);   
       
  2646             }
       
  2647         }
       
  2648 	// cancel the rotation if any.
       
  2649 	if (mData->mRotation.mIsApplied)
       
  2650 		{
       
  2651 		if (mData->mRotation.mIndex >= 0)
       
  2652 			{
       
  2653 			CancelRotation(mData->mRotation.mIndex);
       
  2654 			}
       
  2655 		else
       
  2656 			{
       
  2657 			// rotation applied on highlight index.
       
  2658 			// so cancel it.
       
  2659 			mData->mRotation.mIndex = 1;
       
  2660 			CancelRotation(mData->mRotation.mIndex);
       
  2661 			}
       
  2662 		}
       
  2663     }
       
  2664 
       
  2665 // ----------------------------------------------------------------------------
       
  2666 //IdToTag
       
  2667 // ----------------------------------------------------------------------------
       
  2668 //
       
  2669 const TDesC8& MulBaseElement::IdToTag( int aId )
       
  2670     {
       
  2671     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::IdToTag");
       
  2672     switch( aId )
       
  2673         {
       
  2674         case mulvisualitem::KMulIcon1 :
       
  2675             {
       
  2676             return KCoverflowIcon;
       
  2677             }
       
  2678         case mulvisualitem::KMulTitle :
       
  2679             {
       
  2680             return KCoverflowTitle;
       
  2681             }    
       
  2682         case mulvisualitem::KMulDetail :
       
  2683             {
       
  2684             return KCoverflowDetail;
       
  2685             }  
       
  2686         case mulvisualitem::KMulIndicator2 :
       
  2687             {
       
  2688             return KCoverflowIndicator;
       
  2689             }                               
       
  2690         default:
       
  2691             {
       
  2692             return KInvalidID;
       
  2693             }
       
  2694         }
       
  2695     }
       
  2696  
       
  2697 // ---------------------------------------------------------------------------
       
  2698 // RemoveSliderFromLayout
       
  2699 // ---------------------------------------------------------------------------
       
  2700 //
       
  2701 void MulBaseElement::RemoveSliderFromLayout()
       
  2702     {
       
  2703     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RemoveSliderFromLayout");
       
  2704     IAlfWidget* slider = (static_cast<MulCoverFlowControl&>(control())).GetSliderWidget();
       
  2705     if(slider && slider->control())
       
  2706         {
       
  2707         IMulSliderWidget* sliderwidget = static_cast<IMulSliderWidget*>(slider);
       
  2708         CAlfLayout* sliderContlyt = const_cast<CAlfLayout*>(sliderwidget->control()->ContainerLayout(NULL));
       
  2709         mData->mVerticalFlow->Remove(sliderContlyt);
       
  2710         }
       
  2711     
       
  2712     }    
       
  2713 
       
  2714 // ---------------------------------------------------------------------------
       
  2715 // RotateImage
       
  2716 // ---------------------------------------------------------------------------
       
  2717 //
       
  2718 void MulBaseElement::RotateImage(IMulWidget::TMulRotation aDirection,TSize aImageSize,int aAnimationTime,bool aAdjustSize)
       
  2719 	{
       
  2720     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RotateImage");
       
  2721 	
       
  2722 	__MUL_ASSERT( mData->mIconFlowLayout->Count() != 0,KNullPointer);
       
  2723 		
       
  2724 	if (Template2D()->IsUiOnOffFlagEnabled())
       
  2725 		{
       
  2726 		CAlfVisual& visual = mData->mIconFlowLayout->Visual(1);
       
  2727 		CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(visual.FindTag(KCoverflowIcon)); 
       
  2728 		
       
  2729 		if (!aAdjustSize)
       
  2730 			{
       
  2731 			// Take care the case where rotation was
       
  2732 			// applied to the previous highlight index
       
  2733 			// cancel the rotation on that visual  
       
  2734 			CancelRotation(mData->mRotation.mIndex);
       
  2735 
       
  2736 			switch(aDirection)
       
  2737 				{
       
  2738 				case IMulWidget::ERotateLeft:
       
  2739 					{
       
  2740 					mData->mRotation.mImageAngle = (mData->mRotation.mImageAngle + 90)%360;
       
  2741 					imageVisual->EnableTransformationL();
       
  2742 					imageVisual->Transformation().Rotate(TAlfTimedValue(90,aAnimationTime));
       
  2743 					mData->mRotation.mIsApplied = true;
       
  2744 					break;
       
  2745 					}
       
  2746 				case IMulWidget::ERotateRight:
       
  2747 					{
       
  2748 					mData->mRotation.mImageAngle = (mData->mRotation.mImageAngle - 90)%360;
       
  2749 					imageVisual->EnableTransformationL();
       
  2750 					imageVisual->Transformation().Rotate(TAlfTimedValue(-90,aAnimationTime));
       
  2751 					mData->mRotation.mIsApplied = true;
       
  2752 					break;
       
  2753 					}
       
  2754 				default:
       
  2755 					break;
       
  2756 				}
       
  2757 			// store the actual texture size of image to be rotated.
       
  2758 			mData->mRotation.mTextureSize = aImageSize;
       
  2759 			}
       
  2760 			
       
  2761 		AdjustVisualSizeInRotation(imageVisual, aAnimationTime);
       
  2762 		}
       
  2763 	}
       
  2764 
       
  2765 // ---------------------------------------------------------------------------
       
  2766 // AdjustVisualSizeInRotation
       
  2767 // ---------------------------------------------------------------------------
       
  2768 //
       
  2769 void MulBaseElement::AdjustVisualSizeInRotation(CAlfImageVisual* aVisual,int aAnimationTime)
       
  2770 	{
       
  2771     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::AdjustVisualSizeInRotation");
       
  2772 
       
  2773 	bool isLandScape = static_cast<MulCoverFlowControl&>(control()).IsLandscape();
       
  2774 	int shortEdge = !isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height;
       
  2775 		 			 			
       
  2776 	if( mData->mRotation.mTextureSize.iWidth <= shortEdge && mData->mRotation.mTextureSize.iHeight <= shortEdge)
       
  2777 	    {
       
  2778 	    return;
       
  2779 	    }
       
  2780 	else
       
  2781 	    {
       
  2782 	    switch(Abs(mData->mRotation.mImageAngle))
       
  2783 	    	{
       
  2784 	    	case 90:
       
  2785 	    	case 270:
       
  2786 	        	{
       
  2787 	        	HandleRotationOnVerticalAxis(aVisual,aAnimationTime);
       
  2788 	        	}
       
  2789 	    	break;
       
  2790 	    	case 0:
       
  2791 	    	case 180:
       
  2792 	    		{
       
  2793 	    		HandleRotationOnHorizontalAxis(aVisual,aAnimationTime);
       
  2794 	    		}
       
  2795 	        break;
       
  2796 	    	default:
       
  2797 	    		break;
       
  2798 	    	}
       
  2799 	    }
       
  2800 	}
       
  2801 
       
  2802 // ---------------------------------------------------------------------------
       
  2803 // HandleRotationOnVerticalAxis
       
  2804 // ---------------------------------------------------------------------------
       
  2805 //
       
  2806 void MulBaseElement::HandleRotationOnVerticalAxis(CAlfImageVisual* aVisual,int aAnimationTime)
       
  2807 	{
       
  2808     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleRotationOnVerticalAxis");
       
  2809 
       
  2810 	bool isLandScape = static_cast<MulCoverFlowControl&>(control()).IsLandscape();
       
  2811 	int longEdge = isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height;
       
  2812 	int shortEdge = !isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height;
       
  2813 
       
  2814 	if (isLandScape)
       
  2815 		{
       
  2816 		if(mData->mRotation.mTextureSize.iWidth > shortEdge) 
       
  2817 			{
       
  2818 			// make the visual of shortEdge size and fit the image by width.
       
  2819 			aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,0),aAnimationTime);
       
  2820 			aVisual->SetSize(TAlfRealSize(shortEdge,shortEdge),aAnimationTime);
       
  2821 			aVisual->SetScaleMode(CAlfImageVisual::EScaleFitWidth); 
       
  2822 			}
       
  2823 		else 
       
  2824 			{
       
  2825 			//imageHeight > shortEdge and imageWidth < shortEdge
       
  2826 			if (mData->mRotation.mTextureSize.iHeight > longEdge)
       
  2827 				{
       
  2828 				aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,shortEdge/2 -longEdge/2),aAnimationTime);
       
  2829 				aVisual->SetSize(TAlfRealSize(shortEdge,longEdge),aAnimationTime);
       
  2830 				}
       
  2831 			else
       
  2832 				{
       
  2833 				aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,shortEdge/2 - mData->mRotation.mTextureSize.iHeight/2),aAnimationTime);
       
  2834 				aVisual->SetSize(TAlfRealSize(shortEdge,mData->mRotation.mTextureSize.iHeight),aAnimationTime);
       
  2835 				}
       
  2836 			aVisual->SetScaleMode(CAlfImageVisual::EScaleFitHeight);            				
       
  2837 			}
       
  2838 		}
       
  2839 	else
       
  2840 		{
       
  2841 		if(mData->mRotation.mTextureSize.iHeight > shortEdge) 
       
  2842 			{
       
  2843 			// make the visual of shortEdge size and fit the image by height.
       
  2844 			aVisual->SetPos(TAlfRealPoint(0,longEdge/2 - shortEdge/2),aAnimationTime);
       
  2845 			aVisual->SetSize(TAlfRealSize(shortEdge,shortEdge),aAnimationTime);
       
  2846 			aVisual->SetScaleMode(CAlfImageVisual::EScaleFitHeight);
       
  2847 			}
       
  2848 		else  
       
  2849 			{
       
  2850 			//imageWidth > shortEdge and imageHeight < shortEdge
       
  2851 			if (mData->mRotation.mTextureSize.iWidth > longEdge)
       
  2852 				{
       
  2853 				aVisual->SetPos(TAlfRealPoint(shortEdge/2 - longEdge/2,longEdge/2 - shortEdge/2),aAnimationTime);
       
  2854 				aVisual->SetSize(TAlfRealSize(longEdge,shortEdge),aAnimationTime);
       
  2855 				}
       
  2856 			else
       
  2857 				{
       
  2858 				aVisual->SetPos(TAlfRealPoint(shortEdge/2 - mData->mRotation.mTextureSize.iWidth/2,longEdge/2 - shortEdge/2),aAnimationTime);
       
  2859 				aVisual->SetSize(TAlfRealSize(mData->mRotation.mTextureSize.iWidth,shortEdge),aAnimationTime);
       
  2860 				}
       
  2861 			// @todo check if this effective height after fit by width can ever be more than
       
  2862 			// the shorter edge. If yes then this fit mode should be chnged to fit inside(check this)
       
  2863 			aVisual->SetScaleMode(CAlfImageVisual::EScaleFitWidth);
       
  2864 			}
       
  2865 		}
       
  2866 	}
       
  2867 
       
  2868 // ---------------------------------------------------------------------------
       
  2869 // HandleRotationOnHorizontalAxis
       
  2870 // ---------------------------------------------------------------------------
       
  2871 //	
       
  2872 void MulBaseElement::HandleRotationOnHorizontalAxis(CAlfImageVisual* aVisual,int aAnimationTime)
       
  2873 	{
       
  2874     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleRotationOnHorizontalAxis");
       
  2875 	
       
  2876 	aVisual->SetPos(TAlfRealPoint(0,0),aAnimationTime);
       
  2877 	aVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height),aAnimationTime);
       
  2878 	ApplyScaleMode(*aVisual);
       
  2879 	}
       
  2880 		
       
  2881 // ---------------------------------------------------------------------------
       
  2882 // CancelRotation
       
  2883 // ---------------------------------------------------------------------------
       
  2884 //
       
  2885 void MulBaseElement::CancelRotation(int aIndex)
       
  2886 	{
       
  2887     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CancelRotation");
       
  2888 	
       
  2889 	if (mData->mRotation.mIsApplied)
       
  2890 		{
       
  2891 		if (mData->mRotation.mIndex >= 0)
       
  2892 			{
       
  2893 			// revert it back
       
  2894 			mData->mRotation.mImageAngle = 0;
       
  2895 			CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(mData->mRotation.mIndex);
       
  2896 			CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(deckLayout.FindTag(KCoverflowIcon));
       
  2897 			imageVisual->EnableTransformationL();
       
  2898 			imageVisual->Transformation().LoadIdentity();
       
  2899 			// reset the rotation property
       
  2900 			mData->mRotation.mIsApplied = false;
       
  2901 			mData->mRotation.mIndex = -1;   
       
  2902         	imageVisual->SetPos(TAlfRealPoint(0,0));
       
  2903 			imageVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height));
       
  2904 			ApplyScaleMode(*imageVisual);			
       
  2905 			}
       
  2906 		else
       
  2907 			{
       
  2908 			mData->mRotation.mIndex = aIndex;
       
  2909 			}
       
  2910 		}	    
       
  2911 	}
       
  2912 
       
  2913 // ---------------------------------------------------------------------------
       
  2914 // CancelRotationOnUpdate
       
  2915 // ---------------------------------------------------------------------------
       
  2916 //
       
  2917 void MulBaseElement::CancelRotationOnUpdate(int aIndex)
       
  2918 	{
       
  2919     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CancelRotationOnUpdate");
       
  2920 	
       
  2921 	if (mData->mRotation.mIsApplied)
       
  2922 		{
       
  2923 		if (mData->mRotation.mIndex < 0 || mData->mRotation.mIndex == aIndex)
       
  2924 			{
       
  2925 			// revert it back
       
  2926 			mData->mRotation.mImageAngle = 0;
       
  2927 			CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(aIndex);
       
  2928 			CAlfImageVisual* imageVisual = static_cast<CAlfImageVisual*>(deckLayout.FindTag(KCoverflowIcon));
       
  2929 			imageVisual->EnableTransformationL();
       
  2930 			imageVisual->Transformation().LoadIdentity();
       
  2931 			// reset the rotation property
       
  2932 			mData->mRotation.mIsApplied = false;
       
  2933 			mData->mRotation.mIndex = -1;   
       
  2934         	imageVisual->SetPos(TAlfRealPoint(0,0));
       
  2935 			imageVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height));
       
  2936 			ApplyScaleMode(*imageVisual);			
       
  2937 			}
       
  2938 		}	    
       
  2939 	}
       
  2940 		
       
  2941 // ---------------------------------------------------------------------------
       
  2942 // UpdateRotation
       
  2943 // ---------------------------------------------------------------------------
       
  2944 //
       
  2945 void MulBaseElement::UpdateRotation()
       
  2946 	{
       
  2947     MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateRotation");
       
  2948 	
       
  2949 	if (mData->mRotation.mIsApplied)
       
  2950 		{
       
  2951 		// rotation applied on the highlight item.
       
  2952 		if (mData->mRotation.mIndex < 0)
       
  2953 			{
       
  2954 			RotateImage(IMulWidget::ERotateLeft,TSize(0,0),0,true);
       
  2955 			}
       
  2956 		}	    
       
  2957 	}	
       
  2958 
       
  2959     } //namespace Alf
       
  2960     
       
  2961 //End of file