uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h
changeset 0 15bf7259bb7c
child 8 10534483575f
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 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:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __ALFWINDOW_H__
       
    21 #define __ALFWINDOW_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <alfwindowstructs.h>
       
    25 #include <bitstd.h>
       
    26 
       
    27 class CAlfWindowManager;
       
    28 class TAlfWServInfo;
       
    29 class CAlfWindowBuffer;
       
    30 class CAlfWindowFxPlugin;
       
    31 class TAlfWindowAttributes;
       
    32 class TAlfWindowCommandBufferAttributes;
       
    33 
       
    34 class TAlfWindowData;
       
    35     
       
    36 /**
       
    37  *  CAlfWindow
       
    38  *
       
    39  * The class is used for abstracting different pixel data presentations
       
    40  *
       
    41  *  @lib alfappservercore.dll
       
    42  *  @since S60 5.0
       
    43  */
       
    44 NONSHARABLE_CLASS(CAlfWindow): public CBase
       
    45     {
       
    46 public:
       
    47 
       
    48     static CAlfWindow* NewL(TUint aId, CAlfWindowManager& aOwner, const TSize& aSizeInPixels);
       
    49     
       
    50     virtual ~CAlfWindow();
       
    51         
       
    52 public: 
       
    53     // getters
       
    54     
       
    55     /**
       
    56      * WsInfo
       
    57      *
       
    58      * @since S60 5.0
       
    59      * @return  Specific wserv window data. For reference only.
       
    60      */
       
    61     IMPORT_C const TAlfWServInfo& WsInfo() const;
       
    62     
       
    63     /**
       
    64      * Position
       
    65      *
       
    66      * @since S60 5.0
       
    67      * @return  Position of the window
       
    68      */
       
    69     IMPORT_C TPoint Position() const;
       
    70     
       
    71     /**
       
    72      * Size
       
    73      *
       
    74      * @since S60 5.0
       
    75      * @return  The size of the window
       
    76      */
       
    77     IMPORT_C TSize Size() const;
       
    78     
       
    79     /**
       
    80      * Opacity
       
    81      *
       
    82      * @since S60 5.0
       
    83      * @return  The opacity of the window
       
    84      */
       
    85     IMPORT_C TReal32 Opacity() const __SOFTFP;
       
    86     
       
    87     /**
       
    88      * Rotation
       
    89      *
       
    90      * @since S60 5.0
       
    91      * @return  The rotation of the window
       
    92      */
       
    93     IMPORT_C TReal32 Rotation() const __SOFTFP;
       
    94     
       
    95     /**
       
    96      * Identifier
       
    97      *
       
    98      * @since S60 5.0
       
    99      * @return  The identifier of the window
       
   100      */
       
   101     IMPORT_C TUint Identifier() const;
       
   102     
       
   103     /**
       
   104      * IsActive
       
   105      *
       
   106      * @since S60 5.0
       
   107      * @return  ETrue, if window is active. Otherwise EFalse.
       
   108      */
       
   109     IMPORT_C TBool IsActive() const;
       
   110     
       
   111     /**
       
   112      * SurfaceExtent
       
   113      *
       
   114      * @since S60 5.0
       
   115      * @return  The extend of the composition surface
       
   116      */
       
   117 	IMPORT_C TRect SurfaceExtent() const;
       
   118 	
       
   119     /**
       
   120      * Size
       
   121      *
       
   122      * @since S60 5.0
       
   123      * @return  The index of the window. 0 means the topmost window.
       
   124      */
       
   125     IMPORT_C TUint Index() const;
       
   126     
       
   127     /**
       
   128      * InBuffer
       
   129      * This method returns the original buffer from wserv. Plugin must not modify the contents of it
       
   130      * Contents of this buffer is updated before callback CAlfWindowPlugin::WindowUpdated() is called. 
       
   131      *
       
   132      * Ownership of a buffer remains in AlfWindowManager
       
   133      *
       
   134      * @since S60 5.0
       
   135      * @return  CAlfWindowBuffer
       
   136      */
       
   137     IMPORT_C CAlfWindowBuffer* InBuffer();   
       
   138     
       
   139     /**
       
   140      * OutBufferL
       
   141      * This method returns new buffer for transition plugin to modify content that will finally display
       
   142      * on screen. There can't be more than one active outbuffers for a window at a time. Content of an
       
   143      * input buffer from wserv will be copied only upon creation of back buffer. After initialization, 
       
   144      * Fx plugin has solely responsibility to update complete frame.
       
   145      * 
       
   146      * Ownership of a buffer remains in AlfWindowManager
       
   147      *
       
   148      * @since S60 5.0
       
   149      * @param   aCopyInBufContents defines whether current frame should be copied to buffer
       
   150      * @return  CAlfWindowBuffer
       
   151      */
       
   152     IMPORT_C CAlfWindowBuffer* OutBufferL(TBool aCopyContents = EFalse);
       
   153     
       
   154     // Setters
       
   155     /**
       
   156      * Size
       
   157      *
       
   158      * TODO:CHECK COMMENT VALIDITY
       
   159      * Note, that SetACtive and SetOpacity(0) are different things. When window is not active, it is not 
       
   160      * processed at all in the refresh loop unlike a transparent window would be. 
       
   161      * 
       
   162      * @since S60 5.0
       
   163      * @return  The size of the window
       
   164      */
       
   165     IMPORT_C void SetActive(TBool aVisible);
       
   166     
       
   167 
       
   168     /**
       
   169      * SetSurfaceExtent
       
   170      *
       
   171      * Set the extent of the related composition surface
       
   172      * To remove extent, give aRect a value (0,0,0,0).
       
   173      * 
       
   174      * @since S60 5.0
       
   175      * 
       
   176      * @param aRect  New extent
       
   177      */
       
   178 	IMPORT_C void SetSurfaceExtent(const TRect& aRect);
       
   179 
       
   180 	
       
   181     /**
       
   182      * SetLayerUsesAplhaFlag
       
   183      *
       
   184      * Set compostion layer's EUsesAlpha flag state
       
   185      * Window that has background surface set, has layer
       
   186      * in composition scene
       
   187      * 
       
   188      * @since S60 5.0
       
   189      * 
       
   190      * @param aEnabled  True/False
       
   191      */	
       
   192 	IMPORT_C void SetLayerUsesAplhaFlag(TBool aEnabled);
       
   193 	
       
   194     /**
       
   195      * ContentReady
       
   196      *
       
   197      * @since S60 5.0
       
   198      * @param aOutBuffer
       
   199      * @param aUpdatedArea
       
   200      */
       
   201     IMPORT_C void ContentReady(const TRegion& aUpdatedArea);
       
   202     
       
   203     /**
       
   204      * Move
       
   205      * 
       
   206      * Sets to order of the windows. 0 equals the topmost window.
       
   207      *
       
   208      * @since S60 5.0
       
   209      * @param aIndex    New index of the window
       
   210      */
       
   211     IMPORT_C void Move(TUint aIndex);
       
   212     
       
   213     /**
       
   214      * EnableIndexChangedNotifications
       
   215      *
       
   216      * @since S60 5.0
       
   217      * @param aEnable
       
   218      */
       
   219     IMPORT_C void EnableIndexChangedNotifications(TBool aEnable);
       
   220    
       
   221     /**
       
   222      * SetPos
       
   223      *
       
   224      * Set the position of the window
       
   225      * 
       
   226      * @since S60 5.0
       
   227      * 
       
   228      * @param aPos  New position
       
   229      * @param aDuration Duration to new position
       
   230      */
       
   231     IMPORT_C void SetPos(TPoint aPos, TUint aDuration = 0);
       
   232     
       
   233     /**
       
   234      * SetSize
       
   235      *
       
   236      * @since S60 5.0
       
   237      * @param aSize  New size
       
   238      * @param aDuration Duration to new size
       
   239      */
       
   240     IMPORT_C void SetSize(TSize aSize, TUint aDuration = 0);
       
   241     
       
   242     /**
       
   243      * SetRotation
       
   244      *
       
   245      * @since S60 5.0
       
   246      * @param aAngle New rotation angle
       
   247      * @param Duration to new rotation angle
       
   248      */
       
   249     IMPORT_C void SetRotation(TReal32 aAngle, TUint aDuration = 0) __SOFTFP;
       
   250     /**
       
   251      * Size
       
   252      *
       
   253      * @since S60 5.0
       
   254      * @param aOpacity New opacity value
       
   255      * @param Duration to new opacity value
       
   256      */
       
   257     IMPORT_C void SetOpacity(TReal32 aOpacity, TUint aDuration = 0) __SOFTFP;
       
   258     
       
   259     public: // utils
       
   260     
       
   261     /**
       
   262 	 * SetFlag
       
   263 	 *
       
   264 	 * @param flag
       
   265 	 */
       
   266 	 void SetFlag( TInt aFlag );
       
   267 
       
   268     /**
       
   269 	 * ClearFlag
       
   270 	 *
       
   271 	 * @param flag
       
   272 	 */    
       
   273     void ClearFlag( TInt aFlag );
       
   274     
       
   275     /**
       
   276      * SetWsInfo
       
   277      *
       
   278      * @since S60 5.0
       
   279      * @param aInfo
       
   280      */
       
   281     void SetWsInfo(const TAlfWServInfo& aInfo);
       
   282     
       
   283     /**
       
   284      * CompareIds
       
   285      *
       
   286      * Compares window id and window group identifier with the given window. 
       
   287      * 
       
   288      * @since S60 5.0
       
   289      * @return ETrue, if ids match. Otherwise EFalse.
       
   290      */
       
   291     static TBool CompareIds( const TWindowIdentifier* aWServId, const CAlfWindow& aWindow )
       
   292         {
       
   293         return aWServId->Equals(aWindow.WsInfo().iClientSideId);
       
   294         }
       
   295 
       
   296     /**
       
   297      * IsInsertedToScene
       
   298      * 
       
   299      * @since S60 5.0
       
   300      * @return ETrue, if visual window has been inserted to the scene. (meaning, Set operations will be posted forward)
       
   301      */
       
   302     TBool IsInsertedToScene();
       
   303 
       
   304     /**
       
   305      * InsertedToScene
       
   306      * 
       
   307      * @param aInserted New scene state for this window
       
   308      */ 
       
   309     void InsertedToScene(TBool aInserted);
       
   310     
       
   311     /**
       
   312      * Should the window be set inactive when it is released
       
   313      */
       
   314     TBool ShouldBeDeactivated(); 
       
   315 
       
   316     /*
       
   317      * PostPartialBuffer
       
   318      * 
       
   319      * Posts partial command buffer towards CHuiCanvas. Buffer is not processed until the final part is delivered.
       
   320      * 
       
   321      * @param aPtr  Pointer to the beginning of the command buffer in the shared junk
       
   322      * @param aSize Length of the commands for this frame of a window
       
   323      */ 
       
   324     void PostPartialBuffer( 
       
   325             TAny* aPtr, 
       
   326             TInt aSize, 
       
   327             TBool aPartial, 
       
   328             TBool aLastPart, 
       
   329             TBool aEmptyBuffers, 
       
   330             TInt aNodeFlags );
       
   331     
       
   332     /*
       
   333      * PostBuffer
       
   334      * 
       
   335      * Posts the command buffer towards CHuiCanvas. Previous buffers are cleared.
       
   336      * 
       
   337      * @param aPtr  Pointer to the beginning of the command buffer in the shared junk
       
   338      * @param aSize Length of the commands for this frame of a window
       
   339      */ 
       
   340     void PostBuffer( TAny* aPtr, TInt aSize, TInt aNodeFlags );
       
   341     
       
   342     // RnD only
       
   343     CFbsBitGc* GetBitGcL();
       
   344     
       
   345     void CommitGc();
       
   346     
       
   347     void SetNodeTracking( TInt aValue );
       
   348 
       
   349 private:
       
   350     
       
   351     CAlfWindow();
       
   352     
       
   353     void ConstructL(TUint aId, CAlfWindowManager& aOwner, const TSize& aSizeInPixels);
       
   354 
       
   355     TAlfWindowAttributes* CreateWindowAttributes(TInt& aIndex);
       
   356 
       
   357     TAlfWindowCommandBufferAttributes* CreateWindowCommandBufferAttributes(TInt& aIndex);
       
   358 
       
   359     void CreateInBufferL();
       
   360 
       
   361 private:
       
   362     
       
   363     /**
       
   364      *  Own.
       
   365      */
       
   366     TAlfWindowData* iData;
       
   367     
       
   368     };
       
   369 
       
   370 #endif