os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/inc/graphicsurface.h
First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Reference sample client-side "provider" interface CWsGraphic plugin using GCE Surfaces
15 // Copied from common/generic/graphics/wserv/nga/samplegraphicsurfacedrawer
16 // if the CRP tests suddenly starts to break or fail to build it might be due to this file has changed in CBR
21 #ifndef __GRAPHICSURFACE_H__
22 #define __GRAPHICSURFACE_H__
25 #include <w32stdgraphic.h>
26 #include <graphics/surface.h>
27 #include <graphics/surfaceconfiguration.h>
29 enum TDrawWsGraphicArgumentFlags
31 EDrawWsAllScreens =0x00000001,
32 EDrawWsTSurfaceIdIgnored =0x00000002, //<Indicates that the client should NOT supply
33 EDrawWsNotifyProviderTSurfaceIdChanged =0x00000100,
34 EDrawWsNotifyProviderConfigChanged =0x00000200,
35 EDrawWsNotifyProviderPlayControlsChanged =0x00000400,
36 EDrawWsNotifyProviderSurfaceUnreferenced =0x00000800,
37 EDrawWsNotifyProviderConfigRereferenced =0x00001000, //<Triggers a one-shot config notification when drawn after an unreference
38 EDrawWsNotifyProviderConfigNextReref =0x00002000, //<Automatic one-shot set after unreferenced if
39 EDrawWsNotifyError =0x00010000,
40 EDrawWsNotifyProviderAll =0x000FFF00,
41 EDrawWsUpdateTSurfaceId =0x00100000,
42 EDrawWsUpdateConfiguration =0x00200000,
43 EDrawWsUpdatePlayerControls =0x00400000,
44 EDrawWsUpdateAll =0x0FF00000,
47 //KUidGraphicMsgSurface= 0x10285C57 To 0x10285C5B
48 class TWsSurfaceConfiguration: public TWsGraphicMsgFixedBase
49 /** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand surface configuration commands.
50 Also use to notify owner client of config change.
60 TWsSurfaceConfiguration()
61 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
63 TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig)
64 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)),
68 TSurfaceConfiguration iConfig;
71 class TWsDebugResultCode: public TWsGraphicMsgFixedBase
72 /** Data attached to a message to the artwork provider notifying it of a command result code
73 This code is always followed by the command that caused it (TSurfaceConfig)
81 TWsDebugResultCode(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
89 class TWsSurfaceUnreferenced: public TWsGraphicMsgFixedBase
90 /** data attached to a message to the artwork provider to allow it to react if a surface is no longer drawn
91 play-stop-pause commands.
101 TWsSurfaceUnreferenced(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
105 class CWsGraphicDrawerSurface;
106 class TWsDebugResultCode;
107 class CWsGraphicSurface: public CWsGraphic
108 /** Client representation of a window-server-side CFbsBitmap owned by this Client
114 friend class CWsGraphicDrawerSurface;
116 IMPORT_C static CWsGraphicSurface* NewL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
117 IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
118 IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
119 IMPORT_C void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
120 IMPORT_C void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
121 IMPORT_C void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
122 IMPORT_C ~CWsGraphicSurface();
124 IMPORT_C TInt ShareGlobally();
125 IMPORT_C TInt UnShareGlobally();
126 IMPORT_C TInt Share(TSecureId aClientId);
127 IMPORT_C TInt UnShare(TSecureId aClientId);
128 IMPORT_C TInt SendMessage(const TSurfaceConfiguration&);
129 IMPORT_C TInt SendMessage(const TWsGraphicAnimation&);
131 virtual void HandleMessage(const TSurfaceConfiguration&) {}
132 virtual void HandleMessage(const TWsGraphicAnimation&) {}
133 virtual void HandleMessage(const TWsSurfaceUnreferenced&) {}
134 virtual void HandleMessage(const TWsDebugResultCode&) {}
135 virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&) {}
136 IMPORT_C virtual TInt CWsGraphicSurface_Reserved1();
137 IMPORT_C virtual TInt CWsGraphicSurface_Reserved2();
138 IMPORT_C virtual TInt CWsGraphicSurface_Reserved3();
140 class TConstructParams;
141 IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
142 IMPORT_C CWsGraphicSurface(); //Derivers should implement NewL to call ConstructL
143 IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray<TUint>* aScreensMap=NULL);
144 IMPORT_C void UnRegisterScreens();
146 void HandleMessage(const TDesC8& aData);
150 TSurfaceId iRegisteredId;
151 RArray<TUint> iRegisteredScreens;
154 /** Used as the parameter payload to construct the drawer
156 class CWsGraphicSurface::TConstructParams
160 { return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase); }
161 void* operator new(TUint size,TInt aNumExtras)
163 return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0));
165 void operator delete(void* aObj,TInt /*aNumExtras*/)
167 ::operator delete(aObj);
169 void operator delete(void* aObj)
171 ::operator delete(aObj);
173 TWsSurfaceConfiguration iConfig;
174 class TParamFlags:public TWsGraphicMsgFixedBase
182 TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
184 TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt))
186 TUint iDrawWsGraphicArgumentFlags;
187 TUint iScreensMap[1]; //THIS MUST BE THE LAST FIELD!!!
191 TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0)
192 : iConfig(aConfig),iParamFlags(aNumExtras)
194 TCleanupItem CleanupItem() { return TCleanupItem(Cleanup,this); }
195 static void Cleanup(void* p) { delete(TConstructParams*)p; }
198 #endif //__GRAPHICSURFACE_H__