uiacceltk/hitchcock/Client/inc/alfclient.h
changeset 0 15bf7259bb7c
child 57 eaa079afe64c
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:   Client class for the alfredserver.exe
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef R_ALFCLIENT_H
       
    21 #define R_ALFCLIENT_H
       
    22 
       
    23 #include <alf/alfconstants.h>
       
    24 #include <alf/alfclientbase.h>
       
    25 #include "alf/alfvisual.h"
       
    26 #include "alf/alflayout.h"
       
    27 #include "alf/alfenv.h"
       
    28 #include "alf/alftexture.h"
       
    29 #include "alf/alfimage.h"
       
    30 #include "alf/alfroster.h"
       
    31 #include "alf/alfbatchbuffer.h"
       
    32 
       
    33 #include <AknsItemID.h>
       
    34 #include <gdi.h>
       
    35 
       
    36 /**
       
    37  *  Alfred client.
       
    38  *
       
    39  *  @lib alfclient.lib
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 NONSHARABLE_CLASS( RAlfClient ): public RAlfClientBase
       
    43     {
       
    44     
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Constructor
       
    49      */
       
    50     RAlfClient();
       
    51     
       
    52     /**
       
    53      * Disconnect from the server. Must be called before destruction (not just Close() )
       
    54      */ 
       
    55     void Disconnect();
       
    56     
       
    57 // Env
       
    58 
       
    59     /**
       
    60      * Sets the refresh mode.
       
    61      *
       
    62      * @Todo: should be protected with capability or deprecated completely(?)
       
    63      * @param aMode  New refresh mode.
       
    64      *
       
    65      * @see TAlfRefreshMode
       
    66      */
       
    67     void EnvSetRefreshMode( TAlfRefreshMode aMode );
       
    68     
       
    69     /**
       
    70      * @Todo: should be protected with capability or deprecated completely(?)
       
    71      * Sets the maximum allowed frame rate. Specify 0.0 to use the default limit.
       
    72      *
       
    73      * @param aFrameRate  New maximum frame rate in frames per second.
       
    74      */
       
    75     void EnvSetMaxFrameRate( TReal32 aFrameRate );
       
    76     
       
    77     /**
       
    78      * Continues normal display refreshing. If display refreshing is already
       
    79      * being done, calling this has no effect. This is called automatically
       
    80      * from inside the toolkit when something is done that may lead to a
       
    81      * visible change on a display. The application may also call this if it
       
    82      * has previously paused refresh with PauseRefresh().
       
    83      */
       
    84     void EnvContinueRefresh();
       
    85 
       
    86     /**
       
    87      * Pauses display refreshing temporarily. This is called when it is clear
       
    88      * that any displays will not be updated soon. The application may call
       
    89      * this at times when it needs more processing time for other tasks.
       
    90      */
       
    91     void EnvPauseRefresh();
       
    92     
       
    93     /**
       
    94      * Called on manual refresh.
       
    95      */
       
    96     void EnvRefreshCallBack();
       
    97     
       
    98     /**
       
    99      * Determines which renderer is currently in use. Always returns the real
       
   100      * explicit identifier of the renderer, and not an ambiguous identifier
       
   101      * like "Default".
       
   102      */
       
   103     TInt EnvRenderer() const;
       
   104     
       
   105     /**
       
   106      * Sets the interval before an idle notification is sent. 
       
   107      *
       
   108      * @param aSeconds  Threshold in milliseconds.
       
   109      */
       
   110     void EnvSetIdleThreshold(TInt aMilliseconds);
       
   111    
       
   112 // Roster
       
   113 
       
   114     /**
       
   115      * Shows given control group in the roster using given display.
       
   116      *
       
   117      * @param aCntrlGroupHandle Handle to the server side object.
       
   118      * @param aWhere Where on the roster (top/under/middle/...)
       
   119      * @param aDisplayHandle Handle to the server side object.
       
   120      * @return Error code.
       
   121      */
       
   122     TInt RosterShow( TInt aCntrlGroupHandle, TInt aWhere, TInt aDisplayHandle );
       
   123     
       
   124     /**
       
   125      * Hides given control group.
       
   126      *
       
   127      * @param aCntrlGroupHandle Handle to the server side object.
       
   128      * @param aDisplayHandle Handle to the server side object.
       
   129      * @return Error code.
       
   130      */
       
   131     TInt RosterHide( TInt aCntrlGroupHandle, TInt aDisplayHandle );
       
   132     
       
   133     TInt RosterShowVisual( TInt aVisualHandle, TInt aDisplayHandle );
       
   134     TInt RosterHideVisual( TInt aVisualHandle,  TInt aDisplayHandle );
       
   135     TInt RosterMoveVisualToFront( TInt aVisualHandle, TInt aDisplayHandle );
       
   136     
       
   137     TInt RosterSetPointerEventObservers( TInt aFlags, TInt aCntrlHandle, TInt aDisplayHandle );
       
   138     TInt RosterAddPointerEventObserver( TAlfPointerEventFlags aObserver, TInt aCntrlHandle, TInt aDisplayHandle );
       
   139     TInt RosterRemovePointerEventObserver( TAlfPointerEventFlags aObserver, TInt aCntrlHandle, TInt aDisplayHandle );
       
   140 
       
   141     TInt RosterSetPointerDragTreshold( TInt aCntrlHandle, const TAlfXYMetric& aXYMetric, TInt aDisplayHandle );
       
   142     TInt RosterDisableLongTapEventsWhenDragging( TInt aCntrlHandle, TBool aDisable, TInt aDisplayHandle );
       
   143     
       
   144 // Static
       
   145 
       
   146 // Texture 
       
   147     
       
   148     /**
       
   149      * Updates owner id.
       
   150      * This method must be called before calling other texture related methods.
       
   151      * @return Error code.
       
   152      */
       
   153     TInt TextureUpdateOwnerId();
       
   154     
       
   155     /**
       
   156      * Creates new texture. Leaves on error.
       
   157      *
       
   158      * @param aId ID of the texture.
       
   159      * @param aFlags Texture flags.
       
   160      * @param aFilename the filename of the image
       
   161      * @return Error code.
       
   162      */
       
   163     TInt TextureCreateAnimatedL(TInt aId, TAlfTextureFlags aFlags, TInt aManagerId, const TDesC& aFilename);
       
   164 
       
   165     /**
       
   166      * Creates new texture. Leaves on error.
       
   167      *
       
   168      * @param aId ID of the texture.
       
   169      * @param aBitmapHandle Handle to the bitmap.
       
   170      * @param aMaskBitmapHandle Handle to the bitmap mask.
       
   171      * @param aFlags Texture flags.
       
   172      * @param aManagerId Id of texture manager
       
   173      * @return Error code.
       
   174      */
       
   175     TInt TextureCreateL( TInt aId, TInt aBitmapHandle, TInt aMaskBitmapHandle, TAlfTextureFlags aFlags, TInt aManagerId );
       
   176 
       
   177     /**
       
   178      * Loads texture. Leaves on error.
       
   179      *
       
   180      * @param aId ID of the texture.
       
   181      * @param aBitmapHandle Handle to the bitmap.
       
   182      * @param aMaskBitmapHandle Handle to the bitmap mask.
       
   183      * @param aFlags Texture flags.
       
   184      * @param aManagerId Id of texture manager
       
   185      * @return Error code.
       
   186      */
       
   187 	TInt TextureLoadL( TInt aId, TInt aBitmapHandle, TInt aMaskBitmapHandle, TAlfTextureFlags aFlags, TInt aManagerId  );
       
   188 
       
   189     /**
       
   190      * Unloads given texture. 
       
   191      *
       
   192      * @param aId ID of the texture.
       
   193      * @param aManagerId Id of texture manager
       
   194      * @return Error code.
       
   195      */
       
   196 	TInt TextureUnload( TInt aId, TInt aManagerId );
       
   197 
       
   198     /**
       
   199      * Releases given texture.
       
   200      * @param aId ID of the texture.
       
   201      * @param aManagerId Id of texture manager
       
   202      * @return Error code.
       
   203      */
       
   204 	TInt TextureRelease( TInt aId, TInt aManagerId );
       
   205 
       
   206     /**
       
   207      * Restores given texture.
       
   208      * @param aId ID of the texture.
       
   209      * @param aManagerId Id of texture manager
       
   210      * @return Error code.
       
   211      */
       
   212 	TInt TextureRestore( TInt aId, TInt aManagerId );
       
   213 
       
   214     /**
       
   215      * Notifies skin change for given texture.
       
   216      * @param aId ID of the texture.
       
   217      * @param aManagerId Id of texture manager
       
   218      * @return Error code.
       
   219      */
       
   220 	TInt TextureNotifySkinChanged( TInt aId, TInt aManagerId );
       
   221 
       
   222     /**
       
   223      * Blurs given texture. 
       
   224      *
       
   225      */
       
   226 	TInt TextureProcessorBlurL( const TInt aServerSideSrcHandle, 
       
   227 	    TInt aServerSideDstHandle, 
       
   228 	    TInt aManagerId, 
       
   229 	    const TSize& aPreferredSize, 
       
   230 	    TInt aFilterSize, 
       
   231 	    TInt aFlag );
       
   232 
       
   233     /**
       
   234      * Checks if given texture has content. 
       
   235      *
       
   236      */
       
   237 	TInt TextureHasContent( TBool& aHasContent, TInt aId, TInt aManagerId );
       
   238 
       
   239     /**
       
   240      * Delete given texture. 
       
   241      *
       
   242      * @param aId ID of the texture.
       
   243      * @param aManagerId Id of texture manager
       
   244      * @return Error code.
       
   245      */
       
   246 	TInt TextureDelete( TInt aId, TInt aManagerId );
       
   247 
       
   248     /**
       
   249      * Starts to animate the texture if the texture
       
   250      * was animated.
       
   251      *
       
   252      * @param aId ID of the texture.
       
   253      */
       
   254     TInt TextureStartAnimation( TInt aId );
       
   255     
       
   256     /**
       
   257      * Stops the texture animation if the texture
       
   258      * was animated.
       
   259      *
       
   260      * @param aId ID of the texture.
       
   261      */
       
   262     TInt TextureStopAnimation( TInt aId );
       
   263 
       
   264     /** 
       
   265      * Notifies texture information.
       
   266      * @param aStatus request status.
       
   267      * @param aDest destination buffer which will contain events.
       
   268      */
       
   269     void TextureNotifyInfo( TRequestStatus& aStatus, TDes8& aDest );
       
   270 
       
   271     /**
       
   272      * Cancels texture information notification.
       
   273      */
       
   274     void TextureCancelNotifyInfo();
       
   275 
       
   276     /**
       
   277      * Sets parameters for the preferred size calculation.
       
   278      * 
       
   279      * @param aId ID of the texture.
       
   280      * @param aManagerId Id of texture manager
       
   281      * @param aParams auto size paramters.
       
   282      */
       
   283     TInt TextureSetAutoSizeParams( TInt aId, TInt aManagerId, const TAlfTextureAutoSizeParams& aParams );
       
   284 
       
   285 // Misc
       
   286 
       
   287     /**
       
   288     * Notify server about this application foreground status
       
   289     */ 
       
   290     void ApplicationIsForeground(TBool aIsPartiallyOrFullyForeground);
       
   291     
       
   292     void RequestPointerEvents(TDes8& aEventAsDescriptor, TRequestStatus& aStatus);
       
   293 
       
   294     void CancelPointerEvents();
       
   295     
       
   296     void SetFullScreenDrawing(TBool aEnable);
       
   297     
       
   298     TInt LayoutMetricsTextStyleData(TInt& aFontCategory, TInt aTextStyle);
       
   299     
       
   300     void RequestSystemEvents(TDes8& aEventAsDescriptor, TRequestStatus& aStatus);
       
   301 
       
   302     void CancelSystemEvents();
       
   303     
       
   304     void SetWgParent(TInt aParentId);
       
   305     
       
   306     /** 
       
   307      * Generic command
       
   308      */
       
   309 	void SendCmd(TUint aCmd, TDes8& aBuf);
       
   310     
       
   311     /** 
       
   312      * Generic synchronous command
       
   313      */
       
   314 	TInt SendSyncCmd(TUint aCmd, TDes8& aBuf);
       
   315 
       
   316     /** 
       
   317      * Generic asynchronous command
       
   318      */
       
   319 	void SendAsyncCmd(TUint aCmd, TDes8& aBuf, TRequestStatus& aStatus);
       
   320      
       
   321      
       
   322     TInt SendNoReply(TUint aOp, const TDesC8& aInputBuf, TInt aSubSessionHandle);
       
   323     
       
   324     TAlfAutoFlushMode AutoFlushMode() const;
       
   325     void SetAutoFlushMode( TAlfAutoFlushMode aAutoFlushMode );
       
   326     TInt FlushBatchBuffer();
       
   327     void SetMaxBatchBufferSize( TInt aBufferSize );
       
   328     TInt GetBatchBufferInfo( TAlfBatchBufferInfoType aBufferInfoType ) const;
       
   329     
       
   330    /** 
       
   331     * Post QT command buffer to server side canvas
       
   332     */
       
   333     TInt PostQtBuffer( TInt aWsWgId, TInt aWsClientId, TDes8& aCommandBuffer, 
       
   334            TAlfCommandBufferStatus aStatus );
       
   335 private:
       
   336     TInt AllocateExtendedBuffer( TInt aMoreSpaceNeeded );
       
   337     inline static void AppendPadding( TDes8& aBuffer, TInt aAmount );
       
   338     
       
   339 private:
       
   340 
       
   341     HBufC8* iDefaultBatchBuffer; // owned
       
   342     HBufC8* iExtendedBatchBuffer; // owned
       
   343     HBufC8* iUsedBatchBuffer; // not owned. points to iDefaultBatchBuffer or iExtendedBatchBuffer
       
   344     
       
   345     class CBatchBufferAutoFlusher;
       
   346     CBatchBufferAutoFlusher* iAutoFlusher;
       
   347     
       
   348     TAlfAutoFlushMode iAutoFlushMode;
       
   349     TInt iUsedMaxBufferSize;
       
   350     };
       
   351 
       
   352 
       
   353 #endif // R_ALFCLIENT_H