mulwidgets/mulcoverflowwidget/inc/mulbaseelement.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     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 header for CoverFlow
       
    15 *
       
    16 */
       
    17 
       
    18 // This file defines the API for MulCoverFlowWidget.dll
       
    19 
       
    20 #ifndef __MULBASEELEMENT_H__
       
    21 #define __MULBASEELEMENT_H__
       
    22 
       
    23 
       
    24 //  Include Files
       
    25 #include <alf/alfdecklayout.h>
       
    26 #include "alf/alfelement.h"
       
    27 #include <alf/alfflowlayout.h>
       
    28 #include <alf/alfwidgeteventhandler.h>
       
    29 #include <mul/imulwidget.h>
       
    30 
       
    31 #include "mulcoverflowdefinitions.h"
       
    32 
       
    33 namespace Alf
       
    34     {
       
    35     
       
    36 //Forward declarations    
       
    37 class MulCoverFlowTemplate; 
       
    38 struct TMulBaseElementImpl;
       
    39 
       
    40 // Structure to store the position and sizes of cover flow items
       
    41 struct TMulCoverFlowItem
       
    42     {
       
    43     int height;
       
    44     int width;
       
    45     int posx;
       
    46     int posy;
       
    47     
       
    48     TMulCoverFlowItem()
       
    49     	:height(0),width(0),posx(0),posy(0){}
       
    50 
       
    51     TMulCoverFlowItem(int aPosx,int aPosy,int aWidth,int aHight)
       
    52     	:posx(aPosx),posy(aPosy),width(aWidth),height(aHight){}
       
    53         
       
    54     };
       
    55 
       
    56 namespace mulbaseelement
       
    57     {
       
    58      static const IfId Ident=
       
    59         {
       
    60         0,"mulbaseelement"
       
    61         };
       
    62     }
       
    63 
       
    64 
       
    65 /* Element class which handles all the visuals in the layout
       
    66  * The class also handles  event handling and applies animation as required
       
    67  * by the widget.The class forms the basis of the entire layout heriarchy in the widget
       
    68  * */
       
    69 /// @bug minor:avanhata:7/7/2008 This class is coverflow-specific, so name it as such
       
    70 class MulBaseElement : public AlfElement, 
       
    71                        public IAlfWidgetEventHandler
       
    72     {
       
    73 public://Constructor and destructor
       
    74     
       
    75    /**
       
    76     * C++ constructor.
       
    77     */
       
    78     MulBaseElement( CAlfWidgetControl& aControl, const char* aName );
       
    79     
       
    80     /**
       
    81      * Destructor.
       
    82      */
       
    83     virtual ~MulBaseElement();
       
    84             
       
    85         
       
    86 public: //From IAlfWidgetEventHandler
       
    87 
       
    88     static inline const IfId& Type()
       
    89         {
       
    90         return mulbaseelement::Ident;    
       
    91         } 
       
    92         
       
    93     bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
       
    94     
       
    95     void setActiveStates( unsigned int aStates );
       
    96     
       
    97     AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
       
    98     
       
    99     IAlfInterfaceBase* makeInterface( const IfId& aType ); 
       
   100     
       
   101     void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData );
       
   102 	  
       
   103 	AlfWidgetEventHandlerInitData* eventHandlerData();
       
   104 	
       
   105 	AlfEventHandlerType eventHandlerType() ;
       
   106 
       
   107     AlfEventHandlerExecutionPhase eventExecutionPhase() ;
       
   108 
       
   109 public: //New Methods
       
   110 
       
   111     /**
       
   112 	 * Sets the Item Brush Color.
       
   113 	 * @param aColor color to be set.
       
   114 	 */
       
   115     void SetItemBrush(const TRgb& aColor); 
       
   116     
       
   117      /**
       
   118 	 * changes the opacity of counter accordingly.
       
   119 	 * @param aUiOn true if UIOn or else false.
       
   120 	 * @param aTransitionTime transition time.
       
   121 	 */
       
   122     void UIOnOffMode(bool aUiOn, int aTransitionTime);
       
   123     
       
   124     /**
       
   125 	 * Sets the Scroll direction during the step scroll.
       
   126 	 * @param TItemScroll sets the direction if it is right or left.
       
   127 	 */
       
   128     void SetTextColor(TTextVisualType aVisualType, const TRgb& aColor);
       
   129     
       
   130     /**
       
   131 	 * returns the color of the specified text
       
   132 	 * @param aVisualType is the visual type.
       
   133 	 */
       
   134 	TMulVisualColorProperty TextColor(TTextVisualType aVisualType);
       
   135     
       
   136     
       
   137     /**
       
   138 	 * Sets the Scroll direction during the step scroll.
       
   139 	 * @param TItemScroll sets the direction if it is right or left.
       
   140 	 */
       
   141     void SetScrollDir( TItemScroll aScrollDir );
       
   142     
       
   143     /**
       
   144      * Update the text opacity and counter values whenever highlight is modified
       
   145      *
       
   146      * @param aAnimationTime, text will be updated after the aAnimationTime.
       
   147      */
       
   148     void UpdateTextAndCounter(int animationTime = 0); 
       
   149     
       
   150     /**
       
   151      * Stores the dimensions of the highlighted and nonhighlighted item from the template.
       
   152      * 
       
   153      * @param aHighlightItemDimensions The highlight item dimensions .
       
   154      * @param aNonHighlightItemDimensions The non highlight item dimensions.
       
   155      * @param aVisibleIconCount The count of visible items on screen.
       
   156      */
       
   157     void StoreVisualDimensions( TMulCoverFlowItem aHighlightItemDimensions, TMulCoverFlowItem aNonHighlightItemDimensions,int aVisibleIconCount );
       
   158     
       
   159     /**
       
   160      * Stores whether the text is visible or not in the current orientation and template.
       
   161      *
       
   162      * @parama aIsTextVisible Boolean value indicating whether text is there or not.
       
   163      */
       
   164     void StoreTextVisibility( bool aIsTextVisible );
       
   165     
       
   166     /**
       
   167      * Return is the textvisible or not
       
   168      * 
       
   169      */
       
   170     bool IsTextVisibile( ) const ;
       
   171     
       
   172 	/**
       
   173 	 *  
       
   174 	 *
       
   175 	 */
       
   176     void ApplyBrushOnIcon( CAlfImageVisual& aImageVisual );
       
   177     
       
   178     /**
       
   179 	 *  
       
   180 	 *
       
   181 	 */
       
   182 	void RemoveBrushOnIcon( CAlfImageVisual& aImageVisual );
       
   183         
       
   184  	/**
       
   185 	 * To hide and unhide Widget.
       
   186 	 *
       
   187 	 * @param aShow                 value to hide/unhide the Widget 
       
   188 	 * @param aTransitionTime       Transition Time in MilliSeconds
       
   189 	 */
       
   190 	void ShowWidget( bool aShow, int aTransitionTime = 0) ;
       
   191 	
       
   192 	/*
       
   193 	 * Takes the new positions of the visuals and applies the same to the visuals
       
   194 	 * On change of orientation
       
   195 	 */
       
   196 	void OrientationChange();
       
   197 	
       
   198 	/**
       
   199 	 * Sets the empty text to be displayed when the number of items is 0.
       
   200 	 * 
       
   201 	 * @param aDefaultText The text to be displayed.
       
   202 	 */
       
   203 	void SetEmptyText( const UString& aDefaultText );
       
   204 	
       
   205 	/**
       
   206 	 * Shows/Hide the empty text when the number of items in the model or layout is 0 . Also when the model is NULL.
       
   207 	 * 
       
   208 	 * @param aShow Boolean value to show/hide the empty text.
       
   209 	 */
       
   210 	void ShowEmptyText( bool aShow );
       
   211 	
       
   212 	/**
       
   213 	 * Returns true if empty text is set by the application else returns false.
       
   214 	 * 
       
   215 	 * @returns true if empty text is set else returns false.
       
   216 	 */
       
   217 	bool IsEmptyText();
       
   218 	
       
   219 	/**
       
   220 	 * Updates the Slider Widget ticks when item is added or removed
       
   221 	 *
       
   222 	 * @param aUpdateTick takes the count of items in the coverflow widget
       
   223 	 */
       
   224 	void UpdateSliderTick(int aUpdateTick);
       
   225 
       
   226 	/**
       
   227      * Returns the icon/text flow layout in vertical flow layout
       
   228      * 
       
   229      * @param aLayoutIndex the index will determine which layout to return from the main/vertical flow layout
       
   230      */
       
   231     CAlfLayout& FlowLayout( int aLayoutIndex );
       
   232       
       
   233 	 /**
       
   234 	  *
       
   235 	  * Sets the text to be displayed for the counter element .
       
   236 	  *
       
   237 	  * @param aTransitionTime the transition time in milliseconds for animation 
       
   238 	  */
       
   239 	 void SetCounterText( int aTransitionTime = 0 );
       
   240     
       
   241     /**
       
   242      * Creates a visual for counter if not created initailly else return the existing counter visual.
       
   243      */
       
   244     CAlfTextVisual& CounterVisual();
       
   245       
       
   246     /**
       
   247      * Move the Iconflow by a items width in case of bounce effect.
       
   248      * 
       
   249      * @param aBounceDirection Tells the direction by which the iconflowlayout should move.
       
   250      */
       
   251     void StartBounce(int aBounceDirection); 
       
   252     
       
   253     /**
       
   254      * Returns whether its in Ui on mode or not.
       
   255      * 
       
   256      * @return true if its currently in Ui on mode.
       
   257      */    
       
   258     bool IsUiOnMode();    
       
   259 
       
   260 	/**
       
   261 	 * Creates the text visuals if it is not created, else returns the existing 
       
   262 	 * visual for the title and detail text.
       
   263 	 * 
       
   264 	 * @param aTextString, visual tag
       
   265 	 * @param aLayout, Layout in which to create the text visual
       
   266 	 */      
       
   267     CAlfTextVisual& CreateTextVisual(const TDesC8& aName, CAlfLayout& aLayout); 
       
   268 	
       
   269 	/**
       
   270 	 * Updates the value of the text visuals when an image has scrolled .
       
   271 	 * 
       
   272 	 * @param aAnimationTime, text will be updated after the aAnimationTime.
       
   273 	 */
       
   274 	void UpdateTextValue( int aAnimationTime = 0);
       
   275 	
       
   276 	/**
       
   277 	 * returns the layout to text.
       
   278 	 */
       
   279 	CAlfLayout& TextLayout();
       
   280     
       
   281     /**
       
   282      * Start marquee for the text.
       
   283      * 
       
   284      * @param aName, text type is title or detail 
       
   285      */
       
   286     void StartMarquee(mulvisualitem::TVisualAttribute aName );
       
   287     
       
   288     /**
       
   289      * Stop marquee for the text.
       
   290      * 
       
   291      * * @param aName, text type is title or detail 
       
   292      */
       
   293 	void StopMarquee(mulvisualitem::TVisualAttribute aName);
       
   294 	
       
   295 	/**
       
   296 	 * Decide whether to show or hide the slider based on the parameter.
       
   297 	 *
       
   298 	 * @param aFlag, boolean to decide slider to be shown or not.
       
   299 	 */	
       
   300 	void ShowSlider(bool aFlag);
       
   301 	
       
   302 	/**
       
   303 	 * Return size of hightlight icon for the template specified .
       
   304 	 *
       
   305 	 * @param aTemplateId, id of the template whose icon size to be calculated.
       
   306 	 * @param aAttribute, attribute whose size is to be calculated.
       
   307 	 * @param aHeight, refrence in which the height parameter is returned.
       
   308 	 * @param aWidth, refrence in which the width parameter is returned.
       
   309 	 */	
       
   310 	void GetIconSize( mulwidget::TLogicalTemplate aTemplateId, 
       
   311 		    mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth);
       
   312 	
       
   313 	/**
       
   314 	 * Sets the Scroll Animation Time defined by the application.
       
   315 	 *
       
   316 	 * @param aScrollAnimationTime, ScrollAnimation Time set by the application.
       
   317 	 */	
       
   318 
       
   319 	void SetScrollAnimationTime( int aScrollAnimationTime );
       
   320 
       
   321 	/**
       
   322 	 * Set background for coverflow
       
   323 	 *
       
   324 	 * @param aColor, background color.
       
   325 	 */
       
   326 	void SetBackground(const TRgb& aColor);
       
   327     
       
   328 	/**
       
   329 	 * Set background for coverflow.
       
   330 	 *
       
   331 	 * @param aIID, Skin id that shoudl be used as background.
       
   332 	 */    
       
   333     void SetBackground(const TAknsItemID& aIID);
       
   334     
       
   335     /**
       
   336      * Stores the fit mode flag (on or off).
       
   337      * 
       
   338      * @param aFlag fitmode flag
       
   339      */
       
   340    	void SetFitMode(bool aFlag);
       
   341    	
       
   342     /**
       
   343      * Apply scale mode on image visual and also appy brush for remaining area.
       
   344      * 
       
   345      * @param aImageVisual Image visual
       
   346      */
       
   347     void ApplyScaleMode( CAlfImageVisual& aImageVisual);
       
   348     
       
   349 	/**
       
   350 	 *  
       
   351 	 *
       
   352 	 */    
       
   353 	void CreateAndInitializeVisuals(bool aIsOrientationChange = false);
       
   354 	
       
   355 	/**
       
   356 	 *  
       
   357 	 *
       
   358 	 */	
       
   359 	void SetHighlight(int aHighlightIndex, int aAnimationTime = 0);
       
   360 	
       
   361 	/**
       
   362 	 *  
       
   363 	 *
       
   364 	 */	
       
   365 	void MoveVisuals(int aDistance,int aAnimationTime = 0);
       
   366 	
       
   367 	/**
       
   368 	 *  
       
   369 	 *
       
   370 	 */	
       
   371     CAlfVisual* CreateIconStructure(CAlfLayout* aParentLayout);
       
   372     
       
   373 	/**
       
   374 	 *  
       
   375 	 *
       
   376 	 */	
       
   377 	void MoveVisualsWithSizeChange(int aDistance, int aAnimationTime=0);
       
   378 	
       
   379 	/**
       
   380 	 *  
       
   381 	 *
       
   382 	 */	
       
   383 	void StartDoodling(int aDistance, int aAnimationTime=0);
       
   384 	
       
   385 	/**
       
   386 	 *  
       
   387 	 *
       
   388 	 */	
       
   389 	void StopDoodling(int aAnimationTime=0);
       
   390 	
       
   391     /**
       
   392      * Recycle the Icon visuals instead of destroying and creating them each time.
       
   393      */
       
   394     void RecycleIconVisuals();
       
   395     
       
   396 	/**
       
   397 	 *  
       
   398 	 *
       
   399 	 */		
       
   400 	void UpdateVisuals();    
       
   401 
       
   402 	/**
       
   403 	 * Sets the specified size to the base layout and deck layout and also on the empty text visual
       
   404 	 */
       
   405 	void SetDefaultSize( TSize aSize );
       
   406 	
       
   407 	/**
       
   408 	 * Displays the indicator icon for the specified item index.
       
   409 	 *
       
   410 	 * @param aVisualItem visual item which conatins the index.
       
   411 	 * @param aIndex index of the item.
       
   412 	 */
       
   413 	void DisplayIndicatorIcon(const MulVisualItem & aVisualItem, int aIndex);
       
   414 	
       
   415 	/**
       
   416 	 * Returns whether the user has doodled enough to change the highlight multiple times.
       
   417 	 *
       
   418 	 * @returns TNumberofSwipes, Doodling distance converted into multiple swipes.
       
   419 	 */
       
   420 	TNumberofSwipes NumberOfSwipes();
       
   421 		
       
   422 	/**
       
   423 	 *  Returns the final swipe direction based on which highlight is nerest to teh centre point
       
   424 	 * in the last direction
       
   425 	 *
       
   426 	 * @param aDistance, doodled distance
       
   427 	 * @param, aastSwipeDirection, last direction in which the user has swiped.
       
   428 	 */	
       
   429 	int FinalSwipeDirection(int aDistance, int aLastSwipeDirection);	
       
   430 	
       
   431 	/**
       
   432 	 * Returns teh current direction in which itesm are scrolled
       
   433 	 *
       
   434 	 * @return, Scroll direction
       
   435 	 */		
       
   436 	TItemScroll ScrollDir();
       
   437 
       
   438 	/**
       
   439 	 * Removes the slider layout form the coverflow main layout
       
   440 	 *
       
   441 	 */	
       
   442 	void RemoveSliderFromLayout();	
       
   443 	
       
   444 	/**
       
   445 	 *  Rotate the image in teh given direction
       
   446 	 * 
       
   447 	 * @param aDirection, Direction of the rotation (ERotateLeft/ERotateRight).
       
   448 	 * @param aImageSize, The actual size of the current highlighted image.
       
   449 	 * @param aTransition transition time to rotate the image.
       
   450 	 * @param aAdjustSize, true for orientation change 
       
   451 	 *
       
   452 	 */		
       
   453 	void RotateImage(IMulWidget::TMulRotation aDirection,TSize aImageSize,int aAnimationTime,bool aAdjustSize = false);
       
   454 	
       
   455 	/**
       
   456 	 *  If the image on which rotation is applied, is updated then remove the rotation
       
   457 	 *
       
   458 	 * @param aIndex, relative index which is updated
       
   459 	 */			
       
   460 	void CancelRotationOnUpdate(int aIndex);
       
   461 	
       
   462 private: 
       
   463 	
       
   464 	/**
       
   465      * Set the virtual Size of viewportlayout(parent) of text 
       
   466      *
       
   467      * @param aName, text type is title or detail 
       
   468      */
       
   469     void SetVirtualViewPortSize(mulvisualitem::TVisualAttribute aName);
       
   470 	
       
   471     /**
       
   472      * Cancell all the custom commands related to marquee. 
       
   473      */
       
   474     void CancelAllCommands(); 
       
   475 	
       
   476 	/**
       
   477      * Reset counter opacity( depending on the current ui on/off mode
       
   478      *  when an item is added to an empty model.
       
   479      *
       
   480      * @param aTransitioTime transition time defined by app.
       
   481      */
       
   482     void ResetUiOnOff( int aTransitionTime = 0 );
       
   483     
       
   484     /**
       
   485      * Calculate the new position for counter visual based on the value of the higlight index and total model count
       
   486      *
       
   487      * @param aCounterLctDimension Lct Dimensions of counter visual.
       
   488      * @param aOrientationChanged Orientation Changed or not
       
   489      */
       
   490     void SetNewCounterPosition(const TMulCoverFlowItem& aCounterLctDimension,bool aOrientationChanged = false );
       
   491     
       
   492     /**
       
   493      * Returns number of digits in a number.
       
   494      *
       
   495      * @param aNumber The number whose number of digits have to be found.
       
   496      * @returns Number of digits in a number.
       
   497      */
       
   498     int NumberOfDigits(int aNumber);
       
   499     
       
   500 	/**
       
   501      * Returns the current 2D coverflow template.
       
   502      */	
       
   503     MulCoverFlowTemplate*  Template2D();
       
   504         
       
   505     //slider related apis
       
   506 	/**
       
   507 	 * Created the slider widget and calls the other function related to slider.
       
   508 	 */
       
   509 	void CreateSlider();
       
   510 	
       
   511 	/**
       
   512 	 * Constructs the slider widget if its not already constructed .
       
   513 	 */
       
   514 	void ConstructSliderWidget();
       
   515 	
       
   516 	/**
       
   517 	 * Checks whether slider needs to be shown or hidden and sets its opacity accordingly.
       
   518 	 *
       
   519 	 */
       
   520 	void SetSliderOpacity();
       
   521 	
       
   522 	/**
       
   523 	 * Creates the base layout structure required for the base element to contain
       
   524 	 * images and slider and meta data information . 
       
   525 	 */
       
   526 	void CreateBaseLayoutStructure();
       
   527 	
       
   528 	/**
       
   529 	 * Sets the text data of the current highlight to the  text visual .
       
   530 	 * 
       
   531 	 * @param aName The name of the visual  in the text visual e.g mul_tiltle or mul_detail.
       
   532 	 * @param aData The variant type containing the new data to be set to the text visual .
       
   533 	 */
       
   534 	void SetTextToVisual( mulvisualitem::TVisualAttribute aName,IMulVariantType* aData );
       
   535 		
       
   536      /**
       
   537       * Create empty text visualisation to show empty text when there are no items to display .
       
   538       */
       
   539      void CreateEmptyTextVisualisation();
       
   540      
       
   541      /**
       
   542       * Decides the size to be applied on the main layout depending on whether the model is null or not.
       
   543       */
       
   544      void HandleSizeChangeOnMain();
       
   545      
       
   546      /**
       
   547       * Shows/Hides the text and counter visuals when empty text has to be hidden/shown.
       
   548       *
       
   549       * @param aShow true when text/counter have to be shown , 
       
   550       *              false when text/counter have to be hidden.
       
   551       */
       
   552      void ShowHideVisualsForEmptyText( bool aShow );
       
   553 	 
       
   554 	 /**
       
   555 	  * Calculates the padding between the images based on the position
       
   556 	  * and sizes of the highlighted and non higlighted items.
       
   557 	  */
       
   558 	 void CalculatePadding();
       
   559 	 
       
   560 	 /**
       
   561 	  *
       
   562 	  * Sets opacity to the counter text visual .
       
   563 	  *
       
   564 	  * @param aOpacity, opacity value that should be set
       
   565 	  */	 
       
   566 	 void SetCounterTextOpacity( int aOpacity);	     
       
   567 	
       
   568       /**
       
   569 	   * Arranging the Visual with padding and using Transition time
       
   570 	   * 
       
   571 	   */
       
   572 	 void ArrangeItems();    
       
   573 
       
   574      /**
       
   575       * Sets the opacity of all the text visuals in the specifed visual  to the given opacity (aOpacity)
       
   576       * 
       
   577       * @param aOpacity The opacity to be set for the text visuals .
       
   578       * @param aTransitionTime The transition time
       
   579       */
       
   580      void SetTextVisualOpacity(  int aOpacity , int aTransitionTime = 0 );
       
   581      
       
   582       /**
       
   583 	   * Returns the percentage factor with which new Position and Sizes are calculated  .
       
   584 	   * 
       
   585 	   * @returns The change in percentage to be applied on the current size and position.
       
   586 	   */
       
   587      int CalculateDistanceChangeFactor(); 
       
   588     
       
   589 	/**
       
   590 	 *  
       
   591 	 *
       
   592 	 */		
       
   593 	void CreateVisuals();
       
   594 
       
   595 	 /**
       
   596       * Creates a Indicator Image visual if not created initially.
       
   597       * 
       
   598       * @param aLayout decklayout to which icon is to be added .
       
   599       */
       
   600 	CAlfImageVisual*  CreateIndicatorIconVisual(CAlfDeckLayout& aLayout);
       
   601 
       
   602 	/**
       
   603 	 *  
       
   604 	 *
       
   605 	 */		
       
   606 	void  SetIndicatorDimensions(CAlfImageVisual& aIndicatorVisual); 
       
   607 	
       
   608 	/**
       
   609 	 *  
       
   610 	 *
       
   611 	 */		
       
   612 	const TDesC8& IdToTag( int aId );
       
   613 	
       
   614 	/**
       
   615 	 * Creates an array of midpoints of all the visuals form left to right
       
   616 	 *
       
   617 	 * @return, array of midpoints
       
   618 	 */	
       
   619 	std::vector<int> ReferenceMidPoints();
       
   620 
       
   621 	/**
       
   622 	 * Calculates the new midpoints after the doodling
       
   623 	 *
       
   624 	 * @param aReferenceMidPoints,midpoints before doodling
       
   625 	 * @param aDistance, final doodled distance
       
   626 	 * @return array of new midpoints
       
   627 	 */		
       
   628 	std::vector<int> FinalMidPoints(std::vector<int> aReferenceMidPoints,int aDistance);
       
   629 
       
   630 	/**
       
   631 	 * Returns the position of the visual in the array which is nearest to midpoint
       
   632 	 * in swipe direction
       
   633 	 *
       
   634 	 * @param aFinalMidPoints, new midpoints after the doodling
       
   635 	 * @param aLastSwipeDirection, Last swipe direction
       
   636 	 */		
       
   637 	int NearestPoint(std::vector<int> aFinalMidPoints,int aLastSwipeDirection);
       
   638 	
       
   639 	/**
       
   640 	 * The image visual size and position is modified to stretch/compress the image
       
   641 	 * after rotation. This is done because the before rotation teh texture will be 
       
   642 	 * generated according to the current orientation. To show the rotated texture
       
   643 	 * image visual is modified such that the texture looks rotated preserving 
       
   644 	 * the aspect ration
       
   645 	 *
       
   646 	 * @param aVisual,Visual for which the rotation is applied
       
   647 	 * @param aAnimationTime, time for rotation
       
   648 	 */		
       
   649 	void AdjustVisualSizeInRotation(CAlfImageVisual* aVisual,int aAnimationTime);
       
   650 
       
   651 	/**
       
   652 	 * Handle rotation of 90degree or 270 degree. here the image visuals size
       
   653 	 * needs to be altered if required as the current width will become teh height of
       
   654 	 * the texture after rotation.
       
   655 	 *
       
   656 	 * @param aVisual,Visual for which the rotation is applied
       
   657 	 * @param aAnimationTime, time for rotation
       
   658 	 */		
       
   659 	void HandleRotationOnVerticalAxis(CAlfImageVisual* aVisual,int aAnimationTime);
       
   660 
       
   661 	/**
       
   662 	 * Handle rotation of 180degree or 0 degree. Here no need to modify the image visuals
       
   663 	 * size.
       
   664 	 *
       
   665 	 * @param aVisual,Visual for which the rotation is applied
       
   666 	 * @param aAnimationTime, time for rotation
       
   667 	 */	
       
   668 	void HandleRotationOnHorizontalAxis(CAlfImageVisual* aVisual,int aAnimationTime);
       
   669 	
       
   670 	/**
       
   671 	 * Cancel the rotation applied for teh visual at the given relative index.
       
   672 	 * Relative index -1 indicates cancel the rotation on highlighted visual
       
   673 	 *
       
   674 	 * @param aIndex, relative index of teh visual for which the rotation needs to be canceled
       
   675 	 */			
       
   676 	void CancelRotation(int aIndex = -1);
       
   677 	
       
   678 	/**
       
   679 	 * Preserve the rotation after orientation change.
       
   680 	 *
       
   681 	 */			
       
   682 	void UpdateRotation();		
       
   683 
       
   684 private: //Class Data
       
   685     
       
   686     auto_ptr<TMulBaseElementImpl> mData; //owned
       
   687    
       
   688     };
       
   689     
       
   690     }  // namespace Alf
       
   691     
       
   692 #endif  // __MULBASEELEMENT_H__
       
   693 
       
   694 //End of file