uiaccelerator_plat/alf_visual_api/inc/alf/alfvisual.h
changeset 0 15bf7259bb7c
child 9 63ff45340ef4
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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 class for visuals
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFVISUAL_H
       
    21 #define C_ALFVISUAL_H
       
    22 
       
    23 class CAlfEnv;
       
    24 class CAlfVisual;
       
    25 class CAlfControlGroup;
       
    26 class CAlfControl;
       
    27 class MAlfEventHandler;
       
    28 struct TAlfBoxMetric;
       
    29 class CAlfDropShadow;
       
    30 
       
    31 #include <e32base.h>
       
    32 #include <alf/alftimedvalue.h>
       
    33 #include <alf/alfpropertyowner.h>
       
    34 
       
    35 /** Visual types. */
       
    36 enum TAlfVisualType
       
    37     {
       
    38     EAlfVisualTypeVisual,
       
    39     EAlfVisualTypeLine,
       
    40     EAlfVisualTypeText,
       
    41     EAlfVisualTypeLCTText,
       
    42     EAlfVisualTypeImage,
       
    43     EAlfVisualTypeMesh,
       
    44     EAlfVisualTypeCanvas
       
    45     };
       
    46 
       
    47 /** Visual flags. */
       
    48 enum TAlfVisualFlags
       
    49     {
       
    50     /** Manual layout means that layouts can't change the position and
       
    51         size of the visual; the owner of the visual is expected to
       
    52         manually maintain the visual's placement. */
       
    53     EAlfVisualFlagManualSize = 0x1,
       
    54     EAlfVisualFlagManualPosition = 0x2,
       
    55     EAlfVisualFlagManualLayout = EAlfVisualFlagManualSize |
       
    56                                  EAlfVisualFlagManualPosition,
       
    57 
       
    58     /** 
       
    59      * This enum is retained for source compatibility.
       
    60      * @deprecated 
       
    61      * @note See EAlfVisualFlagClipping
       
    62      */
       
    63     AlfVisualFlagClipping = 0x4,
       
    64     
       
    65     /** Notify owner control when the visual's layout has been updated.
       
    66         Notication is sent after all children have been updated. */
       
    67     EAlfVisualFlagLayoutUpdateNotification = 0x8,
       
    68 
       
    69     /** When the visual is drawn it will use a 3D projection. */
       
    70     EAlfVisualFlag3DProjection = 0x10,
       
    71 
       
    72     /** No depth test when drawing with a 3D projection. */
       
    73     EAlfVisualFlagNoDepthOcclusion = 0x20,
       
    74 
       
    75     /** Use a local horizon with a 3D projection. Otherwise, the global
       
    76         display horizon is used instead. */
       
    77     EAlfVisualFlagLocalHorizon = 0x40,
       
    78 
       
    79     /** Contents of the visual are clipped to its display rectangle. */
       
    80     EAlfVisualFlagClipping = 0x80,
       
    81 
       
    82     EAlfVisualFlagHOriginCenter = 0x100,
       
    83 
       
    84     EAlfVisualFlagHOriginRight = 0x200,
       
    85 
       
    86     EAlfVisualFlagVOriginCenter = 0x400,
       
    87 
       
    88     EAlfVisualFlagVOriginBottom = 0x800,
       
    89 
       
    90     /** Visual has changed and needs refresh. */
       
    91     EAlfVisualChanged = 0x1000,
       
    92     
       
    93     /** When the visual is drawn, the depth buffer shouldn't be updated. */
       
    94     EAlfVisualFlagNoDepthUpdate = 0x2000,
       
    95 
       
    96     /** Use the visual's local layout transition time, do not inherit from parent. */
       
    97     EAlfVisualFlagManualTransitionTime = 0x4000,
       
    98 
       
    99     /** Draw above the normal drawing order. */
       
   100     EAlfVisualFlagDrawAfterOthers = 0x10000,
       
   101     
       
   102     /** Do not automatically update the layout of children when doing 
       
   103         changes in a layout (e.g., when reordering children). */
       
   104     EAlfVisualFlagFreezeLayout = 0x20000,
       
   105     
       
   106     /** The visual will be ignored when checking for possible pointer event
       
   107         interaction. */
       
   108     EAlfVisualFlagIgnorePointer = 0x40000,
       
   109 
       
   110     /** 
       
   111      * automatically reverse the base unit sign in the X axis if the current locale setting is 
       
   112      * for mirrored layout
       
   113      *
       
   114      * @note this will only affect the positions of visuals contained
       
   115      * within layout visuals, the contents within a visual such as a text visual will not be 
       
   116      * affected. 
       
   117      */
       
   118     EAlfVisualFlagAutomaticLocaleMirroringEnabled = 0x80000,
       
   119     
       
   120     /** 
       
   121      * RnD: if set, some of the debug features are enabled. See programmers'
       
   122      * guide for more info.
       
   123      *
       
   124      * If the central repository has the setting to draw selected visual outline, 
       
   125      * setting this flag will draw outline for the visual and its child visuals
       
   126      */    
       
   127     EAlfVisualFlagEnableDebugMode  = 0x100000,
       
   128 
       
   129     //Code added by Devayani
       
   130     /** 
       
   131      * Setting this flag makes visual and its children Inactive i.e. it is ignored from roster operations 
       
   132      * - Draw, Handle event, change notifications etc.
       
   133      * Unsetting flag can again make visual tree active.
       
   134      * Note that flag change does not take effect unless that display area is refreshed.
       
   135      **/
       
   136     EAlfVisualFlagInactive = 0x200000,
       
   137 
       
   138     /** 
       
   139      * Setting this flag informs renderer that visual is to be considered as opaque and thus
       
   140      * renderer may choose not to draw visuals behind opaque visual. Note that visual
       
   141      * attribute "opacity" is not affected by this flag.
       
   142      **/
       
   143     EAlfVisualFlagOpaqueHint = 0x400000,
       
   144     
       
   145     EAlfVisualFlagLast = 0xFFFFFFFF
       
   146     };
       
   147 
       
   148 /** Horizontal origin of a visual. */
       
   149 enum TAlfVisualHOrigin
       
   150     {
       
   151     EAlfVisualHOriginLeft = 0,
       
   152     EAlfVisualHOriginCenter = 1,
       
   153     EAlfVisualHOriginRight = 2
       
   154     };
       
   155 
       
   156 
       
   157 /** Vertical origin of a visual. */
       
   158 enum TAlfVisualVOrigin
       
   159     {
       
   160     EAlfVisualVOriginTop = 0,
       
   161     EAlfVisualVOriginCenter = 1,
       
   162     EAlfVisualVOriginBottom = 2
       
   163     };
       
   164 
       
   165 const TText KAlfTagSeparator = ':';
       
   166 
       
   167 const TInt KAlfTactileFeedbackEventTypeNone = -1;
       
   168 
       
   169 class CAlfControl;
       
   170 class CAlfLayout;
       
   171 class CAlfDisplay;
       
   172 class CAlfEnv;
       
   173 class CAlfBrushArray;
       
   174 class CAlfGenComponent;
       
   175 class MAlfMappingFunction;
       
   176 class CAlfTransformation;
       
   177 
       
   178 /** Fixed properties for visuals, Use these for efficient copying of visual properties. */ 
       
   179 class AlfVisualProperties
       
   180     {
       
   181     public:
       
   182     enum 
       
   183         {
       
   184         ENone = 0x0,
       
   185         ESize = 0x1,
       
   186         EPosition = 0x2,
       
   187         EOpacity = 0x4,
       
   188         EDepthOffset = 0x8,
       
   189         ESecondaryImageAlpha = 0x10, 
       
   190         EScale = 0x20,
       
   191         EPosOffset = 0x40,
       
   192         ETextVisShadowOpacity = 0x80,
       
   193         EImageVisTurnAngle = 0x100,
       
   194         ELineVisThickness = 0x200,
       
   195         ELineVisShadowThickness = 0x400,
       
   196         ELineVisStartPos = 0x800,
       
   197         ELineVisEndPos = 0x1000,
       
   198         EMeshVisYawAngle = 0x2000, 
       
   199         EMeshVisPitchAngle = 0x4000,
       
   200         EMeshVisMaterial = 0x8000,
       
   201         ELayoutScrollOffset = 0x10000,
       
   202         // Add new properties here (next value: 0x20000)
       
   203         
       
   204         EAll = 0xFFFFFFFF
       
   205         };
       
   206     };
       
   207 
       
   208 
       
   209 /**
       
   210  *  Visual base class
       
   211  *
       
   212  *  All visuals and layout are derived from this.
       
   213  *  Usage:
       
   214  *  @code
       
   215  *    // #1 Visual object usage
       
   216  *    CAlfVisual* newVisual = CAlfVisual::AddNewL( *myMainControl, mMainGridLayout );
       
   217  *    newVisual->EnableBrushesL();
       
   218  *    newVisual->Brushes->AppendL( borderBrush, EAlfHasOwnership );
       
   219  *    
       
   220  *   // #2 as a base class
       
   221  *   class CMyVisual : public CAlfVisual
       
   222  *       {    
       
   223  *   public:
       
   224  *       // allocation function
       
   225  *       CMyVisual(CAlfControl& aOwnerControl, CAlfLayout* aParentLayout = 0);  
       
   226  *    
       
   227  *       // Function documentation
       
   228  *       void MyVisualSpecificFunction();
       
   229  *   protected:
       
   230  *
       
   231  *       ~CAlfVisual();
       
   232  *   private:
       
   233  *       TInt mMyPrivateData;    
       
   234  *       };
       
   235  *  @endcode
       
   236  *  @lib alfclient.lib
       
   237  *  @since S60 v3.2
       
   238  */
       
   239 class CAlfVisual : public CAlfPropertyOwner
       
   240     {
       
   241 
       
   242 public:
       
   243 
       
   244     /**
       
   245      * Constructor
       
   246      */
       
   247     IMPORT_C CAlfVisual();
       
   248 
       
   249     /**
       
   250      * ConstructL
       
   251      */
       
   252     IMPORT_C virtual void ConstructL(CAlfControl& aOwner);
       
   253 
       
   254     /**
       
   255      * Destructor
       
   256      */
       
   257     IMPORT_C virtual ~CAlfVisual();
       
   258     
       
   259     /**
       
   260      * Destroys a hierarchy of visuals, along with this visual. The visuals
       
   261      * are first removed from their owner.
       
   262      */
       
   263     IMPORT_C virtual void RemoveAndDestroyAllD();
       
   264     
       
   265     /**
       
   266      * Return the server side handle
       
   267      *
       
   268      * @return Handle to the server side CAlfVisual object. 0 if not set.
       
   269      */
       
   270     IMPORT_C TInt Identifier() const;
       
   271      
       
   272     /**
       
   273      * Sets the layout this visual belongs to.
       
   274      *
       
   275      * @param aLayout Parent layout
       
   276      */
       
   277     void SetLayout(CAlfLayout* aLayout);
       
   278     
       
   279     /**
       
   280      * Set a flag that affects the visual's behaviour.
       
   281      *
       
   282      * @param aFlag  Flag to set.
       
   283      */
       
   284     IMPORT_C void SetFlag(TAlfVisualFlags aFlag);
       
   285 
       
   286     /**
       
   287      * Sets one or more flags that affect the visual's behaviour.
       
   288      *
       
   289      * @param aAnyFlags  One or more flags to set.
       
   290      */
       
   291     IMPORT_C void SetFlags(TUint aAnyFlags);
       
   292 
       
   293     /**
       
   294      * Unset flags that affect the visual's behaviour.
       
   295      *
       
   296      * @param aFlag  Flag to clear.
       
   297      */
       
   298     IMPORT_C void ClearFlag(TAlfVisualFlags aFlag);
       
   299 
       
   300     /**
       
   301      * Clear one or more flags that affect the visual's behaviour.
       
   302      *
       
   303      * @param aAnyFlags  One or more flags to clear.
       
   304      */
       
   305     IMPORT_C void ClearFlags(TUint aAnyFlags);
       
   306 
       
   307     /**
       
   308      * Returns the flags of the visual.
       
   309      * @return Flags.
       
   310      */
       
   311     IMPORT_C TUint Flags() const;
       
   312     
       
   313     /**
       
   314      * Returns the layout this visual belongs to.
       
   315      *
       
   316      * @return Parent layout. NULL if not set.
       
   317      */
       
   318     IMPORT_C CAlfLayout* Layout() const;
       
   319     
       
   320     /**
       
   321      * Returns the position of the visual. This is set by UpdateLayout().
       
   322      *
       
   323      * @return Position.
       
   324      */
       
   325     IMPORT_C TAlfTimedPoint Pos() const;
       
   326 
       
   327     /**
       
   328      * Sets the position of the visual.
       
   329      */
       
   330     IMPORT_C void SetPos(const TAlfRealPoint& aPos, TInt aTransitionTime = 0);
       
   331     
       
   332     /**
       
   333      * Returns the size of the visual. This is set by UpdateLayout().
       
   334      */
       
   335     IMPORT_C const TAlfTimedPoint Size() const;
       
   336 
       
   337     /**
       
   338      * Sets the size of the visual.
       
   339      */
       
   340     IMPORT_C void SetSize(const TAlfRealSize& aSize, TInt aTransitionTime = 0);
       
   341     
       
   342     /**
       
   343      * Returns the overall opacity affecting the owner's visuals. All visuals 
       
   344      * owned by this object are affected by this opacity.
       
   345      *
       
   346      * @return  Timed value.
       
   347      */
       
   348     IMPORT_C const TAlfTimedValue& Opacity() const;
       
   349     
       
   350     /**
       
   351      * Set opacity
       
   352      *
       
   353      * @param aOpacity Opacity value.
       
   354      */
       
   355     IMPORT_C void SetOpacity( const TAlfTimedValue& aOpacity );
       
   356     
       
   357     /**
       
   358      * Returns the environment where this visual belongs into.
       
   359      *
       
   360      * @return  Environment.
       
   361      */
       
   362     IMPORT_C CAlfEnv& Env() const;
       
   363     
       
   364     /**
       
   365      * Returns the display of the visual (if shown).
       
   366      *
       
   367      * @return  Pointer to <code>CAlfDisplay</code> instance, or
       
   368      * <code>NULL</code> if no display is associated with the visual.
       
   369      */
       
   370     IMPORT_C CAlfDisplay* Display() const;
       
   371     
       
   372     /**
       
   373      * Sets the display on which the visual is being shown.
       
   374      *
       
   375      * @param aDisplay  Pointer to display onto which to attach the visual
       
   376      */
       
   377     void SetDisplay(CAlfDisplay* aDisplay);
       
   378         
       
   379     /**
       
   380      * Determines the tag of the visual.
       
   381      *
       
   382      * @return  Tag descriptor of the visual.
       
   383      *
       
   384      * @see CAlfVisual::SetTagL()
       
   385      * @see CAlfVisual::IsTagged()
       
   386      * @see CAlfVisual::FindTag()
       
   387      */
       
   388     IMPORT_C const TDesC8& Tag() const;
       
   389     
       
   390     /**
       
   391      * Update the layout of all children. Subclasses can call this to
       
   392      * recalculate the layout of all children.
       
   393      *
       
   394      * @param aTransitionTime  Time for layout transition in milliseconds.
       
   395      *                         Any negative value uses value given in 
       
   396      *                         CAlfEnv::StaticSetLayoutTransitionTime()
       
   397      */
       
   398     IMPORT_C virtual void UpdateChildrenLayout(TInt aTransitionTime = 0);
       
   399     
       
   400     /**
       
   401      * Calculates the visual's bounding rectangle in display coordinates.
       
   402      * Display coordinates are defined relative to the display's visible area.
       
   403      * Uses the target values of the position and size, which means transitions
       
   404      * are always immediate in the returned rectangle.
       
   405      *
       
   406      * @return Rectange.
       
   407      */
       
   408     IMPORT_C TAlfRealRect DisplayRectTarget() const;
       
   409     
       
   410     /**
       
   411      * Convert local coordiantes to display coordinates.
       
   412      * Display coordinates are defined relative to the display's visible area.
       
   413      *
       
   414      * @return Converted point.
       
   415      */
       
   416     IMPORT_C TPoint LocalToDisplay(const TPoint& aPoint) const;
       
   417     
       
   418     /**
       
   419      * Convert local coordinates to display coordinates.
       
   420      * Display coordinates are defined relative to the display's visible area.
       
   421      *
       
   422      * @param aPoint  Point in local coordinates.
       
   423      * @return  Point in display coordinates.
       
   424      */
       
   425     IMPORT_C TAlfRealPoint LocalToDisplay(const TAlfRealPoint& aPoint) const;
       
   426     
       
   427     /*
       
   428      * Convert display coordinates to local coordinates.
       
   429      * Display coordinates are defined relative to the display's visible area.
       
   430      *
       
   431      * @param aPoint  Point in display coordinates.
       
   432      * @return  Point in local coordinates.
       
   433      */
       
   434     IMPORT_C TPoint DisplayToLocal(const TPoint& aPoint) const;
       
   435     
       
   436     /**
       
   437      * Convert display coordinates to local coordinate.
       
   438      * Display coordinates are defined relative to the display's visible area.
       
   439      *
       
   440      * @param aPoint  Point in display coordinates.
       
   441      * @return  Point in local coordinates.
       
   442      */
       
   443     IMPORT_C TAlfRealPoint DisplayToLocal(const TAlfRealPoint& aPoint) const;
       
   444     
       
   445     /**
       
   446      * Enables or disables brushes for the visual.
       
   447      */
       
   448     IMPORT_C void EnableBrushesL(TBool aEnabled = ETrue);
       
   449     
       
   450     /**
       
   451      * Returns the brushes of the visual.
       
   452      *
       
   453      * @return  Brush array. <code>NULL</code>, if not enabled.
       
   454      */
       
   455     IMPORT_C CAlfBrushArray* Brushes();
       
   456   
       
   457     /**
       
   458      * Moves the visual to the front inside its parent layout. 
       
   459      * In other words, the visual becames the last child of the parent.
       
   460      * Causes layout recalculation.
       
   461      */
       
   462     IMPORT_C void MoveToFront(TInt aTransitionTime = 0);
       
   463     
       
   464     /**
       
   465      * Enables or disables transformation of the control group.
       
   466      *
       
   467      * @param aIsTransformed ETrue for enabling.
       
   468      */
       
   469     IMPORT_C void EnableTransformationL( TBool aIsTransformed = ETrue );
       
   470     
       
   471     /**
       
   472      * Returns the transformation of the control group.
       
   473      *
       
   474      * @return  Transformation steps.
       
   475      */
       
   476     IMPORT_C CAlfTransformation& Transformation();
       
   477     
       
   478     /**
       
   479      * Sets the number of pixels that the visual uses for padding its contents.
       
   480      * Sets both the horizontal and vertical padding.
       
   481      *
       
   482      * @note that the left and right paddings will be the same, and the top and bottom
       
   483      *      paddings will be the same.
       
   484      * @deprecated migrate to using metrics instead
       
   485      *
       
   486      * @param aPadding  Number of padding pixels.
       
   487      */
       
   488     IMPORT_C void SetPadding(TInt aPadding);
       
   489 
       
   490     /**
       
   491      * Sets the number of pixels that the visual uses for padding its contents.
       
   492      * Sets the horizontal and vertical padding separately.
       
   493      *
       
   494      * @note that the left and right paddings will be the same, and the top and bottom
       
   495      *      paddings will be the same.
       
   496      * @deprecated migrate to using metrics instead
       
   497      *
       
   498      * @param aPadding  Number of padding pixels.
       
   499      */
       
   500     IMPORT_C void SetPadding(const TPoint& aPadding);
       
   501 
       
   502     /**
       
   503      * Sets the amount of padding that the visual uses for padding its contents.
       
   504      * The box metric can have a different amount on all sides.
       
   505      *
       
   506      * @note as paddings are relative to the layout visual, if relative units are required, 
       
   507      * it is advisable to use EAlfUnitRelativeToMySize so that the paddings are relative
       
   508      * to the size of this layout visual
       
   509      *
       
   510      * @param aPadding  Amount of padding.
       
   511      */
       
   512     IMPORT_C void SetPadding(const TAlfBoxMetric& aPadding);
       
   513 
       
   514     /**
       
   515      * Returns the padding of the visual, in pixels.
       
   516      *
       
   517      * @return  Padding, in pixels. iTl.iX is the left padding, iTl.iY is 
       
   518      *          the top padding, iBr.iX is the right padding, and iBr.iY
       
   519      *          is the bottom padding. The width and height of the returned 
       
   520      *          rectangle are meaningless.
       
   521      */
       
   522     IMPORT_C TAlfRealRect PaddingInPixels() const;
       
   523 
       
   524     /**
       
   525      * Sets the tag of the visual.
       
   526      *
       
   527      * The tag is a descriptor, in the form of one or more colon-separated
       
   528      * character sequences. By default, visuals have no tag (""). Normally,
       
   529      * a visual could have a single tag, for example ("caption").
       
   530      * The tag descriptor of the visual may contain multiple tags,
       
   531      * for example: "tag1:tag2:tag3".
       
   532      *
       
   533      * Tags can be used for identifying visuals. In a typical use case, a control
       
   534      * could identify which of its visuals represent certain elements of the
       
   535      * control based on the tag descriptors. In this case, the tags would be
       
   536      * set by an outside party that also sets the tags of the visuals.
       
   537      *
       
   538      * @param aTag  Tag descriptor for the visual.
       
   539      *
       
   540      * @see CAlfVisual::Tag()
       
   541      * @see CAlfVisual::IsTagged()
       
   542      * @see CAlfVisual::FindTag()
       
   543      */
       
   544     IMPORT_C void SetTagL(const TDesC8& aTag);
       
   545 
       
   546     /**
       
   547      * Determines if the visual has a tag.
       
   548      *
       
   549      * @return  <code>ETrue</code>, if the visual has been tagged with SetTagL().
       
   550      *          <code>EFalse</code> otherwise.
       
   551      *
       
   552      * @see CAlfVisual::Tag()
       
   553      * @see CAlfVisual::SetTagL()
       
   554      * @see CAlfVisual::FindTag()
       
   555      */
       
   556     IMPORT_C TBool IsTagged() const;
       
   557 
       
   558     /**
       
   559      * Finds a visual whose tag descriptor contains a specific tag.
       
   560      *
       
   561      * CAlfVisual::FindTag() is the basic implementation that checks if
       
   562      * this visual's tag matches the specified tag. CAlfLayout::FindTag()
       
   563      * extends the search into child visuals, covering recursively entire
       
   564      * visual hierarchies.
       
   565      *
       
   566      * @param aTag  Tag to look for. If this tag is found as a part of a
       
   567      *              visual's colon-separated tag descriptor, it is treated
       
   568      *              as a match and the visual is returned. The tag to look
       
   569      *              for cannot contain separator characters (:).
       
   570      *
       
   571      * @return  Visual whose tag descriptor matches the tag. <code>NULL</code>,
       
   572      *          if no such visual could be found. 
       
   573      *
       
   574      * Todo: how should several visuals with matching tag to be handled ??
       
   575      *
       
   576      * @see CAlfVisual::Tag()
       
   577      * @see CAlfVisual::SetTagL()
       
   578      * @see CAlfVisual::IsTagged()
       
   579      * @see CAlfLayout::FindTag()
       
   580      */
       
   581     IMPORT_C virtual CAlfVisual* FindTag(const TDesC8& aTag);
       
   582 
       
   583     /**
       
   584      * Construct a visual.
       
   585      *
       
   586      * @todo This method is probably to allow extended visual types to be created.
       
   587      *
       
   588      * @param aOwner Who owns this new control.
       
   589      */
       
   590     IMPORT_C void ConstructL(CAlfControl& aOwner, TInt aImplementationId, TInt aImplementationUid, const TDesC8& aConstructionParams );
       
   591 
       
   592     IMPORT_C CAlfGenComponent* Comms() const;
       
   593 
       
   594     
       
   595     /**
       
   596      * Gets the depth offset.
       
   597      *
       
   598      * @return Depth offset.
       
   599      */
       
   600     IMPORT_C TAlfTimedValue DepthOffset() const;
       
   601 
       
   602     /**
       
   603      * Sets the depth offset.
       
   604      *
       
   605      * @param aDepthOffset Depth offset.
       
   606      */
       
   607     IMPORT_C void SetDepthOffset(const TAlfTimedValue& aDepthOffset);
       
   608 
       
   609     /**
       
   610      * Returns the owner of the visual.
       
   611      */
       
   612     IMPORT_C CAlfControl& Owner() const;
       
   613 
       
   614     /**
       
   615      * Sets the owner of the visual.
       
   616      *
       
   617      * @param aOwner  New owner of the visual.
       
   618      */
       
   619     IMPORT_C void SetOwner(CAlfControl& aOwner);
       
   620 
       
   621     /**
       
   622      * Sets the origin of the visual. The origin defines the location of the
       
   623      * visual's position in relation to its DisplayRect. By default the visual's
       
   624      * position defines its top left corner.
       
   625      *
       
   626      * Calling this method is equivalent to setting/clearing the corresponding
       
   627      * flags.
       
   628      */
       
   629     IMPORT_C void SetOrigin(TAlfVisualHOrigin aHoriz, TAlfVisualVOrigin aVert);
       
   630 
       
   631     /**
       
   632      * Determines the horizontal origin.
       
   633      */
       
   634     IMPORT_C TAlfVisualHOrigin HorizontalOrigin() const;
       
   635 
       
   636     /**
       
   637      * Determines the vertical origin.
       
   638      */
       
   639     IMPORT_C TAlfVisualVOrigin VerticalOrigin() const;
       
   640 
       
   641     /**
       
   642      * Aligns the rectangle using the visual's origin position.
       
   643      *
       
   644      * @param aRect  A rectangle (origin at top left). Modified to suit the
       
   645      *               visual's origin.
       
   646      */
       
   647     IMPORT_C void AlignByOrigin(TAlfRealRect& aRect) const;
       
   648 
       
   649     /**
       
   650      * @deprecated  Use base unit version instead
       
   651      *
       
   652      * Sets the minimum size of the visual.
       
   653      *
       
   654      * @param aMinSize  Minimum size of the visual.
       
   655      */
       
   656     IMPORT_C void SetMinSize(const TSize& aMinSize);
       
   657 
       
   658     /**
       
   659      * Sets the minimum size of the visual.
       
   660      *
       
   661      * @param aMinSize  Minimum size of the visual in base units.
       
   662      */
       
   663     IMPORT_C void SetMinSize(const TAlfRealSize& aMinSize);
       
   664 
       
   665     /**
       
   666      * @deprecated  Use base unit version instead
       
   667      *
       
   668      * Returns the minimum size of the visual.
       
   669      */
       
   670     IMPORT_C TSize MinSize() const;
       
   671 
       
   672     /**
       
   673      * Returns the minimum size of the visual in base units.
       
   674      */
       
   675     IMPORT_C TAlfRealSize MinSizeInBaseUnits() const;
       
   676 
       
   677     /**
       
   678      * @deprecated  Use base unit version instead
       
   679      *
       
   680      * Sets the maximum size of the visual.
       
   681      *
       
   682      * @param aMaxSize  Maximum size of the visual.
       
   683      */
       
   684     IMPORT_C void SetMaxSize(const TSize& aMaxSize);
       
   685 
       
   686     /**
       
   687      * Sets the maximum size of the visual.
       
   688      *
       
   689      * @param aMaxSize  Maximum size of the visual.
       
   690      */
       
   691     IMPORT_C void SetMaxSize(const TAlfRealSize& aMaxSize);
       
   692 
       
   693     /**
       
   694      * @deprecated  Use base unit version instead
       
   695      *
       
   696      * Returns the maximum size of the visual.
       
   697      */
       
   698     IMPORT_C TSize MaxSize() const;
       
   699 
       
   700     /**
       
   701      * Returns the maximum size of the visual in base units.
       
   702      */
       
   703     IMPORT_C TAlfRealSize MaxSizeInBaseUnits() const;
       
   704 
       
   705     /**
       
   706      * Sets the position and size of the visual.
       
   707      *
       
   708      * @param aRect            Target rectangle.
       
   709      * @param aTransitionTime  Transition timein milliseconds.
       
   710      */
       
   711     IMPORT_C void SetRect(const TAlfRealRect& aRect, TInt aTransitionTime = 0);
       
   712 
       
   713     /**
       
   714      * @deprecated  Use base unit version instead
       
   715      *
       
   716      * Moves the visual's position.
       
   717      *
       
   718      * @param aOffset          Offset from the current target.
       
   719      * @param aTransitionTime  Transition time in milliseconds.
       
   720      */
       
   721     IMPORT_C void Move(const TPoint& aOffset, TInt aTransitionTime = 0);
       
   722 
       
   723     /**
       
   724      * Moves the visual's position.
       
   725      *
       
   726      * @param aOffset          Offset from the current target in base units.
       
   727      * @param aTransitionTime  Transition time in milliseconds.
       
   728      */
       
   729     IMPORT_C void Move(const TAlfRealPoint& aOffset, TInt aTransitionTime = 0);
       
   730 
       
   731     /**
       
   732      * Positions and sizes this visual to match another.
       
   733      *
       
   734      * @param aVisual  Visual whose position and size to copy.
       
   735      */
       
   736     IMPORT_C void Mimic(CAlfVisual& aVisual, TInt aTransitionTime = 0);
       
   737 
       
   738     /**
       
   739      * @deprecated  Use base unit version instead
       
   740      *
       
   741      * Sets the position and size of the visual.
       
   742      *
       
   743      * @param aCenterPoint     New center point of the visual.
       
   744      * @param aSize            New size of the visual.
       
   745      * @param aTransitionTime  Number of milliseconds for transitioning to new values.
       
   746      */
       
   747     IMPORT_C void SetCenteredPosAndSize(const TPoint& aCenterPoint,
       
   748                                         const TSize& aSize,
       
   749                                         TInt aTransitionTime = 0);
       
   750 
       
   751     /**
       
   752      * Sets the position and size of the visual.
       
   753      *
       
   754      * @param aCenterPoint     New center point of the visual in base units.
       
   755      * @param aSize            New size of the visual in base units.
       
   756      * @param aTransitionTime  Number of milliseconds for transitioning to new values.
       
   757      */
       
   758     IMPORT_C void SetCenteredPosAndSize(const TAlfRealPoint& aCenterPoint,
       
   759                                         const TAlfRealSize& aSize,
       
   760                                         TInt aTransitionTime = 0);
       
   761 
       
   762     /**
       
   763      * Calculates the visual's bounding rectangle in display coordinates.
       
   764      * Display coordinates are defined relative to the display's visible area.
       
   765      * Uses the current values of the position and size. Only calculated once 
       
   766      * per frame.
       
   767      */
       
   768     IMPORT_C TAlfRealRect DisplayRect() const;
       
   769 
       
   770     /**
       
   771      * Returns the opacity of the visual, taking into account the opacity
       
   772      * of parent visuals.
       
   773      *
       
   774      * @return  Effective opacity level of the visual.
       
   775      */
       
   776     IMPORT_C TReal32 EffectiveOpacity() const __SOFTFP;
       
   777 
       
   778     /**
       
   779      * Sets the clipping mode of the layout.
       
   780      *
       
   781      * @param aClipping  <code>ETrue</code> to hide children that are outside
       
   782      *                   the layout's real size.
       
   783      */
       
   784     IMPORT_C void SetClipping(TBool aClipping = ETrue);
       
   785 
       
   786     /**
       
   787      * Determines whether the visual is clipping its contents.
       
   788      */
       
   789     IMPORT_C TBool Clipping() const;
       
   790 
       
   791     /**
       
   792      * Returns the padding pixels. Visuals can use this to determine the
       
   793      * amount of padding that should be applied to the content.
       
   794      *
       
   795      * @deprecated this will return correct pixel values only if paddings were set 
       
   796      *      using deprecated pixel based APIs, so migrate to using metrics instead
       
   797      *
       
   798      * @return  Horizontal and vertical padding, in pixels.
       
   799      */
       
   800     IMPORT_C TPoint Padding() const;
       
   801 
       
   802     /**
       
   803      * Returns the padding of the visual.
       
   804      *
       
   805      * @return  Padding as a box metric.
       
   806      */
       
   807     IMPORT_C const TAlfBoxMetric& PaddingAsMetric() const;
       
   808     
       
   809     /**
       
   810      * Returns the horizontal padding pixels. Visuals can use this to
       
   811      * determine the amount of padding that should be applied to the content.
       
   812      *
       
   813      * @deprecated this will return correct pixel values only if paddings were set 
       
   814      *      using deprecated pixel based APIs, so migrate to using metrics instead
       
   815      *
       
   816      * @return  Horizontal padding, in pixels.
       
   817      */
       
   818     IMPORT_C TInt HorizontalPadding() const;
       
   819 
       
   820     /**
       
   821      * Returns the vertical padding pixels. Visuals can use this to
       
   822      * determine the amount of padding that should be applied to the content.
       
   823      *
       
   824      * @deprecated this will return correct pixel values only if paddings were set 
       
   825      *      using deprecated pixel based APIs, so migrate to using metrics instead
       
   826      *
       
   827      * @return  Vertical padding, in pixels.
       
   828      */
       
   829     IMPORT_C TInt VerticalPadding() const;
       
   830 
       
   831     /**
       
   832      * Sets the position of the visual.
       
   833      */
       
   834     IMPORT_C void SetPos(const TAlfTimedPoint& aPos);
       
   835 
       
   836     /**
       
   837      * Sets the size of the visual.
       
   838      */
       
   839     IMPORT_C void SetSize(const TAlfTimedPoint& aSize);
       
   840 
       
   841     /**
       
   842     * Copies selected, basic types of properties from another visual
       
   843     * If another visual is in the middle of interpolating selected value(s), target value is used
       
   844     * with given transition time.
       
   845     *
       
   846     * For dynamic properties, use CAlfPropertyOwner::CopyProperty()
       
   847     * 
       
   848     * @param aSourceVisual   Visual, from which the values are copied
       
   849     * @param aBitmask        Defines what properties to copy
       
   850     * @param aTransitionTime Number of milliseconds for transitioning to new values.     
       
   851     * 
       
   852     * @return System wide error codes
       
   853     */
       
   854     IMPORT_C TInt CopyValues(const CAlfVisual& aSourceVisual, TInt aBitmask = AlfVisualProperties::EAll, TInt aTransitionTime = 0);
       
   855 
       
   856     /**
       
   857     * Pauses selected, basic types of timed properties of this visual
       
   858     *
       
   859     * @param aPropertiesBitmask   defines what properties are paused,  combination of AlfVisualProperties
       
   860     */
       
   861     IMPORT_C void Pause(TInt aPropertiesBitmask = AlfVisualProperties::EAll);
       
   862 
       
   863     /**
       
   864     * Resumes selected basic types of timed properties of this visual
       
   865     * that were paused using CAlfVisual::Pause().
       
   866     * If a property was not paused before calling Resume, call does not have effect
       
   867     *
       
   868     * @param aPropertiesBitmask   defines what properties are paused, combination of AlfVisualProperties
       
   869     */
       
   870     IMPORT_C void Resume(TInt aPropertiesBitmask = AlfVisualProperties::EAll);
       
   871 
       
   872     // internal
       
   873     TBool TagMatches(const TDesC8& aTag) const;
       
   874     
       
   875     /** ! Deletes the visual */
       
   876     IMPORT_C virtual void DoRemoveAndDestroyAllD();
       
   877     
       
   878     
       
   879     /**
       
   880      * Sets an automatic tactile feedback. If this visual is a layout,
       
   881      * the feedback affects to the child visuals as well. This can 
       
   882      * be overridden in child visuals.
       
   883      * 
       
   884      * @param aEventType Event which triggers the automatic feedback.
       
   885      * @param aFeedbackType Feedback type.
       
   886      *
       
   887      * @see TTouchEventType from touchlogicalfeedback.h
       
   888      * @see TTouchLogicalFeedback from touchlogicalfeedback.h
       
   889      */
       
   890     IMPORT_C void SetTactileFeedbackL( TInt aEventType, TInt aFeedbackType );
       
   891         
       
   892     /**
       
   893      * Checks whether a tactile feedback has been assigned.
       
   894      * Eventhough, this returns EFalse the layout may have feedback defined.
       
   895      * @param aEventType Event type which needs to match
       
   896      *        If KAlfTactileFeedbackEventTypeNone, the event type is irrelevant.
       
   897      * 
       
   898      * @return ETrue if the visual has a tactile feedback defined.
       
   899      */
       
   900     IMPORT_C TBool HasTactileFeedback( 
       
   901         TInt aEventType = KAlfTactileFeedbackEventTypeNone ) const;
       
   902        
       
   903     /**
       
   904      * Removes tactile feedback for the visual.
       
   905      * 
       
   906      * @param aEventType Event type which feedback to remove.
       
   907      *        If KAlfTactileFeedbackEventTypeNone, all the feedbacks are removed.
       
   908      */
       
   909     IMPORT_C void RemoveTactileFeedback( TInt aEventType = KAlfTactileFeedbackEventTypeNone );
       
   910     
       
   911     /**
       
   912      * Enables the drop shadow. Currently implemented for the image and text visuals.
       
   913      * 
       
   914      * @param aEnable ETrue to enable, EFalse to disable.
       
   915      */
       
   916     IMPORT_C void EnableDropShadowL( TBool aEnable = ETrue );
       
   917     
       
   918     /**
       
   919      * Returns the drop shadow parameter handler.
       
   920      *
       
   921      * @return Drop shadow handler. NULL if drop shadow is disabled.
       
   922      */
       
   923     IMPORT_C CAlfDropShadow* DropShadowHandler() const;
       
   924     IMPORT_C void CAlfVisual::SetEffectL( const TDesC& aEffectFile );
       
   925     IMPORT_C void CAlfVisual::SetGroupEffectL( const TDesC& aEffectFile, TInt aGroupHandle );
       
   926 
       
   927 protected:
       
   928 
       
   929     /** ! future proofing */
       
   930     IMPORT_C void PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
       
   931 
       
   932 
       
   933 private:
       
   934 
       
   935     // Private data. Own. 
       
   936     struct TPrivateData;
       
   937     TPrivateData* iData;
       
   938 
       
   939     };
       
   940 
       
   941 
       
   942 #endif // C_ALFVISUAL_H