diff -r 000000000000 -r 40261b775718 mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/graphicsurface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/graphicsurface.h Tue Feb 02 01:56:55 2010 +0200 @@ -0,0 +1,198 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Reference sample client-side "provider" interface CWsGraphic plugin using GCE Surfaces +// Copied from common/generic/graphics/wserv/nga/samplegraphicsurfacedrawer +// if the CRP tests suddenly starts to break or fail to build it might be due to this file has changed in CBR +// +// + +#ifndef __GRAPHICSURFACE_H__ +#define __GRAPHICSURFACE_H__ + +#include +#include +#include +#include + +enum TDrawWsGraphicArgumentFlags + { + EDrawWsAllScreens =0x00000001, + EDrawWsTSurfaceIdIgnored =0x00000002, //* aScreensMap=NULL); + IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C ~CWsGraphicSurface(); +protected: + IMPORT_C TInt ShareGlobally(); + IMPORT_C TInt UnShareGlobally(); + IMPORT_C TInt Share(TSecureId aClientId); + IMPORT_C TInt UnShare(TSecureId aClientId); + IMPORT_C TInt SendMessage(const TSurfaceConfiguration&); + IMPORT_C TInt SendMessage(const TWsGraphicAnimation&); + + virtual void HandleMessage(const TSurfaceConfiguration&) {} + virtual void HandleMessage(const TWsGraphicAnimation&) {} + virtual void HandleMessage(const TWsSurfaceUnreferenced&) {} + virtual void HandleMessage(const TWsDebugResultCode&) {} + virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&) {} + IMPORT_C virtual TInt CWsGraphicSurface_Reserved1(); + IMPORT_C virtual TInt CWsGraphicSurface_Reserved2(); + IMPORT_C virtual TInt CWsGraphicSurface_Reserved3(); +protected: + class TConstructParams; + IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray* aScreensMap=NULL); + IMPORT_C CWsGraphicSurface(); //Derivers should implement NewL to call ConstructL + IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray* aScreensMap=NULL); + IMPORT_C void UnRegisterScreens(); +private: + void HandleMessage(const TDesC8& aData); + void OnReplace(); + +private: //data + TSurfaceId iRegisteredId; + RArray iRegisteredScreens; + }; + +/** Used as the parameter payload to construct the drawer +*/ +class CWsGraphicSurface::TConstructParams + { +public: + TInt Size() + { return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase); } + void* operator new(TUint size,TInt aNumExtras) + { + return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0)); + } + void operator delete(void* aObj,TInt /*aNumExtras*/) + { + ::operator delete(aObj); + } + void operator delete(void* aObj) + { + ::operator delete(aObj); + } + TWsSurfaceConfiguration iConfig; + class TParamFlags:public TWsGraphicMsgFixedBase + { + public: + enum + { + ETypeId = 0x10285C59 + }; + + TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)) + {} + TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt)) + {} + TUint iDrawWsGraphicArgumentFlags; + TUint iScreensMap[1]; //THIS MUST BE THE LAST FIELD!!! + } iParamFlags; + TConstructParams() + { } + TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0) + : iConfig(aConfig),iParamFlags(aNumExtras) + { } + TCleanupItem CleanupItem() { return TCleanupItem(Cleanup,this); } + static void Cleanup(void* p) { delete(TConstructParams*)p; } + }; + +#endif //__GRAPHICSURFACE_H__ +