os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/inc/graphicsurface.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/inc/graphicsurface.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,199 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Reference sample client-side "provider" interface CWsGraphic plugin using GCE Surfaces
    1.18 +// Copied from common/generic/graphics/wserv/nga/samplegraphicsurfacedrawer
    1.19 +// if the CRP tests suddenly starts to break or fail to build it might be due to this file has changed in CBR
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +
    1.24 +#ifndef __GRAPHICSURFACE_H__
    1.25 +#define __GRAPHICSURFACE_H__
    1.26 +
    1.27 +#include <w32std.h>
    1.28 +#include <w32stdgraphic.h>
    1.29 +#include <graphics/surface.h>
    1.30 +#include <graphics/surfaceconfiguration.h>
    1.31 +
    1.32 +enum TDrawWsGraphicArgumentFlags
    1.33 +	{
    1.34 +	EDrawWsAllScreens							=0x00000001,
    1.35 +	EDrawWsTSurfaceIdIgnored 					=0x00000002,	//<Indicates that the client should NOT supply
    1.36 +	EDrawWsNotifyProviderTSurfaceIdChanged		=0x00000100,
    1.37 +	EDrawWsNotifyProviderConfigChanged			=0x00000200,
    1.38 +	EDrawWsNotifyProviderPlayControlsChanged	=0x00000400,
    1.39 +	EDrawWsNotifyProviderSurfaceUnreferenced	=0x00000800,
    1.40 +	EDrawWsNotifyProviderConfigRereferenced		=0x00001000,	//<Triggers a one-shot config notification when drawn after an unreference
    1.41 +	EDrawWsNotifyProviderConfigNextReref		=0x00002000,	//<Automatic one-shot set after unreferenced if 
    1.42 +	EDrawWsNotifyError							=0x00010000,
    1.43 +	EDrawWsNotifyProviderAll					=0x000FFF00,
    1.44 +	EDrawWsUpdateTSurfaceId						=0x00100000,
    1.45 +	EDrawWsUpdateConfiguration					=0x00200000,
    1.46 +	EDrawWsUpdatePlayerControls					=0x00400000,
    1.47 +	EDrawWsUpdateAll							=0x0FF00000,
    1.48 +	};
    1.49 +
    1.50 +//KUidGraphicMsgSurface=  0x10285C57 	  To    0x10285C5B
    1.51 +class TWsSurfaceConfiguration: public TWsGraphicMsgFixedBase
    1.52 +/** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand surface configuration commands.
    1.53 +Also use to notify owner client of config change.
    1.54 +
    1.55 +@publishedAll
    1.56 +@released
    1.57 +*/	{
    1.58 +public:
    1.59 +	enum
    1.60 +		{
    1.61 +		ETypeId = 0x10285C57
    1.62 +		};
    1.63 +		TWsSurfaceConfiguration()
    1.64 +		:	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
    1.65 +		{	}
    1.66 +		TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig)
    1.67 +		:	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)),
    1.68 +			iConfig(aConfig)
    1.69 +			
    1.70 +		{	}
    1.71 +	TSurfaceConfiguration iConfig;
    1.72 +	};
    1.73 +
    1.74 +class TWsDebugResultCode: public TWsGraphicMsgFixedBase
    1.75 +/** Data attached to a message to the artwork provider notifying it of a command result code
    1.76 +This code is always followed by the command that caused it (TSurfaceConfig)
    1.77 +*/
    1.78 +	{
    1.79 +public:
    1.80 +	enum
    1.81 +		{
    1.82 +		ETypeId = 0x10285C5A
    1.83 +		};
    1.84 +	TWsDebugResultCode():	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
    1.85 +		{	}
    1.86 +	TInt iResult;
    1.87 +	TInt iExtra;
    1.88 +	TInt iLineNum;
    1.89 +	};
    1.90 +
    1.91 +
    1.92 +class TWsSurfaceUnreferenced: public TWsGraphicMsgFixedBase
    1.93 +/** data attached to a message to the artwork provider to allow it to react if a surface is no longer drawn
    1.94 +play-stop-pause commands.
    1.95 +
    1.96 +@publishedAll
    1.97 +@released
    1.98 +*/	{
    1.99 +public:
   1.100 +	enum
   1.101 +		{
   1.102 +		ETypeId = 0x10285C58
   1.103 +		};
   1.104 +	TWsSurfaceUnreferenced():	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
   1.105 +		{	}
   1.106 +	TSurfaceId iId;
   1.107 +	};
   1.108 +class CWsGraphicDrawerSurface;
   1.109 +class TWsDebugResultCode;
   1.110 +class CWsGraphicSurface: public CWsGraphic
   1.111 +/** Client representation of a window-server-side CFbsBitmap owned by this Client
   1.112 +
   1.113 +@publishedAll
   1.114 +@released
   1.115 +*/
   1.116 +	{
   1.117 +	friend class CWsGraphicDrawerSurface;
   1.118 +public:
   1.119 +	IMPORT_C static CWsGraphicSurface* NewL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.120 +	IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.121 +	IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.122 +	IMPORT_C  void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.123 +	IMPORT_C  void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.124 +	IMPORT_C  void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.125 +	IMPORT_C ~CWsGraphicSurface();
   1.126 +protected: 
   1.127 +	IMPORT_C TInt ShareGlobally();
   1.128 +	IMPORT_C TInt UnShareGlobally();
   1.129 +	IMPORT_C TInt Share(TSecureId aClientId);
   1.130 +	IMPORT_C TInt UnShare(TSecureId aClientId);
   1.131 +	IMPORT_C TInt SendMessage(const TSurfaceConfiguration&);
   1.132 +	IMPORT_C TInt SendMessage(const TWsGraphicAnimation&);
   1.133 +
   1.134 +	virtual void HandleMessage(const TSurfaceConfiguration&)		{}
   1.135 +	virtual void HandleMessage(const TWsGraphicAnimation&)			{}
   1.136 +	virtual void HandleMessage(const TWsSurfaceUnreferenced&)		{}
   1.137 +	virtual void HandleMessage(const TWsDebugResultCode&)		{}
   1.138 +	virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&)	{}
   1.139 +	IMPORT_C virtual TInt CWsGraphicSurface_Reserved1();
   1.140 +	IMPORT_C virtual TInt CWsGraphicSurface_Reserved2();
   1.141 +	IMPORT_C virtual TInt CWsGraphicSurface_Reserved3();
   1.142 +protected:
   1.143 +	class TConstructParams;
   1.144 +	IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
   1.145 +	IMPORT_C CWsGraphicSurface();		//Derivers should implement NewL to call ConstructL
   1.146 +	IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray<TUint>*  aScreensMap=NULL);
   1.147 +	IMPORT_C void UnRegisterScreens();
   1.148 +private:
   1.149 +	void HandleMessage(const TDesC8& aData);
   1.150 +	void OnReplace();
   1.151 +
   1.152 +private: //data
   1.153 +	TSurfaceId		iRegisteredId;
   1.154 +	RArray<TUint>	iRegisteredScreens;
   1.155 +	};
   1.156 +
   1.157 +/** Used as the parameter payload to construct the drawer
   1.158 +*/
   1.159 +class CWsGraphicSurface::TConstructParams
   1.160 +	{
   1.161 +public:
   1.162 +	TInt Size()
   1.163 +		{	return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase);	}
   1.164 +	void* operator new(TUint size,TInt aNumExtras)
   1.165 +		{
   1.166 +		return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0));
   1.167 +		}
   1.168 +	void operator delete(void* aObj,TInt /*aNumExtras*/)
   1.169 +		{
   1.170 +		::operator delete(aObj);
   1.171 +		}
   1.172 +	void operator delete(void* aObj)
   1.173 +		{
   1.174 +		::operator delete(aObj);
   1.175 +		}
   1.176 +	TWsSurfaceConfiguration iConfig;
   1.177 +	class TParamFlags:public TWsGraphicMsgFixedBase
   1.178 +		{
   1.179 +		public:
   1.180 +		enum
   1.181 +			{
   1.182 +			ETypeId = 0x10285C59
   1.183 +			};
   1.184 +
   1.185 +		TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
   1.186 +			{}
   1.187 +		TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt))
   1.188 +			{}
   1.189 +		TUint iDrawWsGraphicArgumentFlags;
   1.190 +		TUint iScreensMap[1];	//THIS MUST BE THE LAST FIELD!!!
   1.191 +		} iParamFlags;
   1.192 +	TConstructParams()	
   1.193 +	{	}
   1.194 +	TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0)
   1.195 +	:	iConfig(aConfig),iParamFlags(aNumExtras)
   1.196 +	{	}
   1.197 +	TCleanupItem	CleanupItem()	{ return TCleanupItem(Cleanup,this);	}
   1.198 +	static void Cleanup(void* p)	{	delete(TConstructParams*)p;	}	
   1.199 +	};
   1.200 +
   1.201 +#endif //__GRAPHICSURFACE_H__
   1.202 +