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