os/boardsupport/emulator/emulatorbsp/inc/gui.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-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
// wins\inc\gui.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __EX_GUI_H__
sl@0
    19
#define __EX_GUI_H__
sl@0
    20
sl@0
    21
#define _CRTIMP			// we want to use the win32 static runtime library
sl@0
    22
sl@0
    23
#include "platform.h"
sl@0
    24
#include <kernel/win32/property.h>
sl@0
    25
#include "nk_priv.h"
sl@0
    26
#include "vwins.h"
sl@0
    27
#include <e32keys.h>
sl@0
    28
#include <stdlib.h>
sl@0
    29
#include <videodriver.h>
sl@0
    30
#include <dispchannel.h>
sl@0
    31
sl@0
    32
GLREF_C const char* skipws(const char* aPtr);
sl@0
    33
GLREF_C const char* skiptok(const char* aPtr);
sl@0
    34
sl@0
    35
// keyboard mapping
sl@0
    36
sl@0
    37
const TUint KKeyExtendedBit=0x100;
sl@0
    38
const TUint KKeyNormalBits=0xFF;
sl@0
    39
const TInt KMaxExtendedKey=0x5d;
sl@0
    40
const TInt KExtendedKeyBase=0x1c;
sl@0
    41
const TInt KStandardKeyMapSize = 89;
sl@0
    42
const TInt KExtendedKeyMapSize = KMaxExtendedKey + 1 - KExtendedKeyBase;
sl@0
    43
const TUint KMaxHotKeyCombinationLength=10;
sl@0
    44
const TInt KDatFileVersion= 1000;
sl@0
    45
sl@0
    46
enum TEmulCommand
sl@0
    47
	{
sl@0
    48
	ENoCommand,
sl@0
    49
	EKey,
sl@0
    50
	ENextConfig,
sl@0
    51
	ESelectConfig,
sl@0
    52
	};
sl@0
    53
sl@0
    54
class VirtualKey
sl@0
    55
	{
sl@0
    56
public:
sl@0
    57
	VirtualKey(const TInt aCommandData, TEmulCommand aCommand);
sl@0
    58
	virtual TBool Contains(TInt aX, TInt aY) const = 0;
sl@0
    59
	virtual void Draw(HDC aHdc,COLORREF aColor) const =0;
sl@0
    60
	inline TInt Value() const {return iData;};
sl@0
    61
	inline TEmulCommand Command() const {return iCommand;};
sl@0
    62
private:
sl@0
    63
	TEmulCommand iCommand;
sl@0
    64
	TInt iData;
sl@0
    65
	};
sl@0
    66
sl@0
    67
typedef TStdScanCode KeyArray[KMaxHotKeyCombinationLength];
sl@0
    68
class KeyCombination
sl@0
    69
	{
sl@0
    70
public:
sl@0
    71
	KeyCombination(const TInt aCommandData, TEmulCommand aCommand);
sl@0
    72
	TBool AddKey(TStdScanCode);
sl@0
    73
	TBool CheckCombinationPressed();
sl@0
    74
sl@0
    75
	TEmulCommand iCommand;
sl@0
    76
	TInt iData;
sl@0
    77
private:
sl@0
    78
	KeyArray iCombination;
sl@0
    79
	};
sl@0
    80
sl@0
    81
class VKRect : public VirtualKey
sl@0
    82
	{
sl@0
    83
public:
sl@0
    84
	VKRect(const TInt aCommandData, TEmulCommand aCommand, TInt aX, TInt aY, TInt aWidth, TInt aHeight);
sl@0
    85
	// From VirtualKey
sl@0
    86
	TBool Contains(TInt aX, TInt aY) const;
sl@0
    87
	virtual void Draw(HDC aHdc,COLORREF aColor) const;
sl@0
    88
private:
sl@0
    89
	TInt iLeft,iTop,iRight,iBottom;
sl@0
    90
	VKRect();
sl@0
    91
	};
sl@0
    92
sl@0
    93
sl@0
    94
sl@0
    95
class Alias
sl@0
    96
	{
sl@0
    97
public:
sl@0
    98
	Alias();
sl@0
    99
//
sl@0
   100
	TInt Add(const TDesC8& aAlias, const TDesC8& aName);
sl@0
   101
	const TDesC8* operator[](const TDesC8& aAlias);
sl@0
   102
private:
sl@0
   103
	struct SEntry
sl@0
   104
		{
sl@0
   105
		TDesC8* iAlias;
sl@0
   106
		TDesC8* iName;
sl@0
   107
		};
sl@0
   108
	static TBool Compare(const SEntry& aLhs, const SEntry& aRhs);
sl@0
   109
private:
sl@0
   110
	RArray<SEntry> iMap;
sl@0
   111
	};
sl@0
   112
sl@0
   113
// GUI settings
sl@0
   114
sl@0
   115
const TInt KPowerTimerId=1;
sl@0
   116
sl@0
   117
const TInt KRomMajorVersionNumber=1;
sl@0
   118
const TInt KRomMinorVersionNumber=0;
sl@0
   119
const TInt KRomBuildVersionNumber=1;
sl@0
   120
//
sl@0
   121
const TInt KScreenOffsetX=90;
sl@0
   122
const TInt KScreenOffsetY=51;
sl@0
   123
const TInt KScreenWidth=640;
sl@0
   124
const TInt KScreenHeight=240;
sl@0
   125
const TInt KWinPosX=10;
sl@0
   126
const TInt KWinPosY=10;
sl@0
   127
sl@0
   128
const TInt KCompositionBuffers=2;	// Default to double-buffering
sl@0
   129
const TInt KRefreshRateHz=30;	// Default to 30fps
sl@0
   130
sl@0
   131
const TInt KMaxNameSize=80;	//size of window title string
sl@0
   132
sl@0
   133
//
sl@0
   134
// window style
sl@0
   135
const DWORD KInvisibleControlWinStyle=WS_CAPTION|WS_CLIPCHILDREN|WS_MINIMIZEBOX|WS_OVERLAPPED|WS_SYSMENU;
sl@0
   136
const DWORD KControlWinStyle=KInvisibleControlWinStyle|WS_VISIBLE;
sl@0
   137
sl@0
   138
const DWORD KInvisibleWinStyle=WS_CAPTION|WS_CLIPCHILDREN|WS_OVERLAPPED|WS_HSCROLL|WS_VSCROLL|WS_SIZEBOX|
sl@0
   139
	WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_SYSMENU;
sl@0
   140
const DWORD KWinStyle=KInvisibleWinStyle|WS_VISIBLE;
sl@0
   141
//
sl@0
   142
// Scaling factors to use if PhysicalScreenWidth or Height are not specified
sl@0
   143
const TReal KDefaultPixelsToTwipsX=11.90625;
sl@0
   144
const TReal KDefaultPixelsToTwipsY=11.9083333334;
sl@0
   145
//
sl@0
   146
const TInt KHeapSize=0x2000;
sl@0
   147
const TInt KWindowServerHeapSize=0x40000;
sl@0
   148
const TInt KKeyDown=0x80;
sl@0
   149
//
sl@0
   150
const TInt KLedTop=45;
sl@0
   151
const TInt KLedLeft=36;
sl@0
   152
const TInt KLedSize=14;
sl@0
   153
const TInt KLedGap=5;
sl@0
   154
const TBool KLedVertical=ETrue;
sl@0
   155
sl@0
   156
GLREF_C TInt MultiProperty(TInt (*aHandler)(TAny* aObj, const char*), TAny* aPtr, const char* aProperty);
sl@0
   157
sl@0
   158
const TInt KSecureLedColor = 0xFFFF;
sl@0
   159
sl@0
   160
class DWinsKeyboard : public DBase
sl@0
   161
	{
sl@0
   162
public:
sl@0
   163
	DWinsKeyboard();
sl@0
   164
	TInt Init(TInt aId);
sl@0
   165
//
sl@0
   166
	TInt ScanCodeToRemappedKey(TInt aScanCode);
sl@0
   167
	static TInt ScanCodeToStandardKey(TInt aScanCode);
sl@0
   168
//
sl@0
   169
	TInt GetEPOCKeyCode(const TDesC8& aStr);
sl@0
   170
	TInt GetScanCode(const TDesC8& aStr);
sl@0
   171
private:
sl@0
   172
	static TInt ScanCodeToKey(TInt aScanCode, const TUint8* aStandardMap, const TUint8* aExtendedMap);
sl@0
   173
	TInt DefineAlias(const char* aValue);
sl@0
   174
	static TInt DoDefineAlias(TAny* aObj, const char* aValue);
sl@0
   175
	TInt MapKey(const char* aValue);
sl@0
   176
	static TInt DoMapKey(TAny* aObj, const char* aValue);
sl@0
   177
private:
sl@0
   178
	TUint8 iStandardKeyMap[KStandardKeyMapSize];
sl@0
   179
	TUint8 iExtendedKeyMap[KExtendedKeyMapSize];
sl@0
   180
	TUint8 iAltStandardKeyMap[KStandardKeyMapSize];
sl@0
   181
	TUint8 iAltExtendedKeyMap[KExtendedKeyMapSize];
sl@0
   182
	TUint8 iCtrlStandardKeyMap[KStandardKeyMapSize];
sl@0
   183
	TUint8 iCtrlExtendedKeyMap[KExtendedKeyMapSize];
sl@0
   184
	Alias iAliasedKeys;
sl@0
   185
	};
sl@0
   186
sl@0
   187
struct TWindowState
sl@0
   188
	{
sl@0
   189
public:
sl@0
   190
	WINDOWPLACEMENT iWinPlace;
sl@0
   191
	TInt iXoffset;
sl@0
   192
	TInt iYoffset;
sl@0
   193
	TEmulatorFlip iFlipstate;
sl@0
   194
	};
sl@0
   195
sl@0
   196
class DScreenProperties;
sl@0
   197
class TViewport 
sl@0
   198
	{
sl@0
   199
public:
sl@0
   200
	TViewport();
sl@0
   201
	TViewport(DScreenProperties* aScreenProps);
sl@0
   202
	~TViewport();
sl@0
   203
		
sl@0
   204
	void UpdateScrollBarH(HWND aHwnd);
sl@0
   205
	void UpdateScrollBarV(HWND aHwnd);
sl@0
   206
	
sl@0
   207
	TInt GetMaxWindowWidth() const;
sl@0
   208
	TInt GetMaxWindowHeight() const;
sl@0
   209
	TInt GetMaxWidth() const;
sl@0
   210
	TInt GetMaxHeight() const;
sl@0
   211
	
sl@0
   212
	TInt GetViewportOffsetX() const;
sl@0
   213
	TInt GetViewportOffsetY() const;
sl@0
   214
		
sl@0
   215
	void SetViewportWidth(TInt aWidth);
sl@0
   216
	void SetViewportHeight(TInt aHeight);
sl@0
   217
	TInt GetViewportWidth() const;
sl@0
   218
	TInt GetViewportHeight() const;
sl@0
   219
	
sl@0
   220
	void ScrollToY(TInt aPosition,HWND aHwnd);
sl@0
   221
	void ScrollToX(TInt aPosition, HWND aHwnd);
sl@0
   222
	
sl@0
   223
	void UpdateChildPos(HWND aHwnd);
sl@0
   224
		
sl@0
   225
private:
sl@0
   226
	
sl@0
   227
	void SetViewportOffsetX(TInt aOffset);
sl@0
   228
	void SetViewportOffsetY(TInt aOffset);
sl@0
   229
	
sl@0
   230
	/**
sl@0
   231
	The DScreenProperties object which owns this viewport
sl@0
   232
	*/
sl@0
   233
	DScreenProperties* iScreenProps;
sl@0
   234
	
sl@0
   235
	/**
sl@0
   236
	Width in pixels of the client area of the window through which the emulator is being viewed
sl@0
   237
	*/
sl@0
   238
	TInt iViewportWidth;
sl@0
   239
	/**
sl@0
   240
	Height in pixels of the client area of the window through which the emulator is being viewed
sl@0
   241
	*/
sl@0
   242
	TInt iViewportHeight;
sl@0
   243
	/**
sl@0
   244
	X Offset of viewport edge from emulator image ie. How far viewport is translated
sl@0
   245
	*/
sl@0
   246
	TInt iViewportOffsetX;
sl@0
   247
	/**
sl@0
   248
	Y Offset of viewport edge from emulator image ie. How far viewport is translated
sl@0
   249
	*/
sl@0
   250
	TInt iViewportOffsetY;
sl@0
   251
	
sl@0
   252
	};
sl@0
   253
sl@0
   254
class DScreenProperties
sl@0
   255
	{
sl@0
   256
friend class TViewport;
sl@0
   257
public:
sl@0
   258
	DScreenProperties();
sl@0
   259
	~DScreenProperties();
sl@0
   260
	TInt SetupProperties(TInt aConf, TInt aScreen);
sl@0
   261
	TWindowState GetWindowState();
sl@0
   262
public:
sl@0
   263
	TInt iScreenWidth;
sl@0
   264
	TInt iScreenHeight;
sl@0
   265
	TInt iMaxScreenWidth;
sl@0
   266
	TInt iMaxScreenHeight;
sl@0
   267
    TInt iXYInputWidth;
sl@0
   268
    TInt iXYInputHeight;
sl@0
   269
	TInt iPhysicalScreenWidth;
sl@0
   270
	TInt iPhysicalScreenHeight;
sl@0
   271
	TInt iMaxPhysicalScreenWidth;
sl@0
   272
	TInt iMaxPhysicalScreenHeight;
sl@0
   273
	TInt iScreenOffsetX; 
sl@0
   274
	TInt iScreenOffsetY;
sl@0
   275
	TUint iColorDepth; 			///<In emulator this is a bitfield of the available modes. All other aspects of each mode are identical.
sl@0
   276
	TInt iDisplayContrast;
sl@0
   277
	TEmulatorFlip iScreenRotation;
sl@0
   278
	CHAR iFasciaFileName[MAX_PATH];
sl@0
   279
	HWND iWindowHandle;
sl@0
   280
	WINDOWPLACEMENT iWinPlace; ///<Used to store the window's WINDOWPLACEMENT struct.
sl@0
   281
	RECT iWinRect;
sl@0
   282
	TBool iScreenOff;
sl@0
   283
	TInt  iCurrentMode;		   ///<Indicates the current mode when multiple modes are supported
sl@0
   284
	TInt  iMaxModes;
sl@0
   285
	TInt  iModeDepths[KEmulMaxNumModes];
sl@0
   286
	TInt iCompositionBuffers;
sl@0
   287
	TInt iRefreshRateHz;
sl@0
   288
	/**
sl@0
   289
	The viewport owned by the screen
sl@0
   290
	*/
sl@0
   291
	TViewport iViewport;
sl@0
   292
sl@0
   293
	};
sl@0
   294
	
sl@0
   295
sl@0
   296
class DDisplayChannel;
sl@0
   297
sl@0
   298
class DWinsUi : public DWinsUiBase
sl@0
   299
	{
sl@0
   300
public:
sl@0
   301
	DWinsUi();
sl@0
   302
	TInt Create(TInt aId);
sl@0
   303
//
sl@0
   304
	TInt GetVirtualKey(TEmulCommand& aCommand, TInt aX, TInt aY);
sl@0
   305
	void SetVirtualKey(const TBool aProcessing, const TInt aCommandData, const TEmulCommand aCommand);
sl@0
   306
	TBool WasVirtualKey(TInt& aCommandData, TEmulCommand& aCommand);
sl@0
   307
	void TranslateMouseCoords(const TEmulatorFlip aFlipState, const TInt aX, const TInt aY, const TInt aRegionWidth, const TInt aRegionHeight, TInt& aNewX, TInt& aNewY);
sl@0
   308
sl@0
   309
	//
sl@0
   310
	TBool OnScreen(TInt aScreen, TInt aX, TInt aY) const;
sl@0
   311
	TBool OnDigitizer(TInt aX, TInt aY) const;
sl@0
   312
	TBool MultiTouchEnabled() const;
sl@0
   313
	TBool GCEEnabled() const;
sl@0
   314
	TInt MultiTouchPressureStep() const;
sl@0
   315
	TInt MultiTouchProximityStep() const;
sl@0
   316
//private:
sl@0
   317
	void ScreenInfo(TScreenInfoV01& aInfo);
sl@0
   318
	TBool VideoInfo(TInt aDeviceNumber, TVideoInfoV01& aInfo);
sl@0
   319
	TBool VideoInfo(TInt aDeviceNumber,TInt aModeNumber, TVideoInfoV01& aInfo);
sl@0
   320
	TBool VideoInfoForDisplayDriver(TInt aDeviceNumber,TInt aModeNumber, TVideoInfoV01& aInfo, TBool aRealWidthAndHeight = EFalse);
sl@0
   321
//
sl@0
   322
	TInt SetupProperties(TInt aId);
sl@0
   323
	TInt DefineVirtualKey(const char* aValue);
sl@0
   324
	static TInt DoDefineVirtualKey(TAny* aObj, const char* aValue);
sl@0
   325
	TInt DefineEmulatorControl(const char* aValue);
sl@0
   326
	static TInt DoDefineEmulatorControl(TAny* aObj, const char* aValue);
sl@0
   327
sl@0
   328
	static TInt DoDefineEmulatorControlHotKey(TAny* aPtr, const char* aValue);
sl@0
   329
	TInt DefineEmulatorControlHotKey(const char* aValue);
sl@0
   330
//	implementing DWinsUiBase
sl@0
   331
	TUint ColorDepth(TInt aScreenNumber);
sl@0
   332
	TInt SetFlip(TEmulatorFlip aFlip, TInt aScreenNumber);
sl@0
   333
	void Info(TVariantInfoV01& aInfo);
sl@0
   334
	HWND HWnd();
sl@0
   335
	void SwitchDisplay(TBool aSecure);
sl@0
   336
	TInt NumberOfScreens();
sl@0
   337
	virtual TInt SetDisplayChannel(TInt aScreenNumber, DDisplayChannel* aDisplay);
sl@0
   338
	TInt SetDisplayChannelImpl(TInt aScreenNumber, DDisplayChannel* aDisplay);
sl@0
   339
public:
sl@0
   340
	DWinsKeyboard iKeyboard;
sl@0
   341
//
sl@0
   342
	TInt iLedSize;
sl@0
   343
	TInt iLedGap;
sl@0
   344
	TInt iLedOffsetX;
sl@0
   345
	TInt iLedOffsetY;
sl@0
   346
	TBool iLedVertical;
sl@0
   347
	TBuf8<0x10> iPointerType;
sl@0
   348
	TXYInputType iXYInputType;
sl@0
   349
	CHAR iSysIniFileName[MAX_PATH];
sl@0
   350
	WINDOWPLACEMENT iWinPlace;
sl@0
   351
    RPointerArray<VirtualKey> iVirtualKeys;
sl@0
   352
	RPointerArray<KeyCombination> iControlHotKeys;
sl@0
   353
	TInt iDigitizerWidth;
sl@0
   354
	TInt iDigitizerHeight;
sl@0
   355
	TInt iDigitizerOffsetX;	//offset from the epoc screen 0!
sl@0
   356
	TInt iDigitizerOffsetY;//offset from the epoc screen 0!
sl@0
   357
	TBool iDigitizerEnabled;
sl@0
   358
	CHAR iWindowTitle[KMaxNameSize+1];
sl@0
   359
	TBool iDisplayVersionInfo;
sl@0
   360
	TInt aId;			//configuration number;
sl@0
   361
	TInt iInitialFlipMsg;
sl@0
   362
	TBool iProcessingVirtualKey;
sl@0
   363
	TUint iFakedVirtualKey;
sl@0
   364
	TEmulCommand iVirtualKeyCommand;
sl@0
   365
	RPointerArray<DScreenProperties> iScreens;
sl@0
   366
private:
sl@0
   367
	TBool iMultiTouchEnabled;
sl@0
   368
	TBool iGCEEnabled;
sl@0
   369
	TInt iMultiTouchProximityStep;
sl@0
   370
	TInt iMultiTouchPressureStep;
sl@0
   371
	};
sl@0
   372
sl@0
   373
struct TBufferAddressA
sl@0
   374
	{
sl@0
   375
	DChunk* iChunk;
sl@0
   376
	TAny* iAddress;
sl@0
   377
	};
sl@0
   378
	
sl@0
   379
class TScreenBuffer
sl@0
   380
	{
sl@0
   381
public:	
sl@0
   382
	RPointerArray<TAny> iFrameBuffers;
sl@0
   383
	RPointerArray<TBufferAddressA> iMemChunks;
sl@0
   384
	TInt 	iDisplayBufferOffset;    //offset to pixel data in current mode for display buffer. Mode of display buffer doesn't change we presume!
sl@0
   385
	};
sl@0
   386
sl@0
   387
sl@0
   388
// Chunk cleanup object - used to clean up the process/addr table when the process goes away.
sl@0
   389
class TChunkCleanup : public TDfc
sl@0
   390
    {
sl@0
   391
public:
sl@0
   392
    TChunkCleanup(DProcess* aProcess, TInt aScreenNumber);
sl@0
   393
    void Cancel();
sl@0
   394
    inline void SetIndex(TUint aIndex) { iIndex = aIndex; }
sl@0
   395
private:
sl@0
   396
    static void ChunkDestroyed(TChunkCleanup* aSelf);
sl@0
   397
private:
sl@0
   398
    DProcess* iProcess;
sl@0
   399
    TInt      iScreenNumber;
sl@0
   400
    TInt	  iIndex;
sl@0
   401
    };
sl@0
   402
sl@0
   403
sl@0
   404
// Entry to hold the process/disp.memory address, as we need to find the address of the display
sl@0
   405
// memory when requested. A new entry would be added when a process first requests the address of display
sl@0
   406
// memory. When the process dies, we remove the process entry (by way of a DFC for a chunk that is 
sl@0
   407
// created on behalf of that process).
sl@0
   408
class TProcessAddrEntry 
sl@0
   409
    {
sl@0
   410
public:
sl@0
   411
	TProcessAddrEntry(DProcess *aProcess, TUint8* aAddress);
sl@0
   412
public:
sl@0
   413
	DProcess* iProcess;
sl@0
   414
	TUint8* iAddress;
sl@0
   415
	};
sl@0
   416
sl@0
   417
sl@0
   418
sl@0
   419
class TBufferSet
sl@0
   420
	{
sl@0
   421
public:
sl@0
   422
	TAny* iDisplayBuffer;		//current display buffer
sl@0
   423
	BITMAPV4HEADER iInfo;		// This can be cast to a BITMAPINFOHEADER
sl@0
   424
	TInt           iDisplayDriverCount;
sl@0
   425
	TScreenBuffer  iScreenBuffer;
sl@0
   426
	TScreenBuffer  iDsaBuffer;
sl@0
   427
	RArray<TProcessAddrEntry> iProcAddrTable;
sl@0
   428
	TInt iDisplayState;
sl@0
   429
	TInt iStateChangeCount;
sl@0
   430
	RDisplayChannel::TBufferFormat iBufferFormat;
sl@0
   431
	DDisplayChannel* iDisplayChannel;
sl@0
   432
	};
sl@0
   433
sl@0
   434
class DMasterIni : public DBase
sl@0
   435
	{
sl@0
   436
public:
sl@0
   437
	TInt SetupProperties();
sl@0
   438
	TInt Create();
sl@0
   439
	static TInt DoHalFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2);
sl@0
   440
	TInt HalFunction(TInt aDeviceNumber, TInt aFunction, TAny* a1, TAny* a2);
sl@0
   441
	static TInt DoXYHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2);
sl@0
   442
	TInt XYHalFunction(TInt aFunction, TAny* a1, TAny* a2);
sl@0
   443
	static TInt DoMouseHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2);
sl@0
   444
	TInt MouseHalFunction(TInt aFunction, TAny* a1, TAny* a2);
sl@0
   445
	static TInt DoKbdHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2);
sl@0
   446
sl@0
   447
	void InitBitmapHeader(DScreenProperties& aScreenProperties, LPBITMAPV4HEADER aInfo);
sl@0
   448
	void InitBufferFormat(DScreenProperties& aScreenProperties, RDisplayChannel::TBufferFormat& aBufferFormat);
sl@0
   449
	TInt AllocateFrameBuffers(TInt aScreenNumber, TInt aCount, TInt aSize);
sl@0
   450
	void ReleaseFrameBuffers(TInt aScreenNumber);
sl@0
   451
sl@0
   452
	
sl@0
   453
	TInt DisplayMemoryAddress(TInt aScreenNumber, TInt& aAddress);
sl@0
   454
	TInt DisplayMemoryHandle(TInt aScreenNumber, TInt& aHandle);
sl@0
   455
	
sl@0
   456
	void ProcessDeletedDFC();
sl@0
   457
sl@0
   458
	void SetDisplaySize(TInt aDisplayNumber, TInt aWidth, TInt aHeight);
sl@0
   459
	void SetBufferFormat(TInt aDisplayNumber, TUint aAgregatSize, RDisplayChannel::TPixelFormat aPixelFormat);
sl@0
   460
	void SetImageSize(TInt aScreenNumber);
sl@0
   461
sl@0
   462
public:
sl@0
   463
	//not set or used: TInt iConfigurationCount;
sl@0
   464
	RPointerArray<DWinsUi> iSystemInis;	//Indexed by config
sl@0
   465
	RArray<TBufferSet>     iBufferSet;
sl@0
   466
	// Fast mutex used to control access to the process/address table in the 
sl@0
   467
	// TBufferSet. 
sl@0
   468
	NFastMutex iLock;
sl@0
   469
	TUint iMaxSizeInBytes;
sl@0
   470
	static const RDisplayChannel::TPixelFormat iSupportedPixelFormatTable[];
sl@0
   471
	static const TInt iSupportedPixelFormatTableSize;
sl@0
   472
private:
sl@0
   473
	TInt NumberOfResolutions(TInt aDeviceNumber, TAny* a1, TAny* a2);
sl@0
   474
	TInt SpecificScreenInfo(TInt aDeviceNumber, TAny* a1, TAny* a2);
sl@0
   475
	TInt CurrentScreenInfo(TInt aDeviceNumber, TAny* a1, TAny* a2);
sl@0
   476
};
sl@0
   477
sl@0
   478
sl@0
   479
GLREF_C TInt CompareI(const TDesC8& aLhs, const TDesC8& aRhs);
sl@0
   480
sl@0
   481
// user-defined messages ...
sl@0
   482
// flip the emulator window
sl@0
   483
#define WM_FLIP_MESSAGE 0x7FFF
sl@0
   484
// emulator window power state
sl@0
   485
#define WM_EMUL_POWER_ON 0x7FFE
sl@0
   486
sl@0
   487
//redraw client window from the internal buffer
sl@0
   488
#define WM_REDRAW_WINDOW 	(WM_USER + 1)
sl@0
   489
sl@0
   490
// Set the display frame buffer for this window to lParam
sl@0
   491
#define WMU_SET_DISPLAY_BUFFER	(WM_USER + 2)
sl@0
   492
sl@0
   493
// Set the display size for this window to (wParam,lParam)
sl@0
   494
// Rotation (flip) is ignored. Current display state is used.
sl@0
   495
// Configurations are searched to find a match, message is ignored if none found.
sl@0
   496
#define WMU_SET_DISPLAY_SIZE	(WM_USER + 3)
sl@0
   497
sl@0
   498
//modifies the header of the bitmap that is getting painted, updating the size
sl@0
   499
#define WMU_SET_BUFFER_FORMAT	(WM_USER + 4)
sl@0
   500
sl@0
   501
enum TGuiPanic
sl@0
   502
	{
sl@0
   503
	EGuiGetModuleHandle=21,
sl@0
   504
	EGuiRegisterWindow=22,
sl@0
   505
	EGuiKernelWindowCreate=23,
sl@0
   506
	EGuiRegisterChildWindow=24,
sl@0
   507
	EGuiKernelChildWindowCreate=25,
sl@0
   508
	EGuiCreateBitmap=26,
sl@0
   509
	EGuiChildWinProc=27,
sl@0
   510
	EGuiEnterCS=28,
sl@0
   511
	EGuiLeaveCS=29,
sl@0
   512
	EGuiStandbyWhilstOff=30,
sl@0
   513
	EGuiResetPowerEvent=31,
sl@0
   514
	EGuiSetPowerEvent=32,
sl@0
   515
	EGuiWaitPowerOnFailed=33,
sl@0
   516
	EGuiNoDisplayChannel=34,
sl@0
   517
	EGuiVideoInfoUnavailable=35,
sl@0
   518
	EGuiInvalidMultiTouch=36
sl@0
   519
	};
sl@0
   520
sl@0
   521
GLREF_C void Fault(TGuiPanic aPanic);
sl@0
   522
sl@0
   523
#endif