os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/inc/graphicsurface.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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
#ifndef __GRAPHICSURFACE_H__
sl@0
    21
#define __GRAPHICSURFACE_H__
sl@0
    22
sl@0
    23
#include <w32std.h>
sl@0
    24
#include <w32stdgraphic.h>
sl@0
    25
#include <graphics/surface.h>
sl@0
    26
#include <graphics/surfaceconfiguration.h>
sl@0
    27
sl@0
    28
enum TDrawWsGraphicArgumentFlags
sl@0
    29
	{
sl@0
    30
	EDrawWsAllScreens							=0x00000001,
sl@0
    31
	EDrawWsTSurfaceIdIgnored 					=0x00000002,	//<Indicates that the client should NOT supply
sl@0
    32
	EDrawWsNotifyProviderTSurfaceIdChanged		=0x00000100,
sl@0
    33
	EDrawWsNotifyProviderConfigChanged			=0x00000200,
sl@0
    34
	EDrawWsNotifyProviderPlayControlsChanged	=0x00000400,
sl@0
    35
	EDrawWsNotifyProviderSurfaceUnreferenced	=0x00000800,
sl@0
    36
	EDrawWsNotifyProviderConfigRereferenced		=0x00001000,	//<Triggers a one-shot config notification when drawn after an unreference
sl@0
    37
	EDrawWsNotifyProviderConfigNextReref		=0x00002000,	//<Automatic one-shot set after unreferenced if 
sl@0
    38
	EDrawWsNotifyError							=0x00010000,
sl@0
    39
	EDrawWsNotifyProviderAll					=0x000FFF00,
sl@0
    40
	EDrawWsUpdateTSurfaceId						=0x00100000,
sl@0
    41
	EDrawWsUpdateConfiguration					=0x00200000,
sl@0
    42
	EDrawWsUpdatePlayerControls					=0x00400000,
sl@0
    43
	EDrawWsUpdateAll							=0x0FF00000,
sl@0
    44
	};
sl@0
    45
sl@0
    46
//KUidGraphicMsgSurface=  0x10285C57 	  To    0x10285C5B
sl@0
    47
class TWsSurfaceConfiguration: public TWsGraphicMsgFixedBase
sl@0
    48
/** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand surface configuration commands.
sl@0
    49
Also use to notify owner client of config change.
sl@0
    50
sl@0
    51
@publishedAll
sl@0
    52
@released
sl@0
    53
*/	{
sl@0
    54
public:
sl@0
    55
	enum
sl@0
    56
		{
sl@0
    57
		ETypeId = 0x10285C57
sl@0
    58
		};
sl@0
    59
		TWsSurfaceConfiguration()
sl@0
    60
		:	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
sl@0
    61
		{	}
sl@0
    62
		TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig)
sl@0
    63
		:	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)),
sl@0
    64
			iConfig(aConfig)
sl@0
    65
			
sl@0
    66
		{	}
sl@0
    67
	TSurfaceConfiguration iConfig;
sl@0
    68
	};
sl@0
    69
sl@0
    70
class TWsDebugResultCode: public TWsGraphicMsgFixedBase
sl@0
    71
/** Data attached to a message to the artwork provider notifying it of a command result code
sl@0
    72
This code is always followed by the command that caused it (TSurfaceConfig)
sl@0
    73
*/
sl@0
    74
	{
sl@0
    75
public:
sl@0
    76
	enum
sl@0
    77
		{
sl@0
    78
		ETypeId = 0x10285C5A
sl@0
    79
		};
sl@0
    80
	TWsDebugResultCode():	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
sl@0
    81
		{	}
sl@0
    82
	TInt iResult;
sl@0
    83
	TInt iExtra;
sl@0
    84
	TInt iLineNum;
sl@0
    85
	};
sl@0
    86
sl@0
    87
sl@0
    88
class TWsSurfaceUnreferenced: public TWsGraphicMsgFixedBase
sl@0
    89
/** data attached to a message to the artwork provider to allow it to react if a surface is no longer drawn
sl@0
    90
play-stop-pause commands.
sl@0
    91
sl@0
    92
@publishedAll
sl@0
    93
@released
sl@0
    94
*/	{
sl@0
    95
public:
sl@0
    96
	enum
sl@0
    97
		{
sl@0
    98
		ETypeId = 0x10285C58
sl@0
    99
		};
sl@0
   100
	TWsSurfaceUnreferenced():	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
sl@0
   101
		{	}
sl@0
   102
	TSurfaceId iId;
sl@0
   103
	};
sl@0
   104
class CWsGraphicDrawerSurface;
sl@0
   105
class TWsDebugResultCode;
sl@0
   106
class CWsGraphicSurface: public CWsGraphic
sl@0
   107
/** Client representation of a window-server-side CFbsBitmap owned by this Client
sl@0
   108
sl@0
   109
@publishedAll
sl@0
   110
@released
sl@0
   111
*/
sl@0
   112
	{
sl@0
   113
	friend class CWsGraphicDrawerSurface;
sl@0
   114
public:
sl@0
   115
	IMPORT_C static CWsGraphicSurface* NewL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   116
	IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   117
	IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   118
	IMPORT_C  void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   119
	IMPORT_C  void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   120
	IMPORT_C  void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   121
	IMPORT_C ~CWsGraphicSurface();
sl@0
   122
protected: 
sl@0
   123
	IMPORT_C TInt ShareGlobally();
sl@0
   124
	IMPORT_C TInt UnShareGlobally();
sl@0
   125
	IMPORT_C TInt Share(TSecureId aClientId);
sl@0
   126
	IMPORT_C TInt UnShare(TSecureId aClientId);
sl@0
   127
	IMPORT_C TInt SendMessage(const TSurfaceConfiguration&);
sl@0
   128
	IMPORT_C TInt SendMessage(const TWsGraphicAnimation&);
sl@0
   129
sl@0
   130
	virtual void HandleMessage(const TSurfaceConfiguration&)		{}
sl@0
   131
	virtual void HandleMessage(const TWsGraphicAnimation&)			{}
sl@0
   132
	virtual void HandleMessage(const TWsSurfaceUnreferenced&)		{}
sl@0
   133
	virtual void HandleMessage(const TWsDebugResultCode&)		{}
sl@0
   134
	virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&)	{}
sl@0
   135
	IMPORT_C virtual TInt CWsGraphicSurface_Reserved1();
sl@0
   136
	IMPORT_C virtual TInt CWsGraphicSurface_Reserved2();
sl@0
   137
	IMPORT_C virtual TInt CWsGraphicSurface_Reserved3();
sl@0
   138
protected:
sl@0
   139
	class TConstructParams;
sl@0
   140
	IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>*  aScreensMap=NULL);
sl@0
   141
	IMPORT_C CWsGraphicSurface();		//Derivers should implement NewL to call ConstructL
sl@0
   142
	IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray<TUint>*  aScreensMap=NULL);
sl@0
   143
	IMPORT_C void UnRegisterScreens();
sl@0
   144
private:
sl@0
   145
	void HandleMessage(const TDesC8& aData);
sl@0
   146
	void OnReplace();
sl@0
   147
sl@0
   148
private: //data
sl@0
   149
	TSurfaceId		iRegisteredId;
sl@0
   150
	RArray<TUint>	iRegisteredScreens;
sl@0
   151
	};
sl@0
   152
sl@0
   153
/** Used as the parameter payload to construct the drawer
sl@0
   154
*/
sl@0
   155
class CWsGraphicSurface::TConstructParams
sl@0
   156
	{
sl@0
   157
public:
sl@0
   158
	TInt Size()
sl@0
   159
		{	return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase);	}
sl@0
   160
	void* operator new(TUint size,TInt aNumExtras)
sl@0
   161
		{
sl@0
   162
		return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0));
sl@0
   163
		}
sl@0
   164
	void operator delete(void* aObj,TInt /*aNumExtras*/)
sl@0
   165
		{
sl@0
   166
		::operator delete(aObj);
sl@0
   167
		}
sl@0
   168
	void operator delete(void* aObj)
sl@0
   169
		{
sl@0
   170
		::operator delete(aObj);
sl@0
   171
		}
sl@0
   172
	TWsSurfaceConfiguration iConfig;
sl@0
   173
	class TParamFlags:public TWsGraphicMsgFixedBase
sl@0
   174
		{
sl@0
   175
		public:
sl@0
   176
		enum
sl@0
   177
			{
sl@0
   178
			ETypeId = 0x10285C59
sl@0
   179
			};
sl@0
   180
sl@0
   181
		TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
sl@0
   182
			{}
sl@0
   183
		TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt))
sl@0
   184
			{}
sl@0
   185
		TUint iDrawWsGraphicArgumentFlags;
sl@0
   186
		TUint iScreensMap[1];	//THIS MUST BE THE LAST FIELD!!!
sl@0
   187
		} iParamFlags;
sl@0
   188
	TConstructParams()	
sl@0
   189
	{	}
sl@0
   190
	TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0)
sl@0
   191
	:	iConfig(aConfig),iParamFlags(aNumExtras)
sl@0
   192
	{	}
sl@0
   193
	TCleanupItem	CleanupItem()	{ return TCleanupItem(Cleanup,this);	}
sl@0
   194
	static void Cleanup(void* p)	{	delete(TConstructParams*)p;	}	
sl@0
   195
	};
sl@0
   196
sl@0
   197
#endif //__GRAPHICSURFACE_H__
sl@0
   198