epoc32/include/w32std.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1994-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Standard window server header file
    15 // 
    16 //
    17 
    18 #ifndef __W32STD_H__
    19 #define __W32STD_H__
    20 
    21 #ifndef __FNTSTORE_H__
    22 #include <fntstore.h>
    23 #endif
    24 #ifndef __BITDEV_H__
    25 #include <bitdev.h>
    26 #endif
    27 #ifndef __BITSTD_H__
    28 #include <bitstd.h>
    29 #endif
    30 
    31 _LIT(KWSERVThreadName,"Wserv");
    32 
    33 /**
    34 @internalAll
    35 */
    36 _LIT(KWSERVServerName,"!Windowserver");
    37 
    38 class RWindowBase;
    39 class RWindow;
    40 class RWsBuffer;
    41 class MWsObjectProvider;
    42 
    43 /** Used for testing purpose.
    44 
    45 @internalComponent
    46 @released
    47 */
    48 class TSizeMode
    49 	{
    50 public:
    51 	inline TSizeMode(){}
    52 	inline TSizeMode(TSize& aSize);
    53 	static inline TInt ScaledCord(TInt aOrigin,TInt aScale);
    54 	inline TPoint ScaledOrigin();
    55 public:
    56 	CFbsBitGc::TGraphicsOrientation iRotation;
    57 	TPoint iOrigin;
    58 	TSize iScreenSize;
    59 	TSize iScreenTwipsSize;
    60 	TUint iAlternativeRotations;
    61 	TRect iPointerCursorArea;
    62 	TSize iScreenScale;
    63 	TDisplayMode iDefaultDisplayMode;
    64 	};
    65 
    66 /** Screen mode enforcement flags.
    67 
    68 Screen mode enforcement ensures that windows must meet certain requirements
    69 if they are to be displayed. When the screen mode changes, window groups that
    70 are incorrectly set up, according to these requirements, are locked out. The
    71 windows are notified of the change, and will be displayed if they are updated
    72 (according to the current enforcement requirement) to match the new screen
    73 mode.
    74 
    75 @publishedAll
    76 @released
    77 @see CWsScreenDevice::ScreenModeEnforcement()
    78 @see CWsScreenDevice::SetScreenModeEnforcement() */
    79 enum TScreenModeEnforcement
    80 	{
    81 	/** No enforcement.
    82 
    83 	All windows that are the children of window groups will be displayed, irrespective
    84 	of the screen mode.
    85 
    86 	This is not properly supported and is provided for testing purposes. */
    87 	ESizeEnforcementNone,
    88 	/** Pixels and rotation enforcement.
    89 
    90 	Group windows must be set up for the correct rotation and be working in the
    91 	correct size in pixels to be displayed. */
    92 	ESizeEnforcementPixelsAndRotation,
    93 	/** Pixels and Twips enforcement.
    94 
    95 	Group windows must have the correct rotation and be working in the correct
    96 	size in pixels and twips to be displayed.
    97 
    98 	This setting might be used if the display pixels are not square, and would
    99 	distort fonts when rotated. */
   100 	ESizeEnforcementPixelsTwipsAndRotation,
   101 	};
   102 
   103 struct TPixelsAndRotation
   104 /** Pixels and rotation struct.
   105 
   106 This is used to define a particular screen mode's screen size in pixels,
   107 and its rotation.
   108 
   109 @publishedAll
   110 @released
   111 @see CWsScreenDevice::GetScreenModeSizeAndRotation() */
   112 	{
   113 	/** The screen size, for a given screen mode, in pixels. */
   114 	TSize iPixelSize;
   115 	/** The current screen orientation. */
   116 	CFbsBitGc::TGraphicsOrientation iRotation;
   117 	};
   118 
   119 struct TPixelsTwipsAndRotation
   120 /** Pixels, twips and rotation struct.
   121 
   122 This is used to define a particular screen mode's screen size in twips
   123 and pixels, and its rotation.
   124 
   125 @publishedAll
   126 @released
   127 @see CWsScreenDevice::GetScreenModeSizeAndRotation() */
   128 	{
   129 	/** The screen size, for a given screen mode, in pixels. */
   130 	TSize iPixelSize;
   131 	/** The screen size, for a given screen mode, in twips. */
   132 	TSize iTwipsSize;
   133 	/** The screen rotation. */
   134 	CFbsBitGc::TGraphicsOrientation iRotation;
   135 	};
   136 
   137 /** Log message text length.
   138 
   139 This defines the length of the log text message buffer TLogMessageText,
   140 which is used in RWsSession::LogMessage().
   141 
   142 @publishedAll
   143 @released */
   144 enum {
   145 	/** The length of the log message text buffer in characters. */
   146 	KLogMessageLength=0x80
   147 	};
   148 
   149 /** Log message text buffer.
   150 
   151 This is used in RWsSession::LogMessage().
   152 
   153 @publishedAll
   154 @released */
   155 typedef TBuf<KLogMessageLength> TLogMessageText;
   156 
   157 /** Password window group priority.
   158 
   159 This priority is assigned to the password window group when the window server is displaying the password window.
   160 This is the highest priority, which ensures that the machine password window is in front of all other windows -
   161 hence password tests cannot be bypassed.
   162 
   163 @publishedAll
   164 @deprecated */
   165 enum
   166 	{
   167 	 /** Password window group priority. */
   168 	KPasswordWindowGroupPriority=1000
   169 	};
   170 
   171 /** Switch ordinal position to owning window.
   172 
   173 This enum can be specified as the 2nd parameter to RWsSession::SetWindowGroupOrdinalPosition()
   174 or as the 1st parameter to RWindowTreeNode::SetOrdinalPosition() (if this is being called on an
   175 RWindowGroup).
   176 
   177 When called with this value, the functions don't change the ordinal position of the group window
   178 in question, but rather bring to the front the window that would come to the front if that group
   179 window were to die with keyboard focus.
   180 
   181 @publishedAll
   182 @released
   183 @see RWsSession::SetWindowGroupOrdinalPosition()
   184 @see RWindowTreeNode::SetOrdinalPosition() */
   185 enum {
   186 	/** Switch ordinal position to owning window. */
   187 	KOrdinalPositionSwitchToOwningWindow=0x80000000
   188 	};
   189 
   190 /** Window corner types.
   191 
   192 Corners may be specified square or stepped, with varying numbers of pixels
   193 removed to make the stepping. Picturing a corner as the top left corner of
   194 a window, the numbers denote the number of pixels removed from the top row
   195 to give corners.
   196 
   197 @publishedAll
   198 @released
   199 @see TCornerFlags
   200 @see RWindowBase::SetCornerType() */
   201 enum TCornerType
   202 // Bottom 16 bits available for corner type
   203 	{
   204 	/** Square corner. */
   205 	EWindowCornerSquare,
   206 	/** Corner pixel removed. */
   207 	EWindowCorner1,
   208 	/** Two pixel step.
   209 
   210 	3 pixels are removed: the corner pixel and a single pixel from each side. */
   211 	EWindowCorner2,
   212 	/** Three pixel step.
   213 
   214 	5 pixels are removed: the corner pixel, the two pixels next to it and the
   215 	2 pixels above or below it. */
   216 	EWindowCorner3,
   217 	/** Five pixel step.
   218 
   219 	12 pixels are removed: the corner pixel, the four pixels next to it, the
   220 	four pixels above or below it, the pixel which was diagonal to the corner
   221 	pixel, and the pixels to both sides of that pixel. */
   222 	EWindowCorner5,
   223 	EWindowCornerRegion,		// Private
   224 	/** Corner type mask.
   225 
   226 	This value is used by the window server, and may be used by developers, to
   227 	separate TCornerType and TCornerFlags values from a TInt which contains both
   228 	types. */
   229 	ECornerTypeMask=0xFFFF
   230 	};
   231 
   232 /** Corner flags.
   233 
   234 These are used by RWindowBase::SetCornerType() to set which corners of a window
   235 are not to have corner types applied to them.
   236 
   237 @publishedAll
   238 @released
   239 @see TCornerType */
   240 enum TCornerFlags
   241 // Top 16 bits available for corner flags
   242 	{
   243 	/** Do not apply corner shape to top left corner. */
   244 	EWindowCornerNotTL=0x10000,
   245 	/** Do not apply corner shape to top right corner. */
   246 	EWindowCornerNotTR=0x20000,
   247 	/** Do not apply corner shape to bottom left corner. */
   248 	EWindowCornerNotBL=0x40000,
   249 	/** Do not apply corner shape to bottom right corner. */
   250 	EWindowCornerNotBR=0x80000,
   251 	};
   252 
   253 /** Window backup type flags.
   254 
   255 @publishedAll
   256 @released
   257 @see RWindowBase::EnableBackup() */
   258 enum TWindowBackupType
   259 	{
   260 	/** Backup the area behind the current window only.
   261 
   262 	This is the default behaviour for the RWindowBase::EnableBackup() function. */
   263 	EWindowBackupAreaBehind=0x0001,
   264 	/** Backup the entire screen.
   265 
   266 	This is provided for windows that require the rest
   267 	of the screen to fade when they are displayed. When the rest of the screen
   268 	should become unfaded, the window server redraws the whole screen from the
   269 	backed up bitmap. */
   270 	EWindowBackupFullScreen=0x0002,
   271 	};
   272 
   273 /** Types of standard events.
   274 
   275 These are events that the window server passes to its clients, as opposed
   276 to events that the base passes to the window server.
   277 
   278 @publishedAll
   279 @released
   280 @see CClickMaker */
   281 enum TEventCode
   282 	{
   283 	/** Null event.
   284 
   285 	This can be sent, but should be ignored by clients. */
   286 	EEventNull,
   287 	/** Key event.
   288 
   289 	This is the event that is sent when a character has been received from the
   290 	keyboard.
   291 
   292 	If an EEventKey event is associated with an EEventKeyDown or EEventKeyUp
   293 	event (typically EEventKeyDown), the EEventKey event occurs after the
   294 	EEventKeyDown/EEventKeyUp event.
   295 
   296 	In practice, the only keys potentially likely to have their EEventKey event
   297 	generated on the up rather than the down are modifier keys. */
   298 	EEventKey,
   299 	/** Key up event.
   300 
   301 	If an EEventKey event is associated with an EEventKeyUp event (which is
   302 	rarely the case), the EEventKey event occurs after the EEventKeyUp event. */
   303 	EEventKeyUp,
   304 	/** Key down event.
   305 
   306 	If an EEventKey event is associated with an EEventKeyDown event (which
   307 	is typically the case), the EEventKey event occurs after the EEventKeyDown event. */
   308 	EEventKeyDown,
   309 	/** Modifier changed event.
   310 
   311 	This is an event generated by the window server when
   312 	the state of one of the modifier keys changes.
   313 	It is not reported unless explicitly requested by a window.
   314 
   315 	@see RWindowTreeNode::EnableModifierChangedEvents(). */
   316 	EEventModifiersChanged,
   317 	/** Pointer event.
   318 
   319 	This event is sent when the user presses or releases a pointer button (or
   320 	the equivalent action, depending on the type of pointing device), drags the
   321 	pointer, or uses the pointer to switch on the device. If the current input
   322 	type (see TXYInputType) is "mouse" or "relative mouse", i.e. it generates
   323 	pointer move events as well as drag events, then this event type is also
   324 	generated whenever the pointer is moved. */
   325 	EEventPointer,			//5
   326 	/** Pointer enter event.
   327 
   328 	This occurs when the user moves the pointer into a window with a pointer button
   329 	pressed (or equivalent action depending on the type of pointing device). If
   330 	move events are being generated, this event also occurs when the user moves
   331 	the pointer into the window. */
   332 	EEventPointerEnter,
   333 	/** Pointer exit event.
   334 
   335 	Occurs when the user moves the pointer out of a window with a pointer button
   336 	pressed (or equivalent action depending on the type of pointing device). If
   337 	move events are being generated, this event also occurs when the user moves
   338 	the pointer out of the window. */
   339 	EEventPointerExit,
   340 	/** Pointer move buffer ready event.
   341 
   342 	Occurs when the pointer move buffer is ready to be retrieved by the client. */
   343 	EEventPointerBufferReady,
   344 	/** Occurs as a duplicate of each pointer event if a window sets pointer capture
   345 	with the TCaptureFlagDragDrop flag set. */
   346 	EEventDragDrop,
   347 	/** Focus lost event.
   348 
   349 	Occurs when a window group loses keyboard focus. */
   350 	EEventFocusLost,		//10
   351 	/** Focus gained event.
   352 
   353 	Occurs when a window group gains keyboard focus. */
   354 	EEventFocusGained,
   355 	/** On event.
   356 
   357 	This event type is not reported unless explicitly requested by a window.
   358 
   359 	@see RWindowTreeNode::EnableOnEvents(). */
   360 	EEventSwitchOn,
   361 	/** Password event.
   362 
   363 	Occurs when the window server enters password mode. It is sent to the group
   364 	window of the currently active password window.
   365 
   366 	This is the window server mode where the user is required to enter a password
   367 	before any further actions can be performed.
   368 
   369 	@deprecated	*/
   370 	EEventPassword,
   371 	/** Window group changed event. This occurs whenever a window group is destroyed,
   372 	and whenever a window group's name changes
   373 
   374 	This event type is not reported unless explicitly requested by a window.
   375 
   376 	@see RWindowTreeNode::EnableGroupChangeEvents(). */
   377 	EEventWindowGroupsChanged,
   378 	/** Error event.
   379 
   380 	Occurs when an error occurs. See TWsErrorMessage::TErrorCategory for the types
   381 	of errors.
   382 
   383 	This event type is not reported unless explicitly requested by a window.
   384 
   385 	@see RWindowTreeNode::EnableErrorMessages(). */
   386 	EEventErrorMessage,		//15
   387 	/** Message ready event.
   388 
   389 	Occurs when a session sends a message to this window group using RWsSession::SendMessageToWindowGroup(). */
   390 	EEventMessageReady,
   391 	EEventMarkInvalid,	// For internal use only
   392 	/** Off event.
   393 
   394 	This is issued when an off event is received by the window server from the
   395 	base.
   396 
   397 	If for some reason the event can't be delivered, or there is no-one to deliver
   398 	it to, then a call to the base is made to power down the processor.
   399 
   400 	This event is only delivered if explicitly requested using RWsSession:RequestOffEvent(). */
   401 	EEventSwitchOff,
   402 	/** Event issued to off-event requesting windows when the off key is pressed. */
   403 	EEventKeySwitchOff,
   404 	/** Screen size mode change event.
   405 
   406 	This is issued when the screen size mode has changed, for instance when
   407 	the cover on a phone that supports screen flipping is opened or closed. */
   408 	EEventScreenDeviceChanged, //20
   409 	/** Event sent whenever the window group with focus changes.
   410 
   411 	Requested by RWindowTreeNode::EnableFocusChangeEvents(). */
   412 	EEventFocusGroupChanged,
   413 	/** Case opened event.
   414 
   415 	This event is sent to those windows that have requested EEventSwitchOn
   416 	events. Unlike with EEventSwitchOn events, the screen will not be switched
   417 	on first. */
   418 	EEventCaseOpened,
   419 	/** Case closed event.
   420 
   421 	This event is sent to those windows that have requested EEventSwitchOff
   422 	events.
   423 
   424 	Unlike EEventSwitchOff events, which make a call to the base to power down
   425 	the processor if for some reason the event can't be delivered (or there is
   426 	no-one to deliver it to), failure to deliver case closed events has no repercussions. */
   427 	EEventCaseClosed,
   428 	/** Window group list change event.
   429 
   430 	The window group list is a list of all window groups and their z-order. This
   431 	event indicates any change in the window group list: additions, removals and
   432 	reorderings.
   433 
   434 	Notification of this event is requested by calling RWindowTreeNode::EnableGroupListChangeEvents(). */
   435 	EEventWindowGroupListChanged,
   436 	/** The visibility of a window has changed
   437 
   438 	This is sent to windows when they change from visible to invisible, or visa versa, usually due
   439 	to another window obscuring them.
   440 
   441 	Notification of this event is requested by calling RWindowTreeNode::EnableVisibilityChangeEvents(). */
   442 	EEventWindowVisibilityChanged,
   443 #ifdef SYMBIAN_PROCESS_MONITORING_AND_STARTUP
   444 	/** Restart event.
   445 	
   446 	This is issued when an restart event is received by the window server from the 
   447 	base. This event is also an off event, because it might power-cycle the device.
   448 	
   449 	If for some reason the event can't be delivered, or there is no-one to deliver 
   450 	it to, then a call to the base is made to power down the processor.
   451 	
   452 	This event is only delivered if explicitly requested using RWsSession:RequestOffEvent(). */
   453 	EEventRestartSystem,
   454 #endif
   455 	//Codes for events only passed into Key Click DLL's
   456 	/** Repeating key event.
   457 
   458 	This is only sent to a key click plug-in DLL (if one is present) to indicate
   459 	a repeating key event.
   460 
   461 	@see CClickMaker */
   462 	EEventKeyRepeat=100,
   463 	EEventGroupWindowOpen,
   464 	EEventGroupWindowClose,
   465 	EEventWindowClose,
   466 	//Codes for events only passed into anim dlls
   467 	/** Direct screen access begin
   468 	This is only sent to anim dlls (if they register to be notified). It indicates that
   469 	the number of direct screen access sessions has increased from zero to one.*/
   470 	EEventDirectScreenAccessBegin=200,
   471 	/** Direct screen access end
   472 	This is only sent to anim dlls (if they register to be notified). It indicates that
   473 	the number of direct screen access sessions has decreased from one to zero.*/
   474 	EEventDirectScreenAccessEnd,
   475 	/** Event to signal the starting or stopping of the wserv heartbeat timer
   476 	This is only sent to anim dlls (if they register to be notified). */
   477 	EEventHeartbeatTimerStateChange,
   478 
   479 	//The range 900-999 is reserved for UI Framework events
   480 	/** 900-909 WSERV protects with PowerMgmt */
   481 	EEventPowerMgmt = 900,
   482 	EEventReserved = 910,
   483 
   484 	//Event codes from EEventUser upwards may be used for non-wserv events.
   485 	//No event codes below this should be defined except by the window server
   486 
   487 	/** User defined event.
   488 
   489 	The client can use this and all higher values to define their own
   490 	events. These events can be sent between windows of the same client or windows
   491 	of different clients.
   492 
   493 	@see RWs::SendEventToWindowGroup(). */
   494 	EEventUser=1000,
   495 
   496 	};
   497 
   498 
   499 /** Window server hot keys.
   500 
   501 @publishedAll
   502 @released
   503 @see RWsSession::SetHotKey() */
   504 enum THotKey
   505 	{
   506 	/** Enables logging of all messages to and from the window server.
   507 
   508 	Note that the required type of logging must have been specified in the wsini.ini
   509 	file (using the LOG keyword), and the appropriate logging DLL must be available.
   510 
   511 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>E */
   512 	EHotKeyEnableLogging,
   513 	/** Always disables window server logging, if active. Does nothing otherwise.
   514 
   515 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>D */
   516 	EHotKeyDisableLogging,
   517 	/** Dumps a list of all windows to the log. (If logging is disabled, it is temporarily
   518 	enabled in order to do this.)
   519 
   520 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>W */
   521 	EHotKeyStateDump,
   522 	/** Kills the foreground application.
   523 
   524 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>K */
   525 	EHotKeyOfDeath,
   526 	/** Shuts down the window server.
   527 
   528 	Be cautious! This may mean resetting the machine to re-start the window server.
   529 
   530 	Default key mapping: release (not available), debug (\<Ctrl\>\<Alt\>\<Shift\>X). */
   531 	EHotKeyShutDown,
   532 	/** Dumps a list of cells allocated on the window server's heap to the log. (If
   533 	logging is disabled, it is temporarily enabled in order to do this.)
   534 
   535 	Note that logging requires that the type of logging has been set up in the
   536 	wsini.ini file, and that the appropriate logging DLL is available.
   537 
   538 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>H */
   539 	EHotKeyHeapDump,
   540 	/** Increases the LCD contrast.
   541 
   542 	Default key mapping: EKeyIncContrast. Note that this value is from an enum
   543 	in e32keys.h. The contrast wraps around when it reaches the maximum. */
   544 	EHotKeyIncContrast,
   545 	/** Decreases the LCD contrast.
   546 
   547 	Default key mapping: EKeyDecContrast. Note that this value is from an enum
   548 	in e32keys.h. The contrast wraps around when it reaches the minimum. */
   549 	EHotKeyDecContrast,
   550 	/** Switches the machine off.
   551 
   552 	Default key mapping: EKeyOff. Note that this value is from an enum in e32keys.h. */
   553 	EHotKeyOff,
   554 	/** Switches the backlight on.
   555 
   556 	Default key mapping: EKeyBacklightOn. Note that this value is from an enum
   557 	in e32keys.h. */
   558 	EHotKeyBacklightOn,
   559 	/** Switches the backlight off.
   560 
   561 	Default key mapping: EKeyBacklightOff. Note that this value is from an enum
   562 	in e32keys.h. */
   563 	EHotKeyBacklightOff,
   564 	/** Toggles the backlight.
   565 
   566 	Default key mapping: EKeyBacklightToggle. Note that this value is from an
   567 	enum in e32keys.h. */
   568 	EHotKeyBacklightToggle,
   569 	/** Switches to screen size 0.
   570 
   571 	This, and the following 3 keys are used to switch screen sizes on real hardware,
   572 	for instance when the cover is closed on a phone that supports screen flipping. */
   573 	EHotKeyScreenDimension0,
   574 	/** Switches to screen size 1.
   575 
   576 	This might be generated when the cover is opened on a phone that supports screen
   577 	flipping. */
   578 	EHotKeyScreenDimension1,
   579 	/** Switches to screen size 2. */
   580 	EHotKeyScreenDimension2,
   581 	/** Switches to screen size 3. */
   582 	EHotKeyScreenDimension3,
   583 	/** Cycles the display though its possible sizes.
   584 
   585 	This is used only for debugging.
   586 
   587 	A device may have several screen sizes, each with a default orientation. For
   588 	example a phone that supports screen flipping will have different display
   589 	sizes when the cover is opened and closed.
   590 
   591 	Default key mapping: debug : \<Ctrl\>\<Alt\>\<Shift\> U. Release : none. */
   592 	EHotKeyCycleDisplaySize,
   593 	/** Cycles the screen orientation through the specified rotations for the particular
   594 	size mode you are in.
   595 
   596 	For example, phones that support screen flipping may
   597 	use this feature for changing between right and left handed use.
   598 
   599 	For rectangular display modes you can only specify 2 orientations, 180 degrees
   600 	apart. For square modes you can specify 4 rotations (90 degrees) or however
   601 	many you want.
   602 
   603 	Specification of the list of rotations takes place in the WSINI.INI file.
   604 
   605 	Default key mapping: debug : \<Ctrl\>\<Alt\>\<Shift\> O. Release : none. */
   606 	EHotKeyCycleOrientation,
   607 	/** Increases the screen's brightness.
   608 
   609 	The brightness wraps around to the minimum
   610 	value after it has reached the maximum. */
   611 	EHotKeyIncBrightness,
   612 	/** Decreases the screen's brightness.
   613 
   614 	The brightness wraps around to the maximum value after it has reached the minimum. */
   615 	EHotKeyDecBrightness,
   616 
   617 	/** Cycle focus screen from one to another in multiple screen environment. Start
   618 	from current focused screen, switch to next the screen, and wraps around when it
   619 	reaches the last screen.
   620 
   621 	Default key mapping: \<Ctrl\>\<Alt\>\<Shift\> I. */
   622 	EHotKeyCycleFocusScreen,
   623 
   624 	/** Value for first hot key.
   625 
   626 	Used with EHotKeyLastKeyType to make it easy to write a for loop that steps
   627 	through all the different key values. */
   628 	EHotKeyFirstKeyType=EHotKeyEnableLogging,		//Must always be set to the first one
   629 	/** Value for last hot key.
   630 
   631 	Used with EHotKeyFirstKeyType to make it easy to write a for loop that steps
   632 	through all the different key values. */
   633 	EHotKeyLastKeyType=EHotKeyCycleFocusScreen,		//Must always be set to the last one
   634 	};
   635 
   636 
   637 /** Password mode flags.
   638 
   639 @publishedAll
   640 @deprecated */
   641 enum TPasswordMode
   642 	{
   643 	/** Releases ownership of password handling.
   644 
   645 	This allows another window to become the password window. A client will be
   646 	panicked with code 46 if it sets this mode when it is not the current password
   647 	window. */
   648 	EPasswordCancel,
   649 	/** No password handling is performed by this window, but no other window
   650 	can become the password window. */
   651 	EPasswordNone,
   652 	/** Password mode is enabled only once a day.
   653 
   654 	When enabled, password mode requires the user to enter a password
   655 	before any further actions can be performed. */
   656 	EPasswordOnceADay,
   657 	/** Password mode is enabled every time the machine is switched on. */
   658 	EPasswordAlways,
   659 	/** Equivalent to setting the password mode to EPasswordAlways and triggering an
   660 	instant password check. */
   661 	EPasswordAlwaysTriggerNow,
   662 	/** Equivalent to setting the password mode to EPasswordOnceADay and triggering
   663 	an instant password check. */
   664 	EPasswordOnceADayTriggerNow,
   665 	};
   666 struct TTextCursor
   667 /** Text cursor parameter information.
   668 
   669 A text cursor is a rectangular area which can be set to flash. It is normally
   670 only visible when the window group which owns it has the keyboard focus. This
   671 structure is used to define the parameters of a text cursor, which can be
   672 selected for use through the window group using RWindowGroup::SetTextCursor().
   673 
   674 Custom (non-rectangular) text cursors are supported from v7.0s. They are added
   675 to the window server using RWsSession::SetCustomTextCursor(), after which
   676 they can be selected for use through the window group, in the same way as
   677 standard rectangular cursors. They have a unique identifier, stored in the
   678 iType member, which must be greater than ETypeLastBasic. Custom text cursors
   679 are clipped to their iHeight and iWidth values. Their iColour member is not
   680 used.
   681 
   682 @publishedAll
   683 @released */
   684     {
   685 	// The different normal text cursors
   686 	// A Text cursor can either be a predefined one
   687 	// or a general sprite. Cursors between ETypeFirst
   688 	// and ETypeLastBasic are predefined ones (even though
   689 	// the ones above ETypeLast do not exist and are
   690 	// for future use)
   691 	/** Cursor type values.
   692 
   693 	The values between ETypeFirst and ETypeLastBasic are reserved for predefined
   694 	cursors. Custom text cursors must have a value greater than ETypeLastBasic.
   695 
   696 	The values not listed below are for internal use only. */
   697 	enum ENamedCursors
   698 		{
   699 		/** @internalAll */
   700 		ETypeNone,
   701 		/** Standard filled rectangular cursor. */
   702 		ETypeRectangle,
   703 		/** Standard hollow rectangular cursor. */
   704 		ETypeHollowRectangle,
   705 		/** The first predefined cursor type.
   706 
   707 		Equivalent to ETypeRectangle. This can be used for iterating through the predefined
   708 		cursor types. */
   709 		ETypeFirst=ETypeRectangle,
   710 		/** The last predefined cursor type.
   711 
   712 		Equivalent to ETypeHollowRectangle. This can be used for iterating through
   713 		the predefined cursor types. */
   714 		ETypeLast=ETypeHollowRectangle,
   715 		/** Reserved for future use.
   716 
   717 		All custom text cursors must have a type value greater than this. */
   718 		ETypeLastBasic = 1000,
   719 		};
   720 	/** Added for compatibility with previous releases. */
   721 	typedef TInt EType;
   722 	/** Cursor flash and clipping flags.
   723 
   724 	The flags not listed below are for internal use only. */
   725 	enum EFlags
   726 		{
   727 		/** The text cursor should not flash. */
   728 		EFlagNoFlash		= 0x00000001,
   729 		/** The bitmap of each sprite member is clipped left of its x-origin and right of
   730 		its x-origin plus iWidth.
   731 
   732 		Used for custom text cursors only. */
   733 		EFlagClipHorizontal	= 0x00000002,
   734 		/** The bitmap of each sprite member is clipped vertically.
   735 
   736 		How it is clipped depends on the text cursor's vertical alignment, see the
   737 		TCustomTextCursorAlignment enum in class RWsSession.
   738 
   739 		Used for custom text cursors only. */
   740 		EFlagClipVertical	= 0x00000004,
   741 		/** @internalComponent */
   742 		EUserFlags			= 0x0000FFFF,
   743 		/** @internalComponent */
   744 		EFlagClipped		= 0x00010000,
   745 		/** @internalComponent */
   746 		EPrivateFlags		= 0xFFFF0000,
   747 		};
   748 	/** The cursor type.
   749 
   750 	For possible values, see the ENamedCursors enum. */
   751 	TInt iType;
   752 	/** The height of the text cursor.
   753 
   754 	This value is also used for clipping custom text cursors, if the EFlagClipVertical
   755 	flag is set. */
   756     TInt iHeight;
   757 	/** The ascent of the text cursor (the distance between the origin and the top). */
   758     TInt iAscent;
   759 	/** The width of the text cursor.
   760 
   761 	Custom text cursors are clipped to this value, if the EFlagClipHorizontal
   762 	flag is set. */
   763     TInt iWidth;
   764 	/** Cursor flash and clipping flags.
   765 
   766 	For possible values, see the EFlags enum. */
   767     TUint iFlags;
   768 	/** The colour of the text cursor.
   769 
   770 	If the cursor is flashing, this colour is XOR'd with the screen.
   771 
   772 	This value is not used for custom text cursors. */
   773 	TRgb iColor;
   774     };
   775 
   776 /** Sprite flags.
   777 
   778 These can be combined using a bit-wise OR operation.
   779 
   780 @publishedAll
   781 @released
   782 @see RWsPointerCursor::Construct()
   783 @see RWsSprite::Construct() */
   784 enum TSpriteFlags
   785 	{
   786 	/** Flash sprite on and off.
   787 
   788 	All flashing is done on the same timer, including the text cursor. */
   789 	ESpriteFlash=0x1,
   790 	/** With this flag set, the sprite is displayed over the window and all its children.
   791 
   792 	Without the flag, the sprite is only displayed over the window's visible area.
   793 
   794 	This is particularly useful when the sprite is owned by a window group, as
   795 	it means the sprite will be displayed over the whole screen.
   796 
   797 	Notes:
   798 
   799 	By default a sprite is clipped to the visible region of the window that owns
   800 	it.
   801 
   802 	Sprites with this flag set are displayed in front of sprites without this
   803 	flag. */
   804 	ESpriteNoChildClip=0x2,
   805 	/** The sprite's appearance will not change when it is on a shadowed part of the
   806 	screen.
   807 
   808 	(Typically this is used for sprites attached to window groups so that
   809 	they are perceived to be floating above the windows). */
   810 	ESpriteNoShadows=0x4,
   811 	/** @internalComponent */
   812 	ESpriteNonSystemFlags=0x0000FFFF,
   813 	/** @internalComponent */
   814 	ESpriteSystemFlags=	  0xFFFF0000,
   815 	/** @internalComponent */
   816 	ESpritePointer=0x10000,
   817 	/** @internalComponent */
   818 	ESpriteOOM=0x20000,
   819 	/** @internalComponent */
   820 	ESpriteDisabled=0x40000,
   821 	/** @internalComponent */
   822 	ESpriteActive=0x80000,
   823 	};
   824 
   825 struct TSpriteMember
   826 /** Sprite member.
   827 
   828 This structure is used to define the parameters of a sprite member, which
   829 can be added to a sprite or pointer cursor.
   830 @publishedAll
   831 @released */
   832 	{
   833 	/** The bitmap to be displayed in the sprite or pointer cursor during the time
   834 	interval specified by iInterval.
   835 
   836 	If NULL, the sprite or pointer cursor will be invisible for the time specified
   837 	by iInterval. */
   838 	CFbsBitmap *iBitmap;
   839 	/** The bitmap mask.
   840 
   841 	This defines which areas of iBitmap are drawn to the screen.
   842 	It enables the bitmap to have a non-rectangular shape on the screen. Areas
   843 	which are not drawn to, retain the appearance of the window underneath the
   844 	sprite or cursor.
   845 
   846 	The bits in iBitmap are AND'ed with those in iMaskBitmap before being drawn
   847 	to the screen. In practice, the mask bitmap is normally white in those areas
   848 	drawn to by iBitmap, and black in all other areas.
   849 
   850 	Note:
   851 
   852 	This bitmap should be in the same mode as iBitmap, otherwise the masking
   853 	out operation becomes inefficient. */
   854 	CFbsBitmap *iMaskBitmap;
   855 	/** EFalse if the mask bitmap is not to be inverted (the default) or ETrue if it
   856 	is to be inverted. */
   857 	TBool iInvertMask;
   858 	/** Specifies the drawing mode to use when drawing iBitmap if the mask is NULL. */
   859 	CGraphicsContext::TDrawMode iDrawMode;
   860 	/** Offset from the sprite's central position.
   861 
   862 	Specifies an offset between the origin of iBitmap and the sprite or pointer
   863 	cursor's origin. (The origin is the top left corner of the bitmap.) */
   864 	TPoint iOffset;
   865 	/** Time interval for which iBitmap is displayed.
   866 
   867 	Note that if only one sprite member is added to a sprite or pointer cursor,
   868 	it will be displayed continuously, regardless of the value of iInterval. */
   869 	TTimeIntervalMicroSeconds32 iInterval;
   870 	};
   871 
   872 /** Event reporting control.
   873 
   874 This enumeration defines flags which can be used to control how events are
   875 reported.
   876 
   877 @publishedAll
   878 @released
   879 @see RWindowTreeNode::EnableOnEvents()
   880 @see RWindowTreeNode::EnableModifierChangedEvents()
   881 @see RWindowTreeNode::EnableErrorMessages() */
   882 enum TEventControl
   883 	{
   884 	/** Requested events are sent in all circumstances. */
   885 	EEventControlAlways,
   886 	/** Events are delivered only when the requesting window's window group has keyboard
   887 	focus. */
   888 	EEventControlOnlyWithKeyboardFocus,
   889 	/** Events are delivered only when the requesting window or any of its children
   890 	are visible on the screen. */
   891 	EEventControlOnlyWhenVisible
   892 	};
   893 
   894 /** Pointer event filter types.
   895 
   896 These flags are used by RWindowBase::PointerFilter() to define which pointer
   897 events are filtered out by the window server and not sent to the client session.
   898 They also allow the window server to simulate a move event prior to each pen
   899 down event.
   900 
   901 @publishedAll
   902 @released
   903 @see RWindowBase::PointerFilter() */
   904 enum TPointerFilter
   905 	{
   906 	//Basic Types
   907 	/** Filters out both pointer enter and pointer exit events for this window. */
   908 	EPointerFilterEnterExit=0x1,
   909 	/** Filters out pointer-move events for this window. */
   910 	EPointerFilterMove=0x2,
   911 	/** Filters out pointer-drag events for this window. */
   912 	EPointerFilterDrag=0x4,
   913 	/** Simulates a pointer move event before each pen down event.
   914 
   915 	This makes the pen appear more like a mouse, with simulated movement between
   916 	two pointer events. You can only get these events while you are in pen mode. */
   917 	EPointerGenerateSimulatedMove=0x8,
   918 	//Combinations of the above
   919 	/** Filters move and drag-pointer events from the event stream and simulates the
   920 	move event before each pen down event.
   921 
   922 	This enum is useful when you want to get simulated move events. Use it as shown
   923 	below to turn on simulated moves:
   924 
   925 	@code
   926 	win->PointerFilter(EPointerMoveEvents, EPointerGenerateSimulateMoves)
   927 	@endcode
   928 	@see RWindowBase::PointerFilter() */
   929 	EPointerMoveEvents=EPointerFilterMove|EPointerGenerateSimulatedMove,
   930 	};
   931 
   932 struct TPointerEvent
   933 /** Pointer event details.
   934 
   935 The function TWsEvent::Pointer() is used to get this structure for a pointer
   936 event.
   937 
   938 @publishedAll
   939 @released */
   940 	{
   941 /** Pointer event types.
   942 
   943 Note that the user actions that cause these events will vary according to
   944 the type of pointing device used. */
   945 	enum TType
   946 		{
   947 		/** Button 1 or pen down. */
   948 		EButton1Down,
   949 		/** Button 1 or pen up. */
   950 		EButton1Up,
   951 		/** Button 2 down.
   952 
   953 		This is the middle button of a 3 button mouse. */
   954 		EButton2Down,
   955 		/** Button 2 up.
   956 
   957 		This is the middle button of a 3 button mouse. */
   958 		EButton2Up,
   959 		/** Button 3 down. */
   960 		EButton3Down,
   961 		/** Button 3 up. */
   962 		EButton3Up,
   963 		/** Drag event.
   964 
   965 		These events are only received when button 1 is down. */
   966 		EDrag,
   967 		/** Move event.
   968 
   969 		These events are only received when button 1 is up and the XY input mode is
   970 		not pen. */
   971 		EMove,
   972 		/** Button repeat event. */
   973 		EButtonRepeat,
   974 		/** Switch on event caused by a screen tap. */
   975 		ESwitchOn,
   976 		};
   977 	/** The type of pointer event. */
   978 	TType iType;
   979 	/** The state of the modifier keys, defined in TEventModifier. */
   980 	TUint iModifiers;	// State of pointing device and associated buttons
   981 	/** Co-ordinates of the pointer event relative to the origin of the window it occurred
   982 	in.
   983 
   984 	Positive co-ordinates indicate a position to the right of and down from
   985 	the window's origin, negative co-ordinates indicate a position to the left
   986 	and up. */
   987 	TPoint iPosition;
   988 	/** Co-ordinates of the pointer event relative to the parent window of the window
   989 	it occurred in.
   990 
   991 	Positive co-ordinates indicate a position to the right of and down from the window's
   992 	origin, negative co-ordinates indicate a position to the left and up. */
   993 	TPoint iParentPosition;
   994 	};
   995 
   996 struct TKeyEvent
   997 /** Key event details.
   998 
   999 When processing a TKeyEvent, the TStdScanCode in iScanCode should usually
  1000 be ignored in favour of the TKeyCode in iCode. Using iScanCode would bypass
  1001 the keyboard mapping and any FEP that happens to be installed. The exceptions
  1002 to this general rule are games where the positions of the keys are more important
  1003 than their translations, and FEPs that are implementing keyboard maps themselves.
  1004 In these cases, if the iCode is used rather than iScanCode to determine the
  1005 key pressed, there will be two unfortunate consequences. Firstly, the low-level
  1006 keyboard mapping might re-arrange the mapping that you are trying to impose.
  1007 Secondly, you will subvert the CTRL+number method of entering Unicode literals.
  1008 
  1009 @publishedAll
  1010 @released */
  1011 	{
  1012 	/** The character code generated for an EEventKey, or 0 for a down or up event.
  1013 
  1014 	Key codes for special keys are defined in TKeyCode. */
  1015 	TUint iCode;
  1016 	/** The scan code of the key that caused the event.
  1017 
  1018 	Standard scan codes are defined in TStdScanCode. */
  1019 	TInt iScanCode;
  1020 	/** State of modifier keys and pointing device. Modifier keys are defined in TEventModifier. */
  1021 	TUint iModifiers;
  1022 	/** Count of auto repeats generated.
  1023 
  1024 	0 means an event without repeats. 1 or more means "this many auto repeat events".
  1025 	It is normal to ignore this value and treat it as a single event. */
  1026 	TInt iRepeats;
  1027 	};
  1028 
  1029 struct TModifiersChangedEvent
  1030 /** Details of changed modifier keys.
  1031 
  1032 @publishedAll
  1033 @released
  1034 @see TWsEvent::ModifiersChanged() */
  1035 	{
  1036 	/** Contains a set bit for any modifier which has changed. Modifiers are defined
  1037 	in TEventModifier. */
  1038 	TUint iChangedModifiers;
  1039 	/** Current state of all modifiers, combined using a bitwise-OR. Modifiers are
  1040 	defined in TEventModifier. */
  1041 	TUint iModifiers;
  1042 	};
  1043 
  1044 struct TWsVisibilityChangedEvent
  1045 /** Visibility changed events.
  1046 
  1047 These events are generated in response to a window being obscured, or being fully or partially
  1048 revealed after being obscured.
  1049 @publishedAll
  1050 @released
  1051 @see RWindowTreeNode::EnableVisibilityChangeEvents() */
  1052 		{
  1053 	enum
  1054 		{
  1055 		/** Some or all of the window is visible, either directly or through a transparent window.
  1056 		@deprecated Use EPartiallyVisible instead. */
  1057 		ECanBeSeen = 0x01,
  1058 		/** None of the window is visible, either directly or through a transparent window.
  1059 		@deprecated Use ENotVisible instead. */
  1060 		ECantBeSeen = 0x02,
  1061 		};
  1062 	enum
  1063 		{
  1064 		/** Some (or all) of the window is visible, either directly or through a transparent window. */
  1065 		EPartiallyVisible = 0x01,
  1066 		/** None of the window is visible, either directly or through a transparent window. */
  1067 		ENotVisible = 0x02,
  1068 		/** All of the window is directly visible. */
  1069 		EFullyVisible = 0x04,
  1070 		};
  1071 	/** A combination of one or more visibility event flags. */
  1072 	TUint iFlags;
  1073 	};
  1074 
  1075 struct TWsErrorMessage
  1076 /** Error event details.
  1077 
  1078 @publishedAll
  1079 @released
  1080 @see RWindowTreeNode::EnableErrorMessages() */
  1081 	{
  1082 	/** Error event types */
  1083 	enum TErrorCategory
  1084 		{
  1085 		/** An error that occurs while the window server is calculating a drawing region
  1086 		for a particular window.
  1087 
  1088 		When the window server can't calculate a drawing region due to lack of memory
  1089 		it goes into a mode where it draws the whole of a window. Any window that
  1090 		is covering this window is also told to redraw. */
  1091 		EDrawingRegion,
  1092 		/** An error occured while trying to turn the backlight on or off.
  1093 
  1094 		This would usually only happen when the batteries are low. */
  1095 		EBackLight,
  1096 		/** An error occured while trying to enable logging. */
  1097 		ELogging,
  1098 		/** An error that occured while trying to change the contrast. */
  1099 		EContrast,
  1100 		};
  1101 	/** The error category. */
  1102 	TErrorCategory iErrorCategory;
  1103 	/** The error code */
  1104 	TUint iError;
  1105 	};
  1106 
  1107 struct TWsGraphicMessageHeaderEvent
  1108 /** @internalComponent @released */
  1109 	{
  1110 	TInt iClientHandle;
  1111 	TInt iDataLen;
  1112 	};
  1113 
  1114 class TWsRedrawEvent
  1115 /** Window server redraw event.
  1116 
  1117 All redraw events generated by the window server are delivered to the client
  1118 in an object of this type. The class provides a handle to the window which
  1119 generated the redraw event, and the rectangle which should be redrawn.
  1120 
  1121 @publishedAll
  1122 @released
  1123 @see RWsSession::GetRedraw() */
  1124 	{
  1125 public:
  1126 	inline TUint Handle() const;
  1127 	inline TRect Rect() const;
  1128 public:
  1129 	void SetHandle(TUint aHandle);
  1130 	void SetRect(TRect aRect);
  1131 protected:
  1132 	/**	@internalComponent */
  1133 	TUint iHandle;
  1134 	/** @internalComponent */
  1135 	TRect iRect;			// Rectangle to redraw
  1136 	};
  1137 
  1138 class TWsPriorityKeyEvent
  1139 /** Priority key events.
  1140 
  1141 These events are configured using RWindowGroup::AddPriorityKey(), and obtained
  1142 by the client using the functions RWsSession::PriorityKeyReady() and RWsSession::GetPriorityKey().
  1143 
  1144 @publishedAll
  1145 @released */
  1146 	{
  1147 public:
  1148 	inline TKeyEvent *Key() const;
  1149 	inline TUint Handle() const;
  1150 	inline void SetHandle(TUint aHandle);
  1151 protected:
  1152 	/**	@internalComponent */
  1153 	TUint iHandle;
  1154 	/** @internalComponent */
  1155 	TUint8 iEventData[sizeof(TKeyEvent)];
  1156 	};
  1157 
  1158 class TWsEvent
  1159 /** Window server event.
  1160 
  1161 All events generated by the window server, except redraw events and priority
  1162 key events, are delivered to the client in a TWsEvent. The client obtains
  1163 the TWsEvent by calling RWsSession::GetEvent(). The type of data contained
  1164 in the TWsEvent depends on the type of event. The client can inquire the event
  1165 type using Type(), and then retrieve the appropriate type of data.
  1166 
  1167 @publishedAll
  1168 @released */
  1169 	{
  1170 public:
  1171 	/** Event data size. */
  1172 	enum
  1173 		{
  1174 		/** The size of a TPointerEvent.
  1175 
  1176 		This is the maximum number of bytes of data that can be returned by EventData().
  1177 		Note: this value is 24 bytes.*/
  1178 		EWsEventDataSize=sizeof(TPointerEvent)+8
  1179 		};
  1180 public:
  1181 	inline TPointerEvent* Pointer() const;
  1182 	inline TKeyEvent* Key() const;
  1183 	inline TModifiersChangedEvent* ModifiersChanged() const;
  1184 	inline TWsVisibilityChangedEvent* VisibilityChanged();
  1185 	inline const TWsVisibilityChangedEvent* VisibilityChanged() const;
  1186 	inline TWsErrorMessage* ErrorMessage() const;
  1187 	inline TUint8* EventData() const;
  1188 	inline TInt Type() const;
  1189 	inline TUint Handle() const;
  1190 	inline TTime Time() const;
  1191 	inline void SetType(TInt aType);
  1192 	inline void SetHandle(TUint aHandle);
  1193 	inline void SetTimeNow();
  1194 	inline TInt* Int() const;
  1195 protected:
  1196 	/** @internalComponent */
  1197 	TInt iType;
  1198 	/** @internalComponent */
  1199 	TUint iHandle;
  1200 	/**	@internalComponent */
  1201 	TTime iTime;
  1202 	/** @internalComponent */
  1203 	TUint8 iEventData[EWsEventDataSize];
  1204 	};
  1205 
  1206 
  1207 class RWsPointerCursor;
  1208 
  1209 /** Pointer cursor mode flags.
  1210 
  1211 These flags define the current cursor mode, and hence which sprite to use
  1212 for the pointer cursor.
  1213 
  1214 @publishedAll
  1215 @released
  1216 @see RWsSession::SetPointerCursorMode()
  1217 @see RWsSession::PointerCursorMode() */
  1218 enum TPointerCursorMode
  1219 	{
  1220 	/** Don't have a pointer cursor. */
  1221 	EPointerCursorNone,
  1222 	/** The default system pointer cursor is used whenever there is a pointer cursor. */
  1223 	EPointerCursorFixed,
  1224 	/** The default system pointer cursor is used unless the window the pointer cursor
  1225 	is above specifies one, in which case that cursor is used. */
  1226 	EPointerCursorNormal,
  1227 	/** There is no pointer cursor unless the pointer is above a window that has specified
  1228 	one. */
  1229 	EPointerCursorWindow,
  1230 	/** First pointer cursor mode.
  1231 
  1232 	This is used in test code for iterating though available modes. */
  1233 	EPointerCursorFirstMode=EPointerCursorNone,
  1234 	/** The final pointer cursor mode.
  1235 
  1236 	This is used in test code for iterating though available modes. It will be
  1237 	updated if more modes are added. */
  1238 	EPointerCursorLastMode=EPointerCursorWindow,
  1239 	};
  1240 
  1241 /** Flags which customise a long key press capture request made by a window group.
  1242 
  1243 These flags are passed to RWindowGroup::CaptureLongKey().
  1244 
  1245 Two things can be configured using this enum: the normal key event that is
  1246 generated immediately, and the long key event that is generated after a short
  1247 time interval. The normal key event can be sent immediately (on key down)
  1248 to the application with keyboard focus, or, if the key is not held down long
  1249 enough to generate a long key event, when the key is released. The long key
  1250 event can be customised to generate a single key event only, or to auto repeat.
  1251 
  1252 @publishedAll
  1253 @released
  1254 @see RWindowGroup::CaptureLongKey() */
  1255 enum TLongCaptureFlags
  1256 	{
  1257 	/** If specified, the normal ("short") key event is sent immediately (on key down)
  1258 	to the application with keyboard focus. If not specified, the normal key event
  1259 	is sent when the key is released (if the key is not held down long enough
  1260 	to generate a long key event). */
  1261 	ELongCaptureShortEventImmediately=0x01,
  1262 	/** If specified, causes the long key press to automatically repeat. If not specified,
  1263 	the long key press will generate a single key event only. */
  1264 	ELongCaptureRepeatEvents=0x02,
  1265 	/** Equivalent to ELongCaptureShortEventImmediately being set and the other flags
  1266 	unset. */
  1267 	ELongCaptureNormal=ELongCaptureShortEventImmediately,
  1268 	/** Equivalent to the first two values being unset. */
  1269 	ELongCaptureWaitShort=0,
  1270 	};
  1271 
  1272 
  1273 class TIpcArgs;
  1274 class TReadDescriptorType;
  1275 class TWriteDescriptorType;
  1276 class CWindowGc;
  1277 
  1278 class TWsGraphicId
  1279 /** Identifies an abstract artwork
  1280 
  1281 This is a piece of artwork that might be owned and authored by another process.
  1282 A client can draw a piece of artwork, but that doesn't confer the ability to
  1283 access the pixel representation of that artwork directly.
  1284 
  1285 @publishedAll
  1286 @released */
  1287 	{
  1288 public:
  1289 	enum TUninitialized
  1290 		{
  1291 		EUninitialized
  1292 		};
  1293 	TWsGraphicId(TUninitialized): iFlags(0) {}
  1294 	IMPORT_C TWsGraphicId(TUid aUid);
  1295 	IMPORT_C TWsGraphicId(TInt aId);
  1296 	IMPORT_C TWsGraphicId(const TWsGraphicId& aCopy);
  1297 	IMPORT_C TUid Uid() const;
  1298 	IMPORT_C TBool IsUid() const;
  1299 	IMPORT_C void Set(TUid aUid);
  1300 	IMPORT_C TInt Id() const;
  1301 	IMPORT_C TBool IsId() const;
  1302 	IMPORT_C void Set(TInt aId);
  1303 	IMPORT_C TInt Compare(const TWsGraphicId& aOther) const;
  1304 private:
  1305 	friend class CWsGraphic;
  1306 	TUint iFlags;
  1307 	TInt iId;
  1308 	TInt iWsGraphicIdSpare[2];
  1309 	};
  1310 
  1311 class CWsGraphic: public CBase
  1312 /** Client representation of a window-server-side piece of artwork owned by this Client
  1313 
  1314 @publishedAll
  1315 @released
  1316 */
  1317 	{
  1318 protected:
  1319 	IMPORT_C CWsGraphic();
  1320 public:
  1321 	IMPORT_C ~CWsGraphic();
  1322 protected:
  1323 	// 2nd phase construction
  1324 	IMPORT_C void BaseConstructL(TUid aUid,TUid aType,const TDesC8& aData);
  1325 	IMPORT_C void BaseConstructL(TUid aType,const TDesC8& aData);
  1326 	IMPORT_C void BaseConstructL(const TWsGraphicId& aReplace,TUid aType,const TDesC8& aData);
  1327 	// sharing between clients
  1328 	IMPORT_C virtual TInt ShareGlobally();
  1329 	IMPORT_C virtual TInt Share(TSecureId aClientId);
  1330 	IMPORT_C virtual TInt UnShare(TSecureId aClientId);
  1331 	IMPORT_C virtual TInt UnShareGlobally();
  1332 public:
  1333 	IMPORT_C const TWsGraphicId& Id() const;
  1334 	IMPORT_C TBool IsActive() const;
  1335 	IMPORT_C void Destroy();
  1336 protected:
  1337 	IMPORT_C void SendMessage(const TDesC8& aData) const;
  1338 	IMPORT_C TInt SendSynchronMessage(const TDesC8& aData) const;
  1339 	IMPORT_C TInt Flush() const;
  1340 	IMPORT_C void SetGraphicExtension(MWsObjectProvider* aExt);
  1341 private:
  1342 	// events from wserv, to be implemented by derived classes
  1343 	/**
  1344 	Handles message from this graphic artwork peer on the server.
  1345 	@param aData Message from peer CWsGraphicDrawer.
  1346 	*/
  1347 	virtual void HandleMessage(const TDesC8& aData) = 0;
  1348 	
  1349 	/**
  1350 	Handles custom operation when this graphic artwork is replaced. When this method
  1351 	is invoked, the replaced peer CWsGraphicDrawer on the server has been destroyed.	
  1352 	*/
  1353 	virtual void OnReplace() = 0;
  1354 	IMPORT_C virtual void OnClientClose();
  1355 private:
  1356 	void BaseConstructL();
  1357 	IMPORT_C virtual TInt CWsGraphic_Reserved1();
  1358 	IMPORT_C virtual TInt CWsGraphic_Reserved2();
  1359 	IMPORT_C virtual TInt CWsGraphic_Reserved3();
  1360 public:
  1361 	class CManager;
  1362 private:
  1363 	friend class CManager;
  1364 	class CPimpl;
  1365 	friend class CPimpl;
  1366 	CPimpl* iPimpl;
  1367 	TInt iWsGraphicSpare[2];
  1368 };
  1369 
  1370 class MWsClientClass
  1371 /** Base class for all classes whose objects are clients of the window server.
  1372 
  1373 @publishedAll
  1374 @released */
  1375 	{
  1376 public:
  1377 	MWsClientClass();
  1378 	MWsClientClass(RWsBuffer *aBuffer);
  1379 	inline TInt WsHandle() const;
  1380 protected:
  1381 	void Write(const TAny *aData, TInt aLength,const TAny *aData2, TInt aLength2,TUint aOpcode) const;
  1382 	void Write(const TAny *aBuf, TInt aBufLen,TUint aOpcode) const;
  1383 	void Write(TUint aOpcode) const;
  1384 	void WriteInt(TInt aInt, TUint aOpcode) const;
  1385 	void WriteRect(const TRect &aRect, TUint aOpcode) const;
  1386 	void WritePoint(const TPoint &aPoint, TUint aOpcode) const;
  1387 	void WriteSize(const TSize &aSize, TUint aOpcode) const;
  1388 	TInt WriteReply(TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
  1389 	TInt WriteReplyInt(TInt aInt, TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
  1390 	TInt WriteReply(const TAny *aBuf, TInt aBufLen,TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
  1391 	TInt WriteReply(const TAny *aBuf, TInt aBufLen,const TAny *aBuf2, TInt aBuflen2,TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
  1392 	TInt WriteReplyP(const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
  1393 	TInt WriteReplyIntP(TInt aInt, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
  1394 	TInt WriteReplyP(const TAny *aBuf, TInt aBufLen, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
  1395 	TInt WriteReplyP(const TAny *aBuf, TInt aBufLen,const TAny *aBuf2, TInt aBuflen2, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
  1396 	TInt WriteReplyByProvidingRemoteReadAccess(const TAny* aBuf, TInt aBufLen,const TReadDescriptorType& aRemoteReadBuffer,TUint aOpcode) const;
  1397 	void AddToBitmapArray(const TInt aBitmapHandle)const;
  1398 	void AsyncRequest(TRequestStatus& aStatus, TUint aOpcode) const;
  1399 protected:
  1400 	/** @internalComponent*/
  1401 	TInt32 iWsHandle;
  1402 	/** @internalComponent*/
  1403 	RWsBuffer *iBuffer;
  1404 	};
  1405 
  1406 
  1407 class RWindowTreeNode;
  1408 class CWsScreenDevice;
  1409 class CWsBitmap;
  1410 class RAnimDll;
  1411 class RWsSpriteBase;
  1412 class RDirectScreenAccess;
  1413 class RSoundPlugIn;
  1414 
  1415 
  1416 class RWsSession : public MWsClientClass, public RSessionBase
  1417 /** Window server session.
  1418 
  1419 The session between the client and the window server can be used to mediate
  1420 asynchronous events, for client interface control and for system control.
  1421 A description of each of these capabilities is given below.
  1422 
  1423 Mediating asynchronous events:
  1424 
  1425 Primarily, the session mediates asynchronous events to the user. Three event
  1426 streams are available: the standard event stream which all applications must
  1427 use; the redraw event stream which must be used by all applications except
  1428 those which exclusively use backed-up windows; and the priority key event
  1429 stream which may be used for abort keys and the like for specialist applications.
  1430 
  1431 All these events are mediated as standard asynchronous services. Typical window
  1432 server client programs encapsulate each service they require in an active
  1433 object whose RunL() identifies the event and calls the appropriate member
  1434 function of a class associated with an application framework, or a window.
  1435 
  1436 Client interface control:
  1437 
  1438 The client's interface with the window server has several aspects, each of
  1439 which is controlled through the window server session.
  1440 
  1441 Flushing defines how requests to the window server are handled.
  1442 
  1443 System control:
  1444 
  1445 Many system-wide settings may be controlled through the window server session.
  1446 Typically, these functions are only used by the system shell and its associated
  1447 sessions/applications. They include: auto-repeat and double-click, querying
  1448 all window groups in the system, setting the default shadow vector, setting
  1449 the system pointer cursors, counting resources used by the window server
  1450 (this is only useful for debugging checks), getting and setting the state of
  1451 the modifier keys (for instance Shift and Ctrl), and setting the window server
  1452 background colour.
  1453 
  1454 @publishedAll
  1455 @released */
  1456 	{
  1457 	friend class RWsBuffer;
  1458 	friend class RWindowTreeNode;
  1459 	friend class CWsScreenDevice;
  1460 	friend class CWsBitmap;
  1461 	friend class RAnimDll;
  1462 	friend class RWsSpriteBase;
  1463 	friend class RDirectScreenAccess;
  1464 	friend class RSoundPlugIn;
  1465 	friend class CWsGraphic;
  1466 public:
  1467 	/** Compute mode flags.
  1468 
  1469 	When a window group takes focus or loses it, the window server can boost its
  1470 	client's thread or process priority to provide a better response to the user.
  1471 	How it alters the priority is determined by the current compute mode of the
  1472 	client.
  1473 
  1474 	@see ComputeMode() */
  1475 	enum TComputeMode
  1476 		{
  1477 		/** Client priority is permanently set to its current level. It is not altered
  1478 		or set by the windowing system if the focus changes.
  1479 
  1480 		Thus if ComputeMode() is called with this flag when a client is in the foreground,
  1481 		it will subsequently have foreground priority even if it is in the background. */
  1482 		EPriorityControlDisabled,
  1483 		/** Client process's priority is always set to EPriorityBackground. */
  1484 		EPriorityControlComputeOn,
  1485 		/** Client process's priority is set to EPriorityForeground when the window group
  1486 		takes focus, and set to EPriorityBackground when it loses focus.
  1487 
  1488 		This is the default behaviour. */
  1489 		EPriorityControlComputeOff
  1490 		};
  1491 	enum {ESystemInfoArraySize=16};
  1492 	/** Window server logging commands passed to LogCommand().
  1493 
  1494 	@see RWsSession::LogCommand() */
  1495 	enum TLoggingCommand
  1496 		{
  1497 		/** Enables logging. */
  1498 		ELoggingEnable,
  1499 		/** Disables logging. */
  1500 		ELoggingDisable,
  1501 		/** Logs the current status of all the windows in the tree, even if logging is
  1502 		not currently enabled. */
  1503 		ELoggingStatusDump,		//Window Tree Dump
  1504 		/** Logs information about the window server's heap size and usage, even if logging
  1505 		is not currently enabled. */
  1506 		ELoggingHeapDump,
  1507 		};
  1508 
  1509 	struct TWindowGroupChainInfo
  1510 		{
  1511 		/*Stores id and Parent id window group
  1512 
  1513 		This is used to define chained window groups's id and it's parent id.
  1514 		An array of these structures is returned by some of the varients of the function WindowGroupList.
  1515 		@publishedAll
  1516 		@released */
  1517 		TInt iId;
  1518 		TInt iParentId;
  1519 		};
  1520 
  1521 	struct SSystemInfo
  1522 	/** @internalComponent */
  1523 		{
  1524 		TInt iInfo[ESystemInfoArraySize];
  1525 		};
  1526 	/** The vertical alignment of a custom text cursor sprite.
  1527 
  1528 	One of these values must be set, see SetCustomTextCursor(). This value also
  1529 	determines which part of each sprite member bitmap is clipped when the cursor's
  1530 	TTextCursor::EFlagClipVertical flag is set. */
  1531 	enum TCustomTextCursorAlignment
  1532 		{
  1533 		/** The y-origin of each sprite member bitmap is aligned with the top of the line. */
  1534 		ECustomTextCursorAlignTop,
  1535 		/** The y-origin of each sprite member bitmap is aligned with the baseline of the
  1536 		line. */
  1537 		ECustomTextCursorAlignBaseline,
  1538 		/** The y-origin of each sprite member bitmap is aligned with the bottom of the
  1539 		line. */
  1540 		ECustomTextCursorAlignBottom
  1541 		};
  1542 //
  1543 public:
  1544 	IMPORT_C RWsSession();
  1545 	IMPORT_C TInt Connect();
  1546 	IMPORT_C TInt Connect(RFs& aFileServer);
  1547 	IMPORT_C void Close();
  1548 	IMPORT_C TVersion Version();
  1549 
  1550 	IMPORT_C TInt SetHotKey(THotKey aType, TUint aKeyCode, TUint aModifierMask, TUint aModifier);
  1551 	IMPORT_C TInt ClearHotKeys(THotKey aType);
  1552 	IMPORT_C TInt RestoreDefaultHotKey(THotKey aType);
  1553 //
  1554 	IMPORT_C void EventReady(TRequestStatus *aStat);
  1555 	IMPORT_C void EventReadyCancel();
  1556 	IMPORT_C void GetEvent(TWsEvent &aEvent);
  1557 	IMPORT_C void PurgePointerEvents();
  1558 //
  1559 	IMPORT_C void RedrawReady(TRequestStatus *aStat);
  1560 	IMPORT_C void RedrawReadyCancel();
  1561 	IMPORT_C void GetRedraw(TWsRedrawEvent &aEvent);
  1562 //
  1563 	IMPORT_C void PriorityKeyReady(TRequestStatus *aStat);
  1564 	IMPORT_C void PriorityKeyReadyCancel();
  1565 	IMPORT_C void GetPriorityKey(TWsPriorityKeyEvent &aEvent);
  1566 //
  1567 	IMPORT_C void Flush();
  1568 	IMPORT_C TBool SetAutoFlush(TBool aState);
  1569 	IMPORT_C TInt SetKeyboardRepeatRate(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
  1570 	IMPORT_C void GetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime);
  1571 	IMPORT_C void GetDoubleClickSettings(TTimeIntervalMicroSeconds32 &aInterval, TInt &aDistance);
  1572 	IMPORT_C TInt SetDoubleClick(const TTimeIntervalMicroSeconds32 &aInterval, TInt aDistance);
  1573 //
  1574 	IMPORT_C TInt NumWindowGroups() const;
  1575 	IMPORT_C TInt WindowGroupList(CArrayFixFlat<TInt> *aWindowList);
  1576 	IMPORT_C TInt WindowGroupList(RArray<TWindowGroupChainInfo>* aWindowList);
  1577 	IMPORT_C TInt NumWindowGroups(TInt aPriority) const;
  1578 	IMPORT_C TInt WindowGroupList(TInt aPriority, CArrayFixFlat<TInt> *aWindowList);
  1579 	IMPORT_C TInt WindowGroupList(TInt aPriority, RArray<TWindowGroupChainInfo>* aWindowList);
  1580 	IMPORT_C TInt GetFocusWindowGroup();
  1581 	IMPORT_C TInt GetDefaultOwningWindow();
  1582 	IMPORT_C TInt SetWindowGroupOrdinalPosition(TInt aIdentifier, TInt aPosition);
  1583 	IMPORT_C TInt GetWindowGroupClientThreadId(TInt aIdentifier, TThreadId &aThreadId);
  1584 	IMPORT_C TInt GetWindowGroupHandle(TInt aIdentifier);
  1585 	IMPORT_C TInt GetWindowGroupOrdinalPriority(TInt aIdentifier);
  1586 	IMPORT_C TInt SendEventToWindowGroup(TInt aIdentifier, const TWsEvent &aEvent);
  1587 	IMPORT_C TInt SendEventToAllWindowGroups(const TWsEvent &aEvent);
  1588 	IMPORT_C TInt SendEventToAllWindowGroups(TInt aPriority, const TWsEvent &aEvent);
  1589 	IMPORT_C TInt SendEventToOneWindowGroupsPerClient(const TWsEvent &aEvent);
  1590 	IMPORT_C TInt GetWindowGroupNameFromIdentifier(TInt aIdentifier, TDes &aWindowName);
  1591 	IMPORT_C TInt FindWindowGroupIdentifier(TInt aPreviousIdentifier,const TDesC& aMatch,TInt aOffset=0);
  1592 	IMPORT_C TInt FindWindowGroupIdentifier(TInt aPreviousIdentifier,TThreadId aThreadId);
  1593 	IMPORT_C TInt SendMessageToWindowGroup(TInt aIdentifier, TUid aUid, const TDesC8 &aParams);
  1594 	IMPORT_C TInt SendMessageToAllWindowGroups(TUid aUid, const TDesC8& aParams);
  1595 	IMPORT_C TInt SendMessageToAllWindowGroups(TInt aPriority, TUid aUid, const TDesC8& aParams);
  1596 	IMPORT_C TInt FetchMessage(TUid &aUid, TPtr8 &aParams, const TWsEvent& aMessageEvent);
  1597 //
  1598 	IMPORT_C void SetShadowVector(const TPoint &aVector);
  1599 	IMPORT_C TPoint ShadowVector() const;
  1600 //
  1601 	IMPORT_C void SetBackgroundColor(TRgb aColor);
  1602 	IMPORT_C TRgb GetBackgroundColor() const;
  1603 //
  1604 	IMPORT_C TInt RegisterSurface(TInt aScreenNumber, const TSurfaceId& aSurface);		///< @publishedPartner
  1605 	IMPORT_C void UnregisterSurface(TInt aScreenNumber, const TSurfaceId& aSurface);	///< @publishedPartner
  1606 	IMPORT_C TInt PreferredSurfaceConfigurationSize();		///< @publishedPartner
  1607 //
  1608 	IMPORT_C TInt SetSystemPointerCursor(const RWsPointerCursor &aPointerCursor,TInt aCursorNumber);
  1609 	IMPORT_C void ClearSystemPointerCursor(TInt aCursorNumber);
  1610 	IMPORT_C TInt ClaimSystemPointerCursorList();
  1611 	IMPORT_C void FreeSystemPointerCursorList();
  1612 //
  1613 	IMPORT_C TInt SetCustomTextCursor(TInt aIdentifier, const TArray<TSpriteMember>& aSpriteMemberArray, TUint aSpriteFlags, TCustomTextCursorAlignment aAlignment);
  1614 //
  1615 	IMPORT_C TInt ResourceCount();
  1616 	IMPORT_C void PasswordEntered();
  1617 	IMPORT_C void ComputeMode(TComputeMode aMode);
  1618 //
  1619 	IMPORT_C TInt HeapCount() const;
  1620 	IMPORT_C TInt DebugInfo(TInt aFunction, TInt aParam=0) const;
  1621 	IMPORT_C TInt DebugInfo(TInt aFunction, TDes8& aReturnBuf, TInt aParam=0) const;
  1622 	IMPORT_C void HeapSetFail(TInt aTAllocFail,TInt aValue);
  1623 	IMPORT_C TInt SetModifierState(TEventModifier aModifier,TModifierState aState);
  1624 	IMPORT_C TInt GetModifierState() const;
  1625 //
  1626 	IMPORT_C TInt RequestOffEvents(TBool aOn,RWindowTreeNode *aWin=NULL);
  1627 	IMPORT_C TDisplayMode GetDefModeMaxNumColors(TInt& aColor,TInt& aGray) const;
  1628 	IMPORT_C TInt GetColorModeList(CArrayFixFlat<TInt> *aModeList) const;
  1629 //
  1630 	IMPORT_C void SetPointerCursorArea(const TRect& aArea);
  1631 	IMPORT_C void SetPointerCursorArea(TInt aScreenSizeMode,const TRect& aArea);
  1632 	IMPORT_C TRect PointerCursorArea() const;
  1633 	IMPORT_C TRect PointerCursorArea(TInt aScreenSizeMode) const;
  1634 	IMPORT_C void SetPointerCursorMode(TPointerCursorMode aMode);
  1635 	IMPORT_C TInt SetClientCursorMode(TPointerCursorMode aMode);
  1636 	IMPORT_C TPointerCursorMode PointerCursorMode() const;
  1637 	IMPORT_C void SetDefaultSystemPointerCursor(TInt aCursorNumber);
  1638 	IMPORT_C void ClearDefaultSystemPointerCursor();
  1639 	IMPORT_C TInt SetPointerCursorPosition(const TPoint& aPosition);
  1640 	IMPORT_C TPoint PointerCursorPosition() const;
  1641 
  1642 	IMPORT_C void SetDefaultFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
  1643 	IMPORT_C void PrepareForSwitchOff();
  1644 	IMPORT_C void SetBufferSizeL(TInt aBufSize);
  1645 	IMPORT_C void SetMaxBufferSizeL(TInt aMaxBufSize);
  1646 	IMPORT_C TInt SetSystemFaded(TBool aFaded);
  1647 	IMPORT_C TInt SetSystemFaded(TBool aFaded,TUint8 aBlackMap,TUint8 aWhiteMap);
  1648 
  1649 // Functions for multiple screens
  1650 	IMPORT_C TInt SetFocusScreen(TInt aScreenNumber);
  1651 	IMPORT_C TInt GetFocusScreen();
  1652 	IMPORT_C void ClearAllRedrawStores();
  1653 #if defined(__WINS__)
  1654 // Function for WINS behaviour only
  1655 //
  1656 	IMPORT_C void SetRemoveKeyCode(TBool aRemove);
  1657 	IMPORT_C void SimulateXyInputType(TXYInputType aInputType);		//Only for testing WSERV
  1658 #endif
  1659 //
  1660 	IMPORT_C void SimulateRawEvent(TRawEvent aEvent);
  1661 	IMPORT_C void SimulateKeyEvent(TKeyEvent aEvent);
  1662 	IMPORT_C void LogCommand(TLoggingCommand aCommand);
  1663 	IMPORT_C void LogMessage(const TLogMessageText &aMessage);
  1664 //
  1665 // Functions for test code use only
  1666 //
  1667 	IMPORT_C void SystemInfo(TInt &aSystemInfoNumber, SSystemInfo &aSystemInfo);
  1668 	IMPORT_C void TestWrite(TInt aHandle,TInt aOpcode,const TAny *aData, TInt aLength);
  1669 	IMPORT_C void TestWriteReply(TInt aHandle,TInt aOpcode,const TAny *aData, TInt aLength);
  1670 	IMPORT_C void TestWriteReplyP(TInt aHandle,TInt aOpcode,const TAny *aData,TInt aLength,TDes8 *aReplyPackage);
  1671 	IMPORT_C TInt TestWriteReplyByProvidingRemoteReadAccess(TInt aHandle,TInt aOpcode,const TDesC8& aData,const TDesC8& aRemoteReadBuffer);
  1672 	IMPORT_C TInt TestWriteReplyByProvidingRemoteReadAccess(TInt aHandle,TInt aOpcode,const TDesC8& aData,const TDesC16& aRemoteReadBuffer);
  1673 	
  1674 	IMPORT_C TInt Finish();
  1675 	IMPORT_C void SyncMsgBuf();
  1676 // functions not exported, used by CWsGraphic
  1677 	void GraphicMessageReady(TRequestStatus *aStat);
  1678 	void GetGraphicMessage(TDes8& aData);
  1679 	void GraphicMessageCancel();
  1680 	void GraphicAbortMessage(TInt aError);
  1681 	TInt GraphicFetchHeaderMessage();
  1682 private:
  1683 	TInt doWindowGroupList(TInt aPriority, RArray<TWindowGroupChainInfo>* aWindowListCh, TInt aNumOpcode, TInt aListOpcode);
  1684 	TInt doWindowGroupList(TInt aPriority,CArrayFixFlat<TInt>* aWindowListId,TInt aNumOpcode,TInt aListOpcode);
  1685 	TInt doSetHotKey(TInt aOpcode, TInt aType, TUint aKeycode, TUint aModifierMask, TUint aModifiers);
  1686 	void doReadEvent(TRequestStatus *aStat, TInt aOpcode);
  1687 
  1688 private:
  1689 	void connectL();
  1690 	TInt DoFlush(const TIpcArgs& aIpcArgs);
  1691 	TInt DoSyncMsgBuf(const TIpcArgs& aIpcArgs);
  1692 	void DirectAcessActivation(TBool aIsNowActive);
  1693 	};
  1694 
  1695 class RWindowGroup;
  1696 class RWsSprite;
  1697 
  1698 /** @internalComponent */
  1699 typedef TInt (*AnimCommand)(TPtr8 *aBufPtr,TAny *aPackage);
  1700 
  1701 
  1702 class RWindowTreeNode : public MWsClientClass
  1703 /** A handle to a node in the server-side window tree.
  1704 
  1705 This handle class is used as the base for both window groups and the windows
  1706 within them; it is not intended for user derivation, and may not be directly
  1707 constructed: use one of the standard derived classes instead.
  1708 
  1709 @publishedAll
  1710 @released */
  1711 	{
  1712 	friend class RWindowGroup;
  1713 	friend class RWindowBase;
  1714 	friend class CWindowGc;
  1715 	friend class RAnimDll;
  1716 	friend class RWsSprite;
  1717 public:
  1718 	/** Fade control flags.
  1719 
  1720 	These flags define whether fading is applied to all child windows when SetFaded()
  1721 	is called on a window. */
  1722 	enum TFadeControl
  1723 		{
  1724 		/** Include all child windows when fading/un-fading. */
  1725 		EFadeIncludeChildren=ETrue,
  1726 		/** Fade only the parent window.
  1727 
  1728 		Note that a panic will occur if this value is used when SetFaded() is called
  1729 		on a window group. */
  1730 		EFadeWindowOnly=EFalse,
  1731 		};
  1732 protected:
  1733 	RWindowTreeNode();
  1734 	RWindowTreeNode(RWsSession &aWs);
  1735 public:
  1736 	IMPORT_C void Close();
  1737 	IMPORT_C void Destroy();
  1738 	IMPORT_C TUint32 ClientHandle() const;
  1739 	IMPORT_C TUint32 Parent() const;
  1740 	IMPORT_C TUint32 PrevSibling() const;
  1741 	IMPORT_C TUint32 NextSibling() const;
  1742 	IMPORT_C TUint32 Child() const;
  1743 	IMPORT_C TInt OrdinalPriority() const;
  1744 	IMPORT_C TInt OrdinalPosition() const;
  1745 	IMPORT_C TInt FullOrdinalPosition() const;
  1746 	IMPORT_C void SetOrdinalPosition(TInt aPos);
  1747 	IMPORT_C void SetOrdinalPosition(TInt aPos,TInt aOrdinalPriority);
  1748 	IMPORT_C TInt WindowGroupId();
  1749 	IMPORT_C TInt SetPointerCursor(TInt aCursorNumber);
  1750 	IMPORT_C void SetCustomPointerCursor(const RWsPointerCursor &aPointerCursor);
  1751 	IMPORT_C TInt EnableOnEvents(TEventControl aCircumstances=EEventControlOnlyWithKeyboardFocus);
  1752 	IMPORT_C void DisableOnEvents();
  1753 	IMPORT_C TInt EnableGroupChangeEvents();
  1754 	IMPORT_C void DisableGroupChangeEvents();
  1755 	IMPORT_C TInt EnableFocusChangeEvents();
  1756 	IMPORT_C void DisableFocusChangeEvents();
  1757 	IMPORT_C TInt EnableGroupListChangeEvents();
  1758 	IMPORT_C void DisableGroupListChangeEvents();
  1759 	IMPORT_C TInt EnableVisibilityChangeEvents();
  1760 	IMPORT_C void DisableVisibilityChangeEvents();
  1761 	IMPORT_C TInt EnableErrorMessages(TEventControl aCircumstances);
  1762 	IMPORT_C void DisableErrorMessages();
  1763 	IMPORT_C TInt EnableModifierChangedEvents(TUint aModifierMask, TEventControl aCircumstances);
  1764 	IMPORT_C void DisableModifierChangedEvents();
  1765 	IMPORT_C void SetNonFading(TBool aNonFading);
  1766 	IMPORT_C void SetFaded(TBool aFaded,TFadeControl aIncludeChildren);
  1767 	IMPORT_C void SetFaded(TBool aFaded,TFadeControl aIncludeChildren,TUint8 aBlackMap,TUint8 aWhiteMap);
  1768 	IMPORT_C void ClearPointerCursor();
  1769 protected:
  1770 	__DECLARE_TEST;
  1771 	};
  1772 
  1773 
  1774 class TSurfaceId;
  1775 class TSurfaceConfiguration;
  1776 
  1777 class RWindowBase : public RWindowTreeNode
  1778 /** Client-side handle to a server-side window.
  1779 
  1780 The server-side windows of handles derived from this class can be displayed
  1781 on the device's screen, and associated with pointer events.
  1782 
  1783 This class is not for user derivation; however derived classes form part of
  1784 the Window Server API.
  1785 
  1786 @publishedAll
  1787 @released */
  1788 	{
  1789 public:
  1790 	/** Capture behaviour flags.
  1791 
  1792 	@see SetPointerCapture()
  1793 	@see EEventDragDrop */
  1794 	enum TCaptureFlags
  1795 		{
  1796 // Flags, these can be combined to customise pointer capture
  1797 		/** If set, capture is enabled, disabled otherwise. */
  1798 		TCaptureFlagEnabled=0x01,
  1799 		/** If set, drag-drop events are sent to the window in which the pointer was lifted.
  1800 		Drag-drop is a tap-drag-lift sequence. */
  1801 		TCaptureFlagDragDrop=0x02,
  1802 		/** Capture events from windows belonging to any group, not just the group of the
  1803 		window on which the flag was set */
  1804 		TCaptureFlagAllGroups=0x04,
  1805 // States, made up of a set of flags
  1806 		/** Equivalent to disabling all the above flags. */
  1807 		TCaptureDisabled=0,
  1808 		/** Equivalent to TCaptureFlagEnabled. */
  1809 		TCaptureEnabled=TCaptureFlagEnabled,
  1810 		/** Equivalent to the OR of the first three flags. */
  1811 		TCaptureDragDrop=TCaptureFlagEnabled|TCaptureFlagDragDrop|TCaptureFlagAllGroups,
  1812 		};
  1813 protected:
  1814 	RWindowBase();
  1815 	RWindowBase(RWsSession &aWs);
  1816 public:
  1817 	IMPORT_C void Activate();
  1818 	IMPORT_C void SetPosition(const TPoint &point);
  1819 	IMPORT_C TInt SetSizeErr(const TSize &size);
  1820 	IMPORT_C TInt SetExtentErr(const TPoint &point,const TSize &size);
  1821 	IMPORT_C TSize Size() const;
  1822 	IMPORT_C TPoint InquireOffset(const RWindowTreeNode &aWindow) const;
  1823 	IMPORT_C void PointerFilter(TUint32 aFilterMask, TUint32 aFilter);
  1824 	IMPORT_C void SetPointerGrab(TBool aState);
  1825 	IMPORT_C void ClaimPointerGrab(TBool aSendUpEvent=ETrue);
  1826 	IMPORT_C void SetPointerCapture(TInt aFlags);
  1827 	IMPORT_C void SetPointerCapturePriority(TInt aPriority);
  1828 	IMPORT_C TInt GetPointerCapturePriority() const;
  1829 	IMPORT_C void SetVisible(TBool aState);
  1830 	IMPORT_C void SetShadowHeight(TInt aHeight);
  1831 	IMPORT_C void SetShadowDisabled(TBool aState);
  1832 	IMPORT_C TPoint Position() const;
  1833 	IMPORT_C TPoint AbsPosition() const;
  1834 	IMPORT_C TInt SetCornerType(TCornerType aCornerType, TInt aCornerFlags=0);
  1835 	IMPORT_C TInt SetShape(const TRegion &aRegion);
  1836 	IMPORT_C TInt SetRequiredDisplayMode(TDisplayMode aMode);
  1837 	IMPORT_C TDisplayMode DisplayMode();
  1838 	IMPORT_C void EnableBackup(TUint aBackupType=EWindowBackupAreaBehind);
  1839 	IMPORT_C void RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 aTime,const TRect &aRect);
  1840 	IMPORT_C void CancelPointerRepeatEventRequest();
  1841 	IMPORT_C TInt AllocPointerMoveBuffer(TInt aMaxPoints, TUint aFlags);
  1842 	IMPORT_C void FreePointerMoveBuffer();
  1843 	IMPORT_C void EnablePointerMoveBuffer();
  1844 	IMPORT_C void DisablePointerMoveBuffer();
  1845 	IMPORT_C TInt RetrievePointerMoveBuffer(TDes8 &aBuf);
  1846 	IMPORT_C void DiscardPointerMoveBuffer();
  1847 	IMPORT_C TInt AddKeyRect(const TRect &aRect, TInt aScanCode, TBool aActivatedByPointerSwitchOn);
  1848 	IMPORT_C void RemoveAllKeyRects();
  1849 	IMPORT_C TInt PasswordWindow(TPasswordMode aPasswordMode);
  1850 	IMPORT_C void FadeBehind(TBool aFade);
  1851 	IMPORT_C TBool IsFaded();
  1852 	IMPORT_C TBool IsNonFading();
  1853 	IMPORT_C TInt MoveToGroup(TInt aIdentifier);
  1854 	IMPORT_C TInt SetBackgroundSurface(const TSurfaceId& aSurface);	///< @publishedPartner
  1855 	IMPORT_C TInt SetBackgroundSurface(const TSurfaceConfiguration& aConfiguration, TBool aTriggerRedraw);	///< @publishedPartner
  1856 	IMPORT_C void RemoveBackgroundSurface(TBool aTriggerRedraw);	///< @publishedPartner
  1857 	IMPORT_C TInt GetBackgroundSurface(TSurfaceConfiguration& aConfiguration);	///< @publishedPartner
  1858 	IMPORT_C TRgb KeyColor();										///< @publishedPartner whilst prototype
  1859 protected:
  1860 	TInt construct(const RWindowTreeNode &parent,TUint32 aHandle, TInt aType, TDisplayMode aDisplayMode);
  1861 	};
  1862 
  1863 
  1864 class RBlankWindow : public RWindowBase
  1865 /** Blank window.
  1866 
  1867 A blank window may have its extent and colour changed, but nothing else may
  1868 be drawn to it. Blank windows provide no functionality that is not provided
  1869 by the RWindow class. However, they are useful when the application requires
  1870 a window that cannot be drawn to, for example a container window.
  1871 
  1872 @publishedAll
  1873 @released */
  1874 	{
  1875 public:
  1876 	IMPORT_C RBlankWindow();
  1877 	IMPORT_C RBlankWindow(RWsSession &aWs);
  1878 	IMPORT_C TInt Construct(const RWindowTreeNode &parent, TUint32 aHandle);
  1879 	IMPORT_C void SetColor(TRgb aColor);
  1880 	IMPORT_C void SetColor();
  1881 	IMPORT_C void SetSize(const TSize &size);
  1882 	IMPORT_C void SetExtent(const TPoint &point,const TSize &size);
  1883 	};
  1884 
  1885 
  1886 class RDrawableWindow : public RWindowBase
  1887 /** Handle to a drawable window.
  1888 
  1889 This class cannot be constructed directly.
  1890 The two concrete derived classes, RWindow and RBackedUpWindow, allow
  1891 drawing but use different protocols because RWindow relies on the client to
  1892 redraw invalid areas.
  1893 
  1894 @publishedAll
  1895 @released */
  1896 	{
  1897 protected:
  1898 	RDrawableWindow();
  1899 	RDrawableWindow(RWsSession &aWs);
  1900 public:
  1901 	IMPORT_C void Scroll(const TPoint &aOffset);
  1902 	IMPORT_C void Scroll(const TRect &aClipRect, const TPoint &aOffset);
  1903 	IMPORT_C void Scroll(const TPoint &aOffset, const TRect &aRect);
  1904 	IMPORT_C void Scroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect);
  1905 	IMPORT_C TRect GetDrawRect();
  1906 protected:
  1907 	void SetDrawRect(const TRect &aRect);
  1908 private:
  1909 	void doScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect, TInt aOpcode);
  1910 
  1911 	TRect iDrawRect;
  1912 	};
  1913 
  1914 /** Transparency policies
  1915 
  1916 These policies are to control the behaviour of a transparent window.
  1917 @publishedAll
  1918 @released
  1919 @see RWindow::SetTransparencyPolicy() */
  1920 enum TWsTransparencyPolicy {
  1921 	/** Default behaviour. */
  1922 	ETransparencyDefault,
  1923 	/** Freeze the content of underneath the transparent window to prevent redraw everytime
  1924 	the overlying window changes. */
  1925 	ETransparencyFreezeUnder,
  1926 	};
  1927 
  1928 class RWindow : public RDrawableWindow
  1929 /** Handle to a standard window.
  1930 
  1931 An RWindow is a handle to a server-side window which can be displayed and
  1932 drawn to, and whose redraws are performed by the application.
  1933 
  1934 @publishedAll
  1935 @released */
  1936 	{
  1937 public:
  1938 	IMPORT_C RWindow();
  1939 	IMPORT_C RWindow(RWsSession &aWs);
  1940 	IMPORT_C TInt Construct(const RWindowTreeNode &parent,TUint32 aHandle);
  1941 	IMPORT_C void BeginRedraw();
  1942 	IMPORT_C void BeginRedraw(const TRect &aRect);
  1943 	IMPORT_C void EndRedraw();
  1944 	IMPORT_C void Invalidate();
  1945 	IMPORT_C void Invalidate(const TRect &aRect);
  1946 	IMPORT_C void GetInvalidRegion(RRegion &aRegion);
  1947 	IMPORT_C void SetBackgroundColor(TRgb aColor);
  1948 	IMPORT_C void SetBackgroundColor();
  1949 	IMPORT_C void SetSize(const TSize &size);
  1950 	IMPORT_C void SetExtent(const TPoint &point,const TSize &size);
  1951 	IMPORT_C void HandleTransparencyUpdate();
  1952 	IMPORT_C TInt SetTransparencyFactor(const TRgb& aTransparencyFactor);
  1953 	IMPORT_C TInt SetTransparencyBitmap(const CFbsBitmap& aTransparencyBitmap);
  1954 	IMPORT_C TInt SetTransparencyWsBitmap(const CWsBitmap& aTransparencyBitmap);
  1955 	IMPORT_C void SetNonTransparent();
  1956 	IMPORT_C void EnableRedrawStore(TBool aEnabled);
  1957 	IMPORT_C TInt SetTransparencyAlphaChannel();
  1958 	IMPORT_C TInt SetTransparentRegion(const TRegion& aRegion);
  1959 	IMPORT_C TInt SetTransparencyPolicy(TWsTransparencyPolicy aPolicy);
  1960 	IMPORT_C TBool IsRedrawStoreEnabled();
  1961 	IMPORT_C void EnableOSB(TBool);
  1962 	IMPORT_C void ClearRedrawStore();
  1963 	};
  1964 
  1965 
  1966 class RBackedUpWindow : public RDrawableWindow
  1967 /** Client-side handle to a drawable window with a backup bitmap.
  1968 
  1969 A backed-up window is associated with a backup bitmap which retains the contents
  1970 of the window. When an area of the window is invalidated, the window server
  1971 uses the bitmap directly to update the window without requiring an application
  1972 redraw. The backup bitmap is owned by the font and bitmap server and resides
  1973 on the font and bitmap server's shared heap, which is accessible to all client
  1974 programs: functions are provided to allow the client application to access
  1975 this bitmap directly and perform updates to the window under application control.
  1976 
  1977 @publishedAll
  1978 @released */
  1979 	{
  1980 public:
  1981 	IMPORT_C RBackedUpWindow();
  1982 	IMPORT_C RBackedUpWindow(RWsSession &aWs);
  1983 	IMPORT_C TInt Construct(const RWindowTreeNode &parent,TDisplayMode aDisplayMode, TUint32 aHandle);
  1984 	IMPORT_C TInt BitmapHandle();
  1985 	IMPORT_C void UpdateScreen();
  1986 	IMPORT_C void UpdateScreen(const TRegion &aRegion);
  1987 	IMPORT_C void UpdateBackupBitmap();
  1988 	IMPORT_C void MaintainBackup();
  1989 	};
  1990 
  1991 
  1992 class RWindowGroup : public RWindowTreeNode
  1993 /** Client-side handle to a server-side window group.
  1994 
  1995 @publishedAll
  1996 @released */
  1997 	{
  1998 public:
  1999 	IMPORT_C RWindowGroup();
  2000 	IMPORT_C RWindowGroup(RWsSession &aWs);
  2001 	IMPORT_C TInt Construct(TUint32 aClientHandle);
  2002 	IMPORT_C TInt Construct(TUint32 aClientHandle,TBool aIsFocusable);
  2003 	IMPORT_C TInt ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle);
  2004 	IMPORT_C TInt ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable);
  2005 	IMPORT_C void AllowProcessToCreateChildWindowGroups(TUid aProcessSID);
  2006 	IMPORT_C void EnableReceiptOfFocus(TBool aState);
  2007 	IMPORT_C void AutoForeground(TBool aState);
  2008 	IMPORT_C void SetOrdinalPriorityAdjust(TInt aAdjust);
  2009 	IMPORT_C TInt SetOrdinalPositionErr(TInt aPos,TInt aOrdinalPriority);
  2010 	IMPORT_C TInt32 CaptureKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
  2011 	IMPORT_C TInt32 CaptureKey(TUint aKeycode, TUint aModifierMask, TUint aModifier, TInt aPriority);
  2012 	IMPORT_C void CancelCaptureKey(TInt32 aCaptureKey);
  2013 	IMPORT_C TInt32 CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifier);
  2014 	IMPORT_C TInt32 CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifier, TInt aPriority);
  2015 	IMPORT_C void CancelCaptureKeyUpAndDowns(TInt32 aCaptureKey);
  2016 	IMPORT_C TInt32 CaptureLongKey(TUint aInputKeyCode,TUint aOutputKeyCode,TUint aModifierMask,TUint aModifier
  2017 																										,TInt aPriority,TUint aFlags);
  2018 	IMPORT_C TInt32 CaptureLongKey(TTimeIntervalMicroSeconds32 aRepeatTime,TUint aInputKeyCode,TUint aOutputKeyCode
  2019 																	,TUint aModifierMask,TUint aModifier,TInt aPriority,TUint aFlags);
  2020 	IMPORT_C void CancelCaptureLongKey(TInt32 aCaptureKey);
  2021 	IMPORT_C TInt AddPriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
  2022 	IMPORT_C void RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
  2023 	IMPORT_C void SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor);
  2024 	IMPORT_C void SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor, const TRect &aClipRect);
  2025 	IMPORT_C void CancelTextCursor();
  2026 	IMPORT_C void SetOwningWindowGroup(TInt aIdentifier);
  2027 	IMPORT_C void DefaultOwningWindow();
  2028 	IMPORT_C TInt SetName(const TDesC &aName);
  2029 	IMPORT_C TInt Name(TDes &aWindowName) const;
  2030 	IMPORT_C TInt Identifier() const;
  2031 	IMPORT_C void DisableKeyClick(TBool aState);
  2032 	IMPORT_C TInt EnableScreenChangeEvents();
  2033 	IMPORT_C void DisableScreenChangeEvents();
  2034 	IMPORT_C void SimulatePointerEvent(TRawEvent aEvent);
  2035 	IMPORT_C TInt ClearChildGroup();
  2036 	IMPORT_C TInt SetChildGroup(TInt aId);
  2037 private:
  2038 	TInt32 doCaptureKey(TUint aKey, TUint aModifierMask, TUint aModifiers, TInt aPriority, TInt aOpcode);
  2039 	void doCancelCaptureKey(TInt32 aCaptureKeyHandle, TInt aOpcode);
  2040 	TInt Construct(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable);
  2041 	};
  2042 
  2043 
  2044 class CWsBitmap : public CFbsBitmap, public MWsClientClass
  2045 /** Window server bitmap.
  2046 
  2047 This is a bitmap to which the window server already has a handle. Functions
  2048 which take a window server bitmap are faster than equivalent functions which
  2049 take a CFbsBitmap.
  2050 
  2051 @publishedAll
  2052 @released */
  2053 	{
  2054 public:
  2055 	IMPORT_C CWsBitmap();
  2056 	IMPORT_C CWsBitmap(RWsSession &aWs);
  2057 	IMPORT_C ~CWsBitmap();
  2058 	IMPORT_C TInt Create(const TSize& aSizeInPixels,TDisplayMode aDispMode);
  2059 	IMPORT_C TInt Duplicate(TInt aHandle);
  2060 	IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded=ETrue);
  2061 	IMPORT_C void InternalizeL(RReadStream& aStream);
  2062 	IMPORT_C void Reset();
  2063 private:
  2064 	TInt createWsBitmap(TInt aErr);
  2065 	};
  2066 
  2067 class RWsGraphicMsgBuf;
  2068 
  2069 class TWsGraphicMsgFixedBase
  2070 /** Base class for fixed-size messages to be attached to CWindowGc::DrawWsGraphic commands
  2071 @publishedAll
  2072 @released
  2073 */	{
  2074 public:
  2075 	IMPORT_C TPtrC8 Pckg() const;
  2076 	IMPORT_C TUid TypeId() const;
  2077 	IMPORT_C TInt Size() const;
  2078 protected:
  2079 	IMPORT_C TWsGraphicMsgFixedBase(TUid aTypeId,TInt aSizeOfDerived);
  2080 private:
  2081 	const TUid iTypeId;
  2082 	const TInt iSize;
  2083 	};
  2084 
  2085 class RWsGraphicMsgBuf: private RBuf8
  2086 /** Utility class for building data buffers to be attached to CWindowGc::DrawWsGraphic commands
  2087 Useful when there is more than one piece of data to be attached to the draw command
  2088 @publishedAll
  2089 @released */
  2090 	{
  2091 public:
  2092 	IMPORT_C RWsGraphicMsgBuf();
  2093 	using RBuf8::Close;
  2094 	using RBuf8::CleanupClosePushL;
  2095 	IMPORT_C TInt Append(TUid aTypeId,const TDesC8& aData);
  2096 	IMPORT_C TInt Append(TUid aTypeId,const TDesC16& aData);
  2097 	IMPORT_C TInt Append(TUid aTypeId,TInt aLen,TPtr8& aPtr);
  2098 	IMPORT_C TInt Append(const TWsGraphicMsgFixedBase& aMsg);
  2099 	IMPORT_C void Remove(TInt aIndex);
  2100 	IMPORT_C TInt Count() const;
  2101 	IMPORT_C TUid TypeId(TInt aIndex) const;
  2102 	IMPORT_C TPtrC8 Data(TInt aIndex) const;
  2103 	IMPORT_C TPtr8 Data(TInt aIndex);
  2104 	IMPORT_C void GetFixedMsg(TWsGraphicMsgFixedBase& aMsg,TInt aIndex) const;
  2105 	IMPORT_C const TDesC8& Pckg() const;
  2106 private:
  2107 	TInt ExpandForAppend(TInt aDataLen);
  2108 	void WriteHeader(TUid aUid,TInt aLen);
  2109 	TInt IntAt(TInt aOfs) const;
  2110 private:
  2111 	TInt iRMsgBufSpare[2];
  2112 	};
  2113 
  2114 
  2115 class CWindowGc : public CBitmapContext, public MWsClientClass
  2116 /** Window graphics context.
  2117 
  2118 Most window graphics context drawing functions map to equivalent CFbsBitGc
  2119 functions. They are implemented on the screen with any co-ordinates being
  2120 relative to the top left corner of the window. However extra clipping is applied.
  2121 The drawing will always be clipped to the visible part of the window. In addition
  2122 it will be clipped to the non-invalid part if you are not doing a redraw and
  2123 to the region being validated if you are doing a redraw.
  2124 
  2125 Note:
  2126 
  2127 In general, server side functions which encounter conditions which would normally
  2128 cause a leave, do not leave but instead return an error value indicating the
  2129 leave condition. In this way the leave can be handled on the appropriate side
  2130 of the client/server boundary. For example, a client can choose to wrap server
  2131 calls with User::LeaveIfError(), which causes a leave with the specified
  2132 error.
  2133 
  2134 The above advice is true of many functions in this class, and in its derived
  2135 classes.
  2136 
  2137 @publishedAll
  2138 @released
  2139 @see CGraphicsContext */
  2140 	{
  2141 	friend class CWsScreenDevice;
  2142 public:
  2143 	IMPORT_C CWindowGc(CWsScreenDevice *aDevice);
  2144 	IMPORT_C virtual ~CWindowGc();
  2145 	IMPORT_C virtual TInt Construct();
  2146 	IMPORT_C virtual void Activate(RDrawableWindow &aDevice);
  2147 	IMPORT_C virtual void Deactivate();
  2148 //====================FROM CGraphicsContext.H===============================
  2149 	IMPORT_C virtual CGraphicsDevice* Device() const;
  2150 	IMPORT_C virtual void SetOrigin(const TPoint &aPoint=TPoint(0,0));
  2151 	IMPORT_C virtual void SetDrawMode(TDrawMode aDrawingMode);
  2152 	IMPORT_C virtual void SetClippingRect(const TRect& aRect);
  2153 	IMPORT_C virtual void CancelClippingRect();
  2154 	IMPORT_C virtual void Reset();
  2155 
  2156 	IMPORT_C virtual void UseFont(const CFont *aFont);
  2157 	IMPORT_C virtual void DiscardFont();
  2158 	IMPORT_C virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
  2159 	IMPORT_C virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
  2160 // Used to do justified text properly
  2161 	IMPORT_C virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps);
  2162 // Used primarily to get accurate WYSIWYG
  2163 	IMPORT_C virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars);
  2164 
  2165 	IMPORT_C virtual void SetPenColor(const TRgb &aColor);
  2166 	IMPORT_C virtual void SetPenStyle(TPenStyle aPenStyle);
  2167 	IMPORT_C virtual void SetPenSize(const TSize& aSize);
  2168 
  2169 	IMPORT_C virtual void SetBrushColor(const TRgb &aColor);
  2170 	IMPORT_C virtual void SetBrushStyle(TBrushStyle aBrushStyle);
  2171 	IMPORT_C virtual void SetBrushOrigin(const TPoint &aOrigin);
  2172 	IMPORT_C virtual void UseBrushPattern(const CFbsBitmap *aDevice);
  2173 	IMPORT_C virtual void DiscardBrushPattern();
  2174 //
  2175 // Move the internal position, as used by DrawLineTo & DrawLineBy, and set by MoveTo,
  2176 // MoveBy, DrawLine, DrawLineTo, DrawLineBy and DrawPolyline
  2177 	IMPORT_C virtual void MoveTo(const TPoint &aPoint);
  2178 	IMPORT_C virtual void MoveBy(const TPoint &aPoint);
  2179 	IMPORT_C virtual void Plot(const TPoint &aPoint);
  2180 //
  2181 //  Line drawing subject to pen color, width and style and draw mode
  2182 	IMPORT_C virtual void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
  2183 	IMPORT_C virtual void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2);
  2184 	IMPORT_C virtual void DrawLineTo(const TPoint &aPoint);
  2185 	IMPORT_C virtual void DrawLineBy(const TPoint &aPoint);
  2186 	IMPORT_C virtual void DrawPolyLine(const CArrayFix<TPoint> *aPointList);
  2187 	IMPORT_C virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints);
  2188 //
  2189 // Filled outlines
  2190 // Outlines subject to pen color, width and style and draw mode
  2191 // (set pen to ENullPen for no outline)
  2192 // Fill subject to brush style (color, hash or pattern) and origin and
  2193 // drawing mode (set brush to ENullBrush for no fill)
  2194 	IMPORT_C virtual void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
  2195 	IMPORT_C virtual void DrawEllipse(const TRect &aRect);
  2196 	IMPORT_C virtual void DrawRect(const TRect &aRect);
  2197 	IMPORT_C virtual void DrawRoundRect(const TRect &aRect,const TSize &aEllipse);
  2198 	IMPORT_C virtual TInt DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule=EAlternate);
  2199 	IMPORT_C virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate);
  2200 //
  2201 // Uses the bitmap's Twips size and does a "stretch" blit in general
  2202 	IMPORT_C virtual void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice);
  2203 	IMPORT_C virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice);
  2204 	IMPORT_C virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect);
  2205 	IMPORT_C virtual void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
  2206 	IMPORT_C virtual void DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask);
  2207 //
  2208 // Text drawing subject to drawing mode
  2209 // Subject to used font, pen color, drawing mode,
  2210 // word and char justification
  2211 	IMPORT_C virtual void DrawText(const TDesC &aBuf,const TPoint &aPos);
  2212 //
  2213 // Subject to same as above plus brush for background
  2214 // (set brush to ENullBrush for no effect on background)
  2215 	IMPORT_C virtual void DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0);
  2216 //================Extra functions from CBitmapContext==============
  2217 	IMPORT_C virtual void Clear();
  2218 	IMPORT_C virtual void Clear(const TRect &aRect);
  2219 	IMPORT_C virtual void CopyRect(const TPoint &anOffset,const TRect &aRect);
  2220 	IMPORT_C virtual void BitBlt(const TPoint &aPos, const CFbsBitmap *aBitmap);
  2221 	IMPORT_C virtual void BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource);
  2222 	IMPORT_C virtual void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
  2223 	IMPORT_C virtual void BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap);
  2224 	IMPORT_C virtual void BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource);
  2225 	IMPORT_C virtual void BitBltMasked(const TPoint& aPoint,const CWsBitmap *aBitmap,const TRect& aSourceRect,const CWsBitmap *aMaskBitmap,TBool aInvertMask);
  2226 	IMPORT_C virtual void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs=2,TBool aMapForwards=ETrue);
  2227 
  2228 	IMPORT_C virtual void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
  2229 	IMPORT_C virtual void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
  2230 //=================Extra functions specific to wserv GDI==============
  2231 	IMPORT_C virtual void SetDitherOrigin(const TPoint& aPoint);
  2232 	IMPORT_C virtual TInt SetClippingRegion(const TRegion &aRegion);
  2233 	IMPORT_C virtual void CancelClippingRegion();
  2234 	IMPORT_C virtual void SetOpaque(TBool aDrawOpaque=ETrue);
  2235 //=================Functions also supplied by CFbsBitGc==============
  2236 	IMPORT_C virtual void SetFaded(TBool aFaded);
  2237 	IMPORT_C virtual void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
  2238 	IMPORT_C virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
  2239 	IMPORT_C virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
  2240 	
  2241 protected:	
  2242 	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
  2243 	
  2244 private:	
  2245 
  2246 	IMPORT_C void Reserved_CGraphicsContext_2();
  2247 
  2248 	IMPORT_C void Reserved_CBitmapContext_1();
  2249 	IMPORT_C void Reserved_CBitmapContext_2();
  2250 	IMPORT_C void Reserved_CBitmapContext_3();
  2251 
  2252 public:
  2253 	IMPORT_C virtual void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect);
  2254 	IMPORT_C virtual void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect,const TDesC8& aData);
  2255 
  2256 private:
  2257 	IMPORT_C virtual void Reserved_CWindowGc_3();
  2258 	IMPORT_C virtual void Reserved_CWindowGc_4();
  2259 	IMPORT_C virtual void Reserved_CWindowGc_5();
  2260 
  2261 ////=============================================================
  2262 private: // Private code
  2263 	TRgb Color(TInt aOpcode)const;
  2264 	void SetJustification(TInt aExcessWidth,TInt aNumGaps, TInt aOpcode);
  2265 	void DrawArcOrPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd, TInt aOpcode);
  2266 	void doDrawPolyLine(const CArrayFix<TPoint> *aPointArray, const TPoint* aPointList,TInt aNumPoints);
  2267 	TInt doDrawPolygon(const CArrayFix<TPoint> *aPointArray,const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule);
  2268 	void WriteTextPos(TInt aOpcode,TInt aOpcodePtr,const TPoint &aPos,const TDesC &aBuf) const;
  2269 	void WriteTextCommand(TAny *aCmd, TInt aLen,const TDesC &aBuf,TInt aOpcode,TInt aOpcodePtr) const;
  2270 	void WriteTextCommand(TAny *aCmd, TInt aLen,const TDesC8 &aBuf,TInt aOpcode,TInt aOpcodePtr) const;
  2271 	void APIExGetUnderlineMetrics(TAny*& aOutput);
  2272 	TInt APIExSetShadowColor(TAny* aShadowColor);
  2273 
  2274 private: // Private data
  2275 	CFbsFont *iFont;
  2276 	CWsScreenDevice *iDevice;
  2277 	};
  2278 
  2279 
  2280 class CWsScreenDevice : public CBitmapDevice, public MWsClientClass
  2281 /** Software device screen.
  2282 
  2283 An object of this class can be used to enquire or set parameters of the software
  2284 screen, and determine the physical limits of the device.
  2285 
  2286 CWsScreenDevice gives access to the list of screen modes. These are the combinations
  2287 of screen rotation and screen size supported by the device. One of them is
  2288 selected as the current screen mode. The possible screen modes are initialised
  2289 in wsini.ini.
  2290 
  2291 @publishedAll
  2292 @released
  2293 @see CFbsScreenDevice */
  2294 	{
  2295 public:
  2296 	/**	Whether or not to include sprites when comparing areas of the screen*/
  2297 	enum TSpriteInCompare
  2298 		{
  2299 		/** This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
  2300 		const TRect &aRect2,TUint aFlags).
  2301 		When called with the value ERemoveSprite if there are any sprites visible in the areas of the screen being compared then these
  2302 		will not be included in the comparison.
  2303 		The function CWsScreenDevice::RectCompare(const TRect &aRect1,const TRect &aRect2) will not include
  2304 		sprites in the comparison.
  2305 		*/
  2306 		ERemoveSprite=0,
  2307 		/**	This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
  2308 		const TRect &aRect2,TUint aFlags).
  2309 		When called with the value EIncludeSprite if there are any sprites visible in the areas of the screen being compared then these
  2310 		will be included in the comparison.*/
  2311 		EIncludeSprite=1,
  2312 		/**	This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
  2313 		const TRect &aRect2,TUint aFlags). 
  2314 		When called with the value EIncludeTextCursor if there are any text cursors visible in the areas of the screen being compared then these 
  2315 		will be included in the comparison.*/
  2316 		EIncludeTextCursor=2
  2317 		};
  2318 public:
  2319 	IMPORT_C CWsScreenDevice();
  2320 	IMPORT_C CWsScreenDevice(RWsSession &aWs);
  2321 	IMPORT_C ~CWsScreenDevice();
  2322 	IMPORT_C TInt Construct();
  2323 	IMPORT_C TInt Construct( TInt aDefaultScreenNumber ) ;
  2324 //==== From CGraphicsDevice ====//
  2325 	IMPORT_C TDisplayMode DisplayMode() const;
  2326 	IMPORT_C TSize SizeInPixels() const;
  2327 	IMPORT_C TSize SizeInTwips() const;
  2328 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
  2329 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
  2330 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
  2331 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
  2332 	IMPORT_C TRect PointerRect() const;
  2333 	IMPORT_C TInt CreateContext(CGraphicsContext *&aGc);
  2334 	inline TInt CreateContext(CWindowGc*& aGc);
  2335 	IMPORT_C virtual TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec);
  2336 	IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec);
  2337 	IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec,TInt aMaxHeight);
  2338 	IMPORT_C TInt NumTypefaces() const;
  2339 	IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const;
  2340 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;
  2341 // ==== From CBitmapDevice ====//
  2342 	IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPixel) const;
  2343 	IMPORT_C void GetScanLine(TDes8& aScanLine,const TPoint& aStartPixel,TInt aPixelLength, TDisplayMode aDispMode) const;
  2344 	IMPORT_C TInt AddFile(const TDesC& aName,TInt& aId);
  2345 	IMPORT_C void RemoveFile(TInt aId=0);
  2346 	IMPORT_C virtual TInt GetNearestFontInPixels(CFont*& aFont,const TFontSpec& aFontSpec);
  2347 	IMPORT_C virtual TInt GetNearestFontToDesignHeightInPixels(CFont*& aFont,const TFontSpec& aFontSpec);
  2348 	IMPORT_C virtual TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont,const TFontSpec& aFontSpec,TInt aMaxHeight);
  2349 	IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;
  2350 	IMPORT_C void ReleaseFont(CFont* aFont);
  2351 //===== From CFbsScreenDevice ====//
  2352 	IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
  2353 	IMPORT_C void SetPalette(CPalette* aPalette);
  2354 	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
  2355 //===== Extra functions ====//
  2356 	IMPORT_C TInt SetCustomPalette(const CPalette* aPalette);
  2357 	IMPORT_C TInt GetFontById(CFont*& aFont,TUid aUid,const TAlgStyle& aAlgStyle);
  2358 	IMPORT_C TBool RectCompare(const TRect &aRect1,const TRect &aRect2);
  2359 	IMPORT_C TBool RectCompare(const TRect& aRect1,const TRect &aRect2,TUint aFlags) const;
  2360 	IMPORT_C TInt CopyScreenToBitmap(const CFbsBitmap *aBitmap) const;
  2361 	IMPORT_C TInt CopyScreenToBitmap(const CFbsBitmap *aBitmap, const TRect &aRect) const;
  2362 	IMPORT_C TInt SetBackLight(TBool aBackLight);
  2363 //===== Screen Rotation functions ====//
  2364 	IMPORT_C void SetScreenSizeAndRotation(const TPixelsTwipsAndRotation &aSizeAndRotation);
  2365 	IMPORT_C void GetDefaultScreenSizeAndRotation(TPixelsTwipsAndRotation &aSizeAndRotation) const;
  2366 	IMPORT_C void SetScreenSizeAndRotation(const TPixelsAndRotation &aSizeAndRotation);
  2367 	IMPORT_C void GetDefaultScreenSizeAndRotation(TPixelsAndRotation &aSizeAndRotation) const;
  2368 	IMPORT_C TScreenModeEnforcement ScreenModeEnforcement() const;
  2369 	IMPORT_C void SetScreenModeEnforcement(TScreenModeEnforcement aMode) const;
  2370 	IMPORT_C void GetScreenModeSizeAndRotation(TInt aMode, TPixelsTwipsAndRotation &aSizeAndRotation) const;
  2371 	IMPORT_C void GetScreenModeSizeAndRotation(TInt aMode, TPixelsAndRotation &aSizeAndRotation) const;
  2372 	IMPORT_C void SetCurrentRotations(TInt aMode, CFbsBitGc::TGraphicsOrientation aRotation) const;
  2373 	IMPORT_C TInt GetRotationsList(TInt aMode, CArrayFixFlat<TInt> *aRotationList) const;
  2374 	IMPORT_C TInt NumScreenModes() const;
  2375 	IMPORT_C void SetScreenMode(TInt aMode);
  2376 	IMPORT_C TInt CurrentScreenMode() const;
  2377 	IMPORT_C void SetAppScreenMode(TInt aMode);
  2378 	IMPORT_C TPoint GetDefaultScreenModeOrigin() const;
  2379 	IMPORT_C TPoint GetScreenModeOrigin(TInt aMode) const;
  2380 	IMPORT_C TSize GetCurrentScreenModeScale() const;
  2381 	IMPORT_C TSize GetScreenModeScale(TInt aMode) const;
  2382 	IMPORT_C TPoint GetCurrentScreenModeScaledOrigin() const;
  2383 	IMPORT_C TPoint GetScreenModeScaledOrigin(TInt aMode) const;
  2384 	IMPORT_C TInt GetScreenSizeModeList(RArray<TInt>* aModeList);
  2385 	IMPORT_C TDisplayMode GetScreenModeDisplayMode(const TInt &aMode) const;
  2386 //===== Used for testing purpose only ====//
  2387 	IMPORT_C TSizeMode GetCurrentScreenModeAttributes() const;
  2388 	IMPORT_C void SetCurrentScreenModeAttributes(const TSizeMode &aModeAtt);
  2389 	IMPORT_C TInt GetScreenNumber() const;
  2390 private: // Private data
  2391 	CFbsTypefaceStore* iTypefaceStore;
  2392 	TSize iPhysicalScreenSizeInTwips;
  2393 	TSize iDisplaySizeInPixels;
  2394 	friend class CWindowGc;
  2395 	};
  2396 
  2397 
  2398 class RWsSpriteBase : public MWsClientClass
  2399 // Client side class base class for sprites and pointer cursors
  2400 /** Sprite base class.
  2401 
  2402 Unless stated otherwise, references to sprites in the documentation for this class also
  2403 apply to pointer cursors.
  2404 
  2405 @publishedAll
  2406 @released
  2407 @see RWsSprite
  2408 @see RWsPointerCursor */
  2409 	{
  2410 protected:
  2411 	IMPORT_C RWsSpriteBase();
  2412 	IMPORT_C RWsSpriteBase(RWsSession &aWs);
  2413 public:
  2414 	IMPORT_C TInt Activate();
  2415 	IMPORT_C TInt AppendMember(const TSpriteMember &aMemberData);
  2416 	IMPORT_C void UpdateMember(TInt aIndex);
  2417 	IMPORT_C TInt UpdateMember(TInt aIndex, const TSpriteMember &aMemberData);
  2418 	IMPORT_C void Close();
  2419 	};
  2420 
  2421 
  2422 class RWsSprite : public RWsSpriteBase
  2423 /** Sprite.
  2424 
  2425 This class defines functions to create and initialise a sprite, and to set
  2426 its position.
  2427 
  2428 @publishedAll
  2429 @released */
  2430 	{
  2431 public:
  2432 	IMPORT_C RWsSprite();
  2433 	IMPORT_C RWsSprite(RWsSession &aWs);
  2434 	IMPORT_C TInt Construct(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aFlags);
  2435 	IMPORT_C void SetPosition(const TPoint &aPos);
  2436 	};
  2437 
  2438 
  2439 class RWsPointerCursor : public RWsSpriteBase
  2440 /** Pointer cursor.
  2441 
  2442 The pointer cursor is created in a similar way to a sprite. After creating it,
  2443 one or more sprite members containing the bitmaps to be displayed are added.
  2444 
  2445 After a pointer cursor has been created and activated, it does not become
  2446 visible until the application calls RWindowTreeNode::SetPointerCursor() or
  2447 RWindowTreeNode::SetCustomPointerCursor(). The pointer cursor's origin automatically
  2448 tracks the position of the pointing device, and the origin forms the pointer
  2449 cursor's "hot spot", i.e., the point whose co-ordinates are sent to the client
  2450 if a pointer event occurs. If the pointer cursor's bitmap needs to extend
  2451 to the left or upwards from the pointer position, its sprite member should
  2452 be given a negative offset in TSpriteMember::iOffset.
  2453 
  2454 Note:
  2455 
  2456 Pointer cursors are rarely used in pure pen architectures, but they are supported
  2457 for mouse or tablet use.
  2458 
  2459 @publishedAll
  2460 @released */
  2461 	{
  2462 public:
  2463 	IMPORT_C RWsPointerCursor();
  2464 	IMPORT_C RWsPointerCursor(RWsSession &aWs);
  2465 	IMPORT_C TInt Construct(TInt aFlags);
  2466 	};
  2467 
  2468 
  2469 class RAnim;
  2470 
  2471 
  2472 class RAnimDll : public MWsClientClass
  2473 /** Client-side interface to the server-side animation DLL.
  2474 
  2475 This is the client side class matching the server side CAnimDLL class. It
  2476 provides functions to create, load, close and destroy a server-side CAnimDll
  2477 object.
  2478 
  2479 @publishedAll
  2480 @released
  2481 @see CreateCAnimDllL()
  2482 @see CAnimDll */
  2483 	{
  2484 public:
  2485 	IMPORT_C RAnimDll();
  2486 	IMPORT_C virtual ~RAnimDll();
  2487 	IMPORT_C RAnimDll(RWsSession &aWs);
  2488 	IMPORT_C TInt Load(const TDesC &aFileName);
  2489 	IMPORT_C void Destroy();
  2490 	IMPORT_C virtual void Close();
  2491 private:
  2492 	TInt CommandReply(TInt aHandle, TInt aOpcode, const TIpcArgs* aIpcArgs=NULL);
  2493 	TInt CommandReply(TInt aHandle, TInt aOpcode, const TDesC8& aArgs, const TIpcArgs* aIpcArgs=NULL);
  2494 	void Command(TInt aHandle, TInt aOpcode, const TPtrC8 &aArgs);
  2495 	void Command(TInt aHandle, TInt aOpcode);
  2496 	void AsyncCommandReply(TRequestStatus& aStatus, TInt aOpcode, TIpcArgs& aIpcArgs);
  2497 	TInt CreateInstance(TInt32& aHandle, const MWsClientClass &aDevice, TInt aType, const TDesC8 &aArgs, TInt aOpcode, const TIpcArgs* aIpcArgs);
  2498 	void DestroyInstance(TInt aHandle);
  2499 private:
  2500 	friend class RAnim;
  2501 	};
  2502 
  2503 
  2504 class RAnim
  2505 /** Client-side handle to a server-side animation class.
  2506 
  2507 This class should be sub-classed to provide a client side interface to the
  2508 server side animation DLL. The server side animation DLL is derived from CAnim.
  2509 
  2510 @publishedAll
  2511 @released */
  2512 	{
  2513 public:
  2514 	IMPORT_C virtual ~RAnim();
  2515 	IMPORT_C virtual void Close();
  2516 	IMPORT_C void Destroy();
  2517 protected:
  2518 	IMPORT_C RAnim();
  2519 	IMPORT_C RAnim(RAnimDll &aDll);
  2520 	IMPORT_C TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams);
  2521 	IMPORT_C TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
  2522 	IMPORT_C TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams);
  2523 	IMPORT_C TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
  2524 	IMPORT_C TInt CommandReply(TInt aOpcode);
  2525 	IMPORT_C TInt CommandReply(TInt aOpcode, const TPtrC8 &aArgs);
  2526 	IMPORT_C TInt CommandReply(TInt aOpcode, const TDesC8& aArgs, const TIpcArgs& aIpcArgs);
  2527 	IMPORT_C void Command(TInt aOpcode, const TPtrC8 &aArgs);
  2528 	IMPORT_C void Command(TInt aOpcode);
  2529 	IMPORT_C void AsyncCommandReply(TRequestStatus& aRequestStatus,TInt aOpcode, const TIpcArgs& aIpcArgs);
  2530 private:
  2531 	TInt32 iHandle;
  2532 	RAnimDll *iAnimDll;
  2533 	};
  2534 
  2535 class CDsaMsgQueue;
  2536 
  2537 class RDirectScreenAccess : public MWsClientClass
  2538 /** The interface between an application that directly accesses the screen and
  2539 the window server.
  2540 
  2541 Note that most applications that need to access the screen directly should
  2542 use CDirectScreenAccess instead. RDirectScreenAccess only needs to be used
  2543 directly by applications without access to an active scheduler.
  2544 
  2545 @publishedAll
  2546 @released */
  2547 	{
  2548 public:
  2549 	/** Provides the reason why direct screen access must terminate. This enum is used
  2550 	in the MAbortDirectScreenAccess::AbortNow() and MDirectScreenAccess::Restart()
  2551 	functions.
  2552 
  2553 	The first value (ETerminateCancel) indicates that direct screen access is
  2554 	being terminated by the application. The final three values indicate that
  2555 	direct screen access is being terminated by the window server. Note that
  2556 	for users of CDirectScreenAccess, the termination code is not important
  2557 	because these issues are dealt with by CDirectScreenAccess::StartL(). */
  2558 	enum TTerminationReasons
  2559 		{
  2560 		/** The application has finished direct screen access. */
  2561 		ETerminateCancel,
  2562 		/** A window is about to come in front of a part of the area that is being used
  2563 		for direct screen access. */
  2564 		ETerminateRegion,
  2565 		/** The screen's color depth (as enumerated by TDisplayMode) is about to change. */
  2566 		ETerminateScreenMode,
  2567 		/** The current screen mode (the combination of screen rotation and screen size)
  2568 		is about to change. */
  2569 		ETerminateRotation,
  2570 		};
  2571 	/** The priority of the active object that responds to notification that direct
  2572 	screen access must stop. */
  2573 	enum TPriority
  2574 		{
  2575 		/** A suggested value for the priority of the active object that responds to notification
  2576 		from the window server that direct screen access must stop. This is also the
  2577 		value used by CDirectScreenAccess for this purpose. */
  2578 		EPriorityVeryHigh=2000,
  2579 		};
  2580 public:
  2581 	IMPORT_C RDirectScreenAccess();
  2582 	IMPORT_C RDirectScreenAccess(RWsSession& aWs);
  2583 	IMPORT_C TInt Construct();
  2584 	IMPORT_C TInt Request(RRegion*& aRegion,TRequestStatus& aStatus,const RWindowBase& aWindow);
  2585 	IMPORT_C void Completed();
  2586 	IMPORT_C void Cancel();
  2587 	IMPORT_C void Close();
  2588 private:
  2589 	RWsSession* iWs;
  2590 	CDsaMsgQueue* iMsgQueue;
  2591 	// To maintain BC we need the following
  2592 	RThread iWsThread;
  2593 	TRequestStatus* iDummyRequest;
  2594 	};
  2595 
  2596 
  2597 class MAbortDirectScreenAccess
  2598 /** The interface for terminating direct screen access.
  2599 
  2600 An object of a class which implements this interface should be passed to CDirectScreenAccess::NewL().
  2601 
  2602 @publishedAll
  2603 @released
  2604 @see MDirectScreenAccess */
  2605 	{
  2606 public:
  2607 	/** This function is called by the window server when direct screen access must
  2608 	stop (for example because a dialogue is moved in front of the area where direct
  2609 	screen access is taking place).
  2610 
  2611 	In response to this, direct screen access must stop immediately. In simple cases,
  2612 	this will involve cancelling the active object that is driving the drawing to the
  2613 	screen.
  2614 
  2615 	No attempt to call a Window Server API function can be made from
  2616 	AbortNow(), because then a temporary deadlock will occur. This is because WSERV
  2617 	is waiting to receive the client's acknowledgment that it has aborted, and so will
  2618 	not be able to service the call. As soon as the restriction no longer applies,
  2619 	the function Restart() will be called.
  2620 
  2621 	@param aReason The reason why direct screen access was terminated. */
  2622 	virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason)=0;
  2623 	};
  2624 
  2625 
  2626 class MDirectScreenAccess : public MAbortDirectScreenAccess
  2627 /** The interface for restarting direct screen access.
  2628 
  2629 The Restart() function is called by the window server as soon as direct screen
  2630 access can resume. It is called after the window server has called AbortNow().
  2631 
  2632 An object of the derived class is passed to CDirectScreenAccess::NewL().
  2633 
  2634 @publishedAll
  2635 @released
  2636 @see CDirectScreenAccess::NewL() */
  2637 	{
  2638 public:
  2639 	/** This function is called by the window server as soon as direct screen access
  2640 	can resume.
  2641 
  2642 	This function should call CDirectScreenAccess::StartL() within a trap harness.
  2643 	If this leaves, e.g. through lack of memory, direct screen access cannot be
  2644 	restarted. StartL() re-calculates the clipping region, so that if direct screen
  2645 	access was aborted because another window appeared in front of it, that window
  2646 	will not be overwritten when direct screen access resumes.
  2647 
  2648 	In this function, you can resume calls to Window Server Client Side API functions.
  2649 
  2650 	@param aReason Provides the reason why direct screen access was terminated. */
  2651 	virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason)=0;
  2652 	};
  2653 
  2654 
  2655 class CDirectScreenAccess : public CActive
  2656 /** An active object used to start direct screen access.
  2657 
  2658 Direct screen access is a way of drawing to the screen without using the window
  2659 server. As this avoids client-server communication, it is much faster, and
  2660 may be useful for games and video. Note that some interaction with the window
  2661 server is needed in order to prevent the application from drawing over other
  2662 application's data.
  2663 
  2664 The object's (private) RunL() function is called by the window server in order
  2665 to abort direct screen access. This might occur when another window needs
  2666 to be displayed in front or when the window with direct screen access is moved.
  2667 The active object's priority is RDirectScreenAccess::EPriorityVeryHigh so
  2668 that direct screen access will be aborted as quickly as possible.
  2669 
  2670 @publishedAll
  2671 @released */
  2672 	{
  2673 public:
  2674 	IMPORT_C static CDirectScreenAccess* NewL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWin,MDirectScreenAccess& aAbort);
  2675 	~CDirectScreenAccess();
  2676 	IMPORT_C void StartL();
  2677 	inline CFbsBitGc* Gc();
  2678 	inline CFbsScreenDevice*& ScreenDevice();
  2679 	inline RRegion* DrawingRegion();
  2680 private:
  2681 	enum TFlags
  2682 		{
  2683 		EDirectCheckModeChange=0x1,
  2684 		EDirectCheckSizeModeChange=0x2,
  2685 		};
  2686 private:
  2687 	inline CDirectScreenAccess(RWsSession& aWs,CWsScreenDevice* aScreenDevice,RWindowBase& aWindow,MDirectScreenAccess& aAbort);
  2688 	void ConstructL(RWsSession& aWs);
  2689 	void CreateScreenObjectsL(TDisplayMode aCurrentMode);
  2690 	void UpdateSizeAndRotation(CFbsBitGc* aGc);
  2691 	static TInt Restart(TAny* aDirect);
  2692 	void Restart();
  2693 	//Pure virtual functions from CActive
  2694 	void DoCancel();
  2695 	void RunL();
  2696 private:
  2697 	CFbsBitGc* iGc;
  2698 	CFbsScreenDevice* iScreenDevice;
  2699 	RRegion* iDrawingRegion;
  2700 	RWindowBase& iWindow;
  2701 	CWsScreenDevice* iWsScreenDevice;
  2702 	MDirectScreenAccess& iAbort;
  2703 	RDirectScreenAccess iDirectAccess;
  2704 	RDirectScreenAccess::TTerminationReasons iReason;
  2705 	CIdle* iRestart;
  2706 	TSize iScreenSize;
  2707 	TBool iAborting;
  2708 	TUint iFlags;
  2709 	TInt iScreenNumber;
  2710 	};
  2711 
  2712 
  2713 class RSoundPlugIn : public MWsClientClass
  2714 /** Client interface to the key or pointer click plug-in DLL.
  2715 
  2716 The plug-in DLL implements the CClickMaker class.
  2717 
  2718 @publishedAll
  2719 @released
  2720 @see CClickMaker */
  2721 	{
  2722 public:
  2723 	/** A possible return value for CommandReply(). */
  2724 	enum
  2725 		{
  2726 		/** The value returned by CommandReply() if no plug-in is loaded,
  2727 		or if the plug-in identified by the aUid parameter in Construct() is not loaded.
  2728 		Its value is set to KMinTInt so that it should not clash with any other expected
  2729 		return value from this function. */
  2730 		ESoundWrongPlugIn=KMinTInt
  2731 		};
  2732 public:
  2733 	IMPORT_C RSoundPlugIn();
  2734 	IMPORT_C RSoundPlugIn(RWsSession &aWs);
  2735 	IMPORT_C TInt Construct(TUid aUid=KNullUid);
  2736 	IMPORT_C void Close();
  2737 	IMPORT_C void Destroy();
  2738 	IMPORT_C TBool IsLoaded(TBool& aIsChangeable);
  2739 	IMPORT_C TInt Unload();
  2740 	IMPORT_C TInt Load(const TDesC &aFileName);
  2741 	IMPORT_C void SetKeyClick(TBool aEnabled);
  2742 	IMPORT_C void SetPenClick(TBool aEnabled);
  2743 	IMPORT_C TBool KeyClickEnabled();
  2744 	IMPORT_C TBool PenClickEnabled();
  2745 	IMPORT_C TInt CommandReply(TInt aOpcode, const TPtrC8 &aArgs);
  2746 	};
  2747 
  2748 inline TInt MWsClientClass::WsHandle() const
  2749 	/** Gets the server side handle for the object.
  2750 
  2751 	@return The server-side handle for the object. */
  2752 	{return(iWsHandle);}
  2753 
  2754 inline TInt CWsScreenDevice::CreateContext(CWindowGc *&aGc)
  2755 	/** Creates a graphics context for this device.
  2756 
  2757 	This function always causes a flush of the window server buffer.
  2758 
  2759 	@param aGc On successful return, contains a new graphics context referring
  2760 	to this screen device.
  2761 	@return KErrNone if successful, otherwise one of the system-wide error codes.
  2762 	@see CGraphicsDevice::CreateContext() */
  2763 	{return(CreateContext((CGraphicsContext *&)aGc));}
  2764 
  2765 inline TUint TWsRedrawEvent::Handle() const
  2766 	/** Gets the handle of the window which is the target of the redraw event.
  2767 
  2768 	This is the handle that was passed to the window's Construct() function: typically
  2769 	it will be a pointer to the object owning the window, providing access to
  2770 	its member functions.
  2771 
  2772 	@return The window's handle. */
  2773 	{return(iHandle);}
  2774 
  2775 inline TRect TWsRedrawEvent::Rect() const
  2776 	/** Gets the rectangle to redraw.
  2777 
  2778 	@return The rectangle that needs redrawing. Co-ordinates are relative to
  2779 	the window whose handle is given by Handle(). */
  2780 	{return(iRect);}
  2781 
  2782 inline TPointerEvent *TWsEvent::Pointer() const
  2783 	/** Gets the pointer event.
  2784 
  2785 	This function can be used to get information about the pointer event if Type()
  2786 	returns an event of type EEventPointer. or EEventDragDrop.
  2787 
  2788 	@return Structure containing pointer event data. */
  2789 	{return((TPointerEvent *)&iEventData);}
  2790 
  2791 inline TKeyEvent *TWsEvent::Key() const
  2792 	/** Gets the key event.
  2793 
  2794 	This function can be used to get information about the key event if Type()
  2795 	returns an event of type EEventKey, EEventKeyUp or EEventKeyDown.
  2796 
  2797 	@return Structure containing key event data */
  2798 	{return((TKeyEvent *)&iEventData);}
  2799 
  2800 inline TWsVisibilityChangedEvent* TWsEvent::VisibilityChanged()
  2801 	/** Gets information about the visibility changed event.
  2802 
  2803 	This function can be used to get information about the visibility changed event
  2804 	if Type() returns an event of type EEventWindowVisibilityChanged.
  2805 
  2806 	@return Structure containing visibility changed event data */
  2807 	{ return reinterpret_cast<TWsVisibilityChangedEvent*>(iEventData); }
  2808 
  2809 inline const TWsVisibilityChangedEvent* TWsEvent::VisibilityChanged() const
  2810 	/** Gets information about the visibility changed event.
  2811 
  2812 	This function can be used to get information about the visibility changed event
  2813 	if Type() returns an event of type EEventWindowVisibilityChanged.
  2814 
  2815 	@return Structure containing visibility changed event data */
  2816 	{ return reinterpret_cast<const TWsVisibilityChangedEvent*>(iEventData); }
  2817 
  2818 inline TModifiersChangedEvent *TWsEvent::ModifiersChanged() const
  2819 	/** Gets information about the modifier changed event.
  2820 
  2821 	This function can be used to get information about the modifier changed event
  2822 	if Type() returns an event of type EEventModifiersChanged.
  2823 
  2824 	@return Structure containing modifier changed event data */
  2825 	{return((TModifiersChangedEvent *)&iEventData);}
  2826 
  2827 inline TWsErrorMessage *TWsEvent::ErrorMessage() const
  2828 	/** Gets an error event.
  2829 
  2830 	This function can be used to get information about the error event if Type()
  2831 	returns an event of type EEventErrorMessage.
  2832 
  2833 	@return The error event. */
  2834 	{return((TWsErrorMessage *)&iEventData);}
  2835 
  2836 inline TUint8 *TWsEvent::EventData() const
  2837 	/** Gets information about the event.
  2838 
  2839 	This function gives you direct access to the event data as a whole. The event
  2840 	can be a key or pointer event or it could be a new special event that only
  2841 	you and another application know about. You are limited to EWsEventDataSize
  2842 	bytes worth of data.
  2843 
  2844 	@return A pointer to the event data. */
  2845 	{return((TUint8 *)&iEventData);}
  2846 
  2847 inline TInt TWsEvent::Type() const
  2848 	/** Gets the type of event that occurred.
  2849 
  2850 	@return The event type. Event types are defined in TEventCode. */
  2851 	{return(iType);}
  2852 
  2853 inline TUint TWsEvent::Handle() const
  2854 	/** Gets the window handle.
  2855 
  2856 	This is the handle that was passed to the window's Construct() function: typically
  2857 	it will be a pointer to the client-side object owning the window, providing
  2858 	access to its member functions.
  2859 
  2860 	@return The window handle. */
  2861 	{return(iHandle);}
  2862 
  2863 inline TTime TWsEvent::Time() const
  2864 	/** Gets the time when the event occurred.
  2865 
  2866 	@return The time when the event occurred. */
  2867 	{return(iTime);}
  2868 
  2869 inline void TWsEvent::SetType(TInt aType)
  2870 	/** Sets the event type.
  2871 
  2872 	@param aType The event type. Event types are defined in TEventCode. */
  2873 	{iType=aType;}
  2874 
  2875 inline void TWsEvent::SetHandle(TUint aHandle)
  2876 	/** Sets the event handle.
  2877 
  2878 	This is the client handle of the window that is being sent the event.
  2879 
  2880 	@param aHandle The event handle. */
  2881 	{iHandle=aHandle;}
  2882 
  2883 inline void TWsEvent::SetTimeNow()
  2884 	/** Sets the event time to the current time. */
  2885 	{iTime.UniversalTime();}
  2886 
  2887 inline TInt *TWsEvent::Int() const
  2888 	/** Gets the event data as a TInt.*/
  2889 	{ return (TInt*)&iEventData; }
  2890 
  2891 inline TUint TWsPriorityKeyEvent::Handle() const
  2892 	/** Gets the handle for the window group which added the priority key.
  2893 
  2894 	This is the handle that was passed to the window group's Construct() function.
  2895 	Since most applications have only one window group, however, this function
  2896 	is rarely used.
  2897 
  2898 	@return The window group handle. */
  2899 	{return(iHandle);}
  2900 
  2901 inline TKeyEvent *TWsPriorityKeyEvent::Key() const
  2902 	/** Gets the priority key event.
  2903 
  2904 	@return Structure containing priority key event data */
  2905 	{return((TKeyEvent *)&iEventData);}
  2906 
  2907 inline void TWsPriorityKeyEvent::SetHandle(TUint aHandle)
  2908 	/** Sets the window group event handle.
  2909 
  2910 	This is the client handle of the window that is being sent the event.
  2911 
  2912 	@param aHandle The event handle. */
  2913 	{iHandle=aHandle;}
  2914 
  2915 inline CDirectScreenAccess::CDirectScreenAccess(RWsSession& aWs,CWsScreenDevice* aScreenDevice,RWindowBase& aWindow,MDirectScreenAccess& aAbort)
  2916 		:CActive(RDirectScreenAccess::EPriorityVeryHigh), iWindow(aWindow), iAbort(aAbort), iDirectAccess(aWs)
  2917 		{iWsScreenDevice=aScreenDevice;}
  2918 
  2919 inline CFbsBitGc* CDirectScreenAccess::Gc()
  2920 	/** Gets the graphics context for drawing to the screen.
  2921 
  2922 	This is set up by calling StartL(). Its origin is set so that you should use
  2923 	window coordinates to specify which part of the screen to draw to and its
  2924 	clipping region is set to the visible part of the window.
  2925 
  2926 	Code built to run on the Emulator must call CFbsScreenDevice::Update() in
  2927 	order to see the results of drawing to this graphics context, but this may
  2928 	not be required on all target hardware.
  2929 
  2930 	@return The graphics context for drawing to the screen. */
  2931 	{ return iGc; }
  2932 
  2933 inline CFbsScreenDevice*& CDirectScreenAccess::ScreenDevice()
  2934 	/** Gets the screen device to draw to.
  2935 
  2936 	You should not use this screen device to create fonts because the object is
  2937 	deleted and recreated when direct screen access is aborted and restarted.
  2938 	Instead, create and use your own CFbsScreenDevice object to create fonts.
  2939 
  2940 	@return The target screen device. */
  2941 	{ return iScreenDevice; }
  2942 
  2943 inline RRegion* CDirectScreenAccess::DrawingRegion()
  2944 	/** Gets the clipping region to draw to.
  2945 
  2946 	You must not draw outside of this region.
  2947 
  2948 	The clipping region is calculated when StartL() is called, and is only updated
  2949 	if StartL() is called again.
  2950 
  2951 	The region is specified in screen coordinates. This can be useful if you need
  2952 	to reapply the clipping region to the graphics context (CFbsBitGc::SetClippingRegion()).
  2953 
  2954 	@return The clipping region to draw to. */
  2955 	{ return iDrawingRegion; }
  2956 
  2957 inline TSizeMode::TSizeMode(TSize& aSize) :
  2958 	iOrigin(0, 0), iScreenSize(aSize)
  2959 	{}
  2960 
  2961 inline TInt TSizeMode::ScaledCord(TInt aOrigin,TInt aScale)
  2962 	{return (aOrigin+aScale-1)/aScale;}
  2963 
  2964 inline TPoint TSizeMode::ScaledOrigin()
  2965 	{return TPoint(ScaledCord(iOrigin.iX,iScreenScale.iWidth),ScaledCord(iOrigin.iY,iScreenScale.iHeight));}
  2966 
  2967 #endif