sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Reference sample client-side "provider" interface CWsGraphic plugin using GCE Surfaces
|
sl@0
|
15 |
// Copied from common/generic/graphics/wserv/nga/samplegraphicsurfacedrawer
|
sl@0
|
16 |
// if the CRP tests suddenly starts to break or fail to build it might be due to this file has changed in CBR
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifndef __GRAPHICSURFACE_H__
|
sl@0
|
22 |
#define __GRAPHICSURFACE_H__
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <w32std.h>
|
sl@0
|
25 |
#include <w32stdgraphic.h>
|
sl@0
|
26 |
#include <graphics/surface.h>
|
sl@0
|
27 |
#include <graphics/surfaceconfiguration.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
enum TDrawWsGraphicArgumentFlags
|
sl@0
|
30 |
{
|
sl@0
|
31 |
EDrawWsAllScreens =0x00000001,
|
sl@0
|
32 |
EDrawWsTSurfaceIdIgnored =0x00000002, //<Indicates that the client should NOT supply
|
sl@0
|
33 |
EDrawWsNotifyProviderTSurfaceIdChanged =0x00000100,
|
sl@0
|
34 |
EDrawWsNotifyProviderConfigChanged =0x00000200,
|
sl@0
|
35 |
EDrawWsNotifyProviderPlayControlsChanged =0x00000400,
|
sl@0
|
36 |
EDrawWsNotifyProviderSurfaceUnreferenced =0x00000800,
|
sl@0
|
37 |
EDrawWsNotifyProviderConfigRereferenced =0x00001000, //<Triggers a one-shot config notification when drawn after an unreference
|
sl@0
|
38 |
EDrawWsNotifyProviderConfigNextReref =0x00002000, //<Automatic one-shot set after unreferenced if
|
sl@0
|
39 |
EDrawWsNotifyError =0x00010000,
|
sl@0
|
40 |
EDrawWsNotifyProviderAll =0x000FFF00,
|
sl@0
|
41 |
EDrawWsUpdateTSurfaceId =0x00100000,
|
sl@0
|
42 |
EDrawWsUpdateConfiguration =0x00200000,
|
sl@0
|
43 |
EDrawWsUpdatePlayerControls =0x00400000,
|
sl@0
|
44 |
EDrawWsUpdateAll =0x0FF00000,
|
sl@0
|
45 |
};
|
sl@0
|
46 |
|
sl@0
|
47 |
//KUidGraphicMsgSurface= 0x10285C57 To 0x10285C5B
|
sl@0
|
48 |
class TWsSurfaceConfiguration: public TWsGraphicMsgFixedBase
|
sl@0
|
49 |
/** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand surface configuration commands.
|
sl@0
|
50 |
Also use to notify owner client of config change.
|
sl@0
|
51 |
|
sl@0
|
52 |
@publishedAll
|
sl@0
|
53 |
@released
|
sl@0
|
54 |
*/ {
|
sl@0
|
55 |
public:
|
sl@0
|
56 |
enum
|
sl@0
|
57 |
{
|
sl@0
|
58 |
ETypeId = 0x10285C57
|
sl@0
|
59 |
};
|
sl@0
|
60 |
TWsSurfaceConfiguration()
|
sl@0
|
61 |
: TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
|
sl@0
|
62 |
{ }
|
sl@0
|
63 |
TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig)
|
sl@0
|
64 |
: TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)),
|
sl@0
|
65 |
iConfig(aConfig)
|
sl@0
|
66 |
|
sl@0
|
67 |
{ }
|
sl@0
|
68 |
TSurfaceConfiguration iConfig;
|
sl@0
|
69 |
};
|
sl@0
|
70 |
|
sl@0
|
71 |
class TWsDebugResultCode: public TWsGraphicMsgFixedBase
|
sl@0
|
72 |
/** Data attached to a message to the artwork provider notifying it of a command result code
|
sl@0
|
73 |
This code is always followed by the command that caused it (TSurfaceConfig)
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
{
|
sl@0
|
76 |
public:
|
sl@0
|
77 |
enum
|
sl@0
|
78 |
{
|
sl@0
|
79 |
ETypeId = 0x10285C5A
|
sl@0
|
80 |
};
|
sl@0
|
81 |
TWsDebugResultCode(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
|
sl@0
|
82 |
{ }
|
sl@0
|
83 |
TInt iResult;
|
sl@0
|
84 |
TInt iExtra;
|
sl@0
|
85 |
TInt iLineNum;
|
sl@0
|
86 |
};
|
sl@0
|
87 |
|
sl@0
|
88 |
|
sl@0
|
89 |
class TWsSurfaceUnreferenced: public TWsGraphicMsgFixedBase
|
sl@0
|
90 |
/** data attached to a message to the artwork provider to allow it to react if a surface is no longer drawn
|
sl@0
|
91 |
play-stop-pause commands.
|
sl@0
|
92 |
|
sl@0
|
93 |
@publishedAll
|
sl@0
|
94 |
@released
|
sl@0
|
95 |
*/ {
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
enum
|
sl@0
|
98 |
{
|
sl@0
|
99 |
ETypeId = 0x10285C58
|
sl@0
|
100 |
};
|
sl@0
|
101 |
TWsSurfaceUnreferenced(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
|
sl@0
|
102 |
{ }
|
sl@0
|
103 |
TSurfaceId iId;
|
sl@0
|
104 |
};
|
sl@0
|
105 |
class CWsGraphicDrawerSurface;
|
sl@0
|
106 |
class TWsDebugResultCode;
|
sl@0
|
107 |
class CWsGraphicSurface: public CWsGraphic
|
sl@0
|
108 |
/** Client representation of a window-server-side CFbsBitmap owned by this Client
|
sl@0
|
109 |
|
sl@0
|
110 |
@publishedAll
|
sl@0
|
111 |
@released
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
{
|
sl@0
|
114 |
friend class CWsGraphicDrawerSurface;
|
sl@0
|
115 |
public:
|
sl@0
|
116 |
IMPORT_C static CWsGraphicSurface* NewL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
117 |
IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
118 |
IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
119 |
IMPORT_C void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
120 |
IMPORT_C void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
121 |
IMPORT_C void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
122 |
IMPORT_C ~CWsGraphicSurface();
|
sl@0
|
123 |
protected:
|
sl@0
|
124 |
IMPORT_C TInt ShareGlobally();
|
sl@0
|
125 |
IMPORT_C TInt UnShareGlobally();
|
sl@0
|
126 |
IMPORT_C TInt Share(TSecureId aClientId);
|
sl@0
|
127 |
IMPORT_C TInt UnShare(TSecureId aClientId);
|
sl@0
|
128 |
IMPORT_C TInt SendMessage(const TSurfaceConfiguration&);
|
sl@0
|
129 |
IMPORT_C TInt SendMessage(const TWsGraphicAnimation&);
|
sl@0
|
130 |
|
sl@0
|
131 |
virtual void HandleMessage(const TSurfaceConfiguration&) {}
|
sl@0
|
132 |
virtual void HandleMessage(const TWsGraphicAnimation&) {}
|
sl@0
|
133 |
virtual void HandleMessage(const TWsSurfaceUnreferenced&) {}
|
sl@0
|
134 |
virtual void HandleMessage(const TWsDebugResultCode&) {}
|
sl@0
|
135 |
virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&) {}
|
sl@0
|
136 |
IMPORT_C virtual TInt CWsGraphicSurface_Reserved1();
|
sl@0
|
137 |
IMPORT_C virtual TInt CWsGraphicSurface_Reserved2();
|
sl@0
|
138 |
IMPORT_C virtual TInt CWsGraphicSurface_Reserved3();
|
sl@0
|
139 |
protected:
|
sl@0
|
140 |
class TConstructParams;
|
sl@0
|
141 |
IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
142 |
IMPORT_C CWsGraphicSurface(); //Derivers should implement NewL to call ConstructL
|
sl@0
|
143 |
IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray<TUint>* aScreensMap=NULL);
|
sl@0
|
144 |
IMPORT_C void UnRegisterScreens();
|
sl@0
|
145 |
private:
|
sl@0
|
146 |
void HandleMessage(const TDesC8& aData);
|
sl@0
|
147 |
void OnReplace();
|
sl@0
|
148 |
|
sl@0
|
149 |
private: //data
|
sl@0
|
150 |
TSurfaceId iRegisteredId;
|
sl@0
|
151 |
RArray<TUint> iRegisteredScreens;
|
sl@0
|
152 |
};
|
sl@0
|
153 |
|
sl@0
|
154 |
/** Used as the parameter payload to construct the drawer
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
class CWsGraphicSurface::TConstructParams
|
sl@0
|
157 |
{
|
sl@0
|
158 |
public:
|
sl@0
|
159 |
TInt Size()
|
sl@0
|
160 |
{ return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase); }
|
sl@0
|
161 |
void* operator new(TUint size,TInt aNumExtras)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0));
|
sl@0
|
164 |
}
|
sl@0
|
165 |
void operator delete(void* aObj,TInt /*aNumExtras*/)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
::operator delete(aObj);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
void operator delete(void* aObj)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
::operator delete(aObj);
|
sl@0
|
172 |
}
|
sl@0
|
173 |
TWsSurfaceConfiguration iConfig;
|
sl@0
|
174 |
class TParamFlags:public TWsGraphicMsgFixedBase
|
sl@0
|
175 |
{
|
sl@0
|
176 |
public:
|
sl@0
|
177 |
enum
|
sl@0
|
178 |
{
|
sl@0
|
179 |
ETypeId = 0x10285C59
|
sl@0
|
180 |
};
|
sl@0
|
181 |
|
sl@0
|
182 |
TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
|
sl@0
|
183 |
{}
|
sl@0
|
184 |
TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt))
|
sl@0
|
185 |
{}
|
sl@0
|
186 |
TUint iDrawWsGraphicArgumentFlags;
|
sl@0
|
187 |
TUint iScreensMap[1]; //THIS MUST BE THE LAST FIELD!!!
|
sl@0
|
188 |
} iParamFlags;
|
sl@0
|
189 |
TConstructParams()
|
sl@0
|
190 |
{ }
|
sl@0
|
191 |
TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0)
|
sl@0
|
192 |
: iConfig(aConfig),iParamFlags(aNumExtras)
|
sl@0
|
193 |
{ }
|
sl@0
|
194 |
TCleanupItem CleanupItem() { return TCleanupItem(Cleanup,this); }
|
sl@0
|
195 |
static void Cleanup(void* p) { delete(TConstructParams*)p; }
|
sl@0
|
196 |
};
|
sl@0
|
197 |
|
sl@0
|
198 |
#endif //__GRAPHICSURFACE_H__
|
sl@0
|
199 |
|