windowing/windowserver/nonnga/CLIENT/RWINDOW.CPP
changeset 0 5d03bc08d59c
child 4 15986eb6c500
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 // Shells for window server window functions.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32std.h>
       
    19 #include "../SERVER/w32cmd.h"
       
    20 #include "CLIENT.H"
       
    21 #include "w32comm.h"
       
    22 
       
    23 RWindowTreeNode::RWindowTreeNode()
       
    24 /** Protected default constructor.
       
    25 
       
    26 This creates a sessionless, uninitialised window tree node handle. This class 
       
    27 is not for user derivation; however derived classes form part of the Window 
       
    28 Server API.
       
    29 
       
    30 Because RWindowTreeNode and its derived classes are lightweight handles, if 
       
    31 your class contains an object of such a class, the object should be an inline 
       
    32 member rather than a pointer member.
       
    33 
       
    34 This default constructor allows you to instantiate such an inline member before 
       
    35 the class that contains it has created a window server session. If you do this, 
       
    36 you will need to call the RWindowTreeNode constructor that takes an RWsSession 
       
    37 parameter before you can use the member, because RWindowTreeNode-derived objects 
       
    38 must have a reference to a window server session in order to be valid. */
       
    39 	{}
       
    40 
       
    41 RWindowTreeNode::RWindowTreeNode(RWsSession &aWs) : MWsClientClass(aWs.iBuffer)
       
    42 /** Protected constructor which creates an uninitialised window tree node handle 
       
    43 within a server session. 
       
    44 
       
    45 This class is not for user derivation; however derived classes form part of 
       
    46 the standard Window Server API, and are constructed with a public 
       
    47 constructor with the same signature as this one.
       
    48 
       
    49 @param aWs Window server session. */
       
    50 	{}
       
    51 
       
    52 RWindowBase::RWindowBase() : RWindowTreeNode()
       
    53 /** Protected default constructor; creates an uninitialised, sessionless window 
       
    54 handle.
       
    55 
       
    56 Handles to server-side objects must be created in a session in order to be 
       
    57 operational; this constructor is merely a convenience to allow the handle 
       
    58 to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for 
       
    59 details of how the complete setup of a handle field may be deferred until 
       
    60 the window server session is known. */
       
    61 	{}
       
    62 
       
    63 RWindowBase::RWindowBase(RWsSession &aWs) : RWindowTreeNode(aWs)
       
    64 /** Protected constructor; creates an uninitialised window handle within a session.
       
    65 
       
    66 @param aWs Window server session. */
       
    67 	{}
       
    68 
       
    69 RDrawableWindow::RDrawableWindow() : RWindowBase()
       
    70 /** Protected default constructor which creates a sessionless, uninitialised drawable-window 
       
    71 handle.
       
    72 
       
    73 Handles to server-side objects must be created in a session in order to be 
       
    74 operational; this constructor is merely a convenience to allow the handle 
       
    75 to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for 
       
    76 details of how the complete setup of a handle field may be deferred until 
       
    77 the window server session is known */
       
    78 	{}
       
    79 
       
    80 RDrawableWindow::RDrawableWindow(RWsSession &aWs) : RWindowBase(aWs)
       
    81 /** Protected default constructor which creates an initialised drawable-window 
       
    82 handle within a server session.
       
    83 
       
    84 @param aWs Window server session. */
       
    85 	{}
       
    86 
       
    87 EXPORT_C RWindow::RWindow() : RDrawableWindow()
       
    88 /** Default constructor which creates a sessionless, uninitialised window handle. 
       
    89 
       
    90 Handles to server-side objects must be created in a session in order to be 
       
    91 operational; this constructor is merely a convenience to allow the handle 
       
    92 to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for 
       
    93 details of how the complete setup of a handle field may be deferred until 
       
    94 the window server session is known. */
       
    95 	{}
       
    96 
       
    97 EXPORT_C RWindow::RWindow(RWsSession &aWs) : RDrawableWindow(aWs)
       
    98 /** Constructor which creates an initialised window handle within a server session.
       
    99 
       
   100 @param aWs Window server session to use. */
       
   101 	{}
       
   102 
       
   103 EXPORT_C RBackedUpWindow::RBackedUpWindow() : RDrawableWindow()
       
   104 /** Default C++ constructor which creates a sessionless backed-up window handle.
       
   105 
       
   106 Handles to server-side objects must be created in a session in order to be 
       
   107 operational; this constructor is merely a convenience to allow the handle 
       
   108 to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for 
       
   109 details of how the complete setup of a handle field may be deferred until 
       
   110 the window server session is known. */
       
   111 	{}
       
   112 
       
   113 EXPORT_C RBackedUpWindow::RBackedUpWindow(RWsSession &aWs) : RDrawableWindow(aWs)
       
   114 /** Constructor which creates an uninitialised backed-up window handle within a 
       
   115 session.
       
   116 
       
   117 @param aWs The window server session that owns the window. */
       
   118 	{}
       
   119 
       
   120 EXPORT_C RBlankWindow::RBlankWindow() : RWindowBase()
       
   121 /** Default C++ constructor which creates an invalid blank-window handle. 
       
   122 
       
   123 See RWindowTreeNode::RWindowTreeNode() for details of how the complete setup 
       
   124 of a handle field may be deferred until the window server session is known. */
       
   125 	{}
       
   126 
       
   127 EXPORT_C RBlankWindow::RBlankWindow(RWsSession &aWs) : RWindowBase(aWs)
       
   128 /** Default C++ constructor which creates a valid but uninitialised blank-window 
       
   129 handle. 
       
   130 
       
   131 This constructor does not create a window in the window server: client programs 
       
   132 must do this by calling RBlankWindow::Construct() before any operations can 
       
   133 be carried out on the window.
       
   134 
       
   135 @param aWs The window server session that owns the window. */
       
   136 	{}
       
   137 
       
   138 EXPORT_C RWindowGroup::RWindowGroup() : RWindowTreeNode()
       
   139 /** Creates a sessionless, uninitialised window group handle.
       
   140 
       
   141 Handles to server-side objects must be created in a session in order to be 
       
   142 operational; this constructor is merely a convenience to allow the handle 
       
   143 to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for 
       
   144 details of how the complete setup of a handle field may be deferred until 
       
   145 the window server session is known. */
       
   146 	{}
       
   147 
       
   148 EXPORT_C RWindowGroup::RWindowGroup(RWsSession &aWs) : RWindowTreeNode(aWs)
       
   149 /** Creates an initialised window group handle within a server session.
       
   150 
       
   151 @param aWs The window server session owning the window group. */
       
   152 	{}
       
   153 
       
   154 EXPORT_C void RWindowTreeNode::Close()
       
   155 /** Closes the node. 
       
   156 
       
   157 This function should be called on all windows once they are no longer needed. 
       
   158 It causes the window server to destroy the server-side window, and frees client-side 
       
   159 resources owned by the window.
       
   160 
       
   161 Note: When Close() is called on a parent window, its children are disconnected 
       
   162 from the window tree and are hence removed from the screen. However, any client-side 
       
   163 resources owned by its children are not freed. To free these resources, Close() 
       
   164 (or Destroy()) must be called on all its children individually. */
       
   165 	{
       
   166 	if (iBuffer && iWsHandle)
       
   167 		Write(EWsWinOpFree);
       
   168 	iWsHandle=NULL;
       
   169 	}
       
   170 
       
   171 EXPORT_C void RWindowTreeNode::Destroy()
       
   172 /** Closes and deletes the node. 
       
   173 
       
   174 This function calls Close() followed by delete on the window. Use this function 
       
   175 only when the window is allocated in its own heap cell. */
       
   176 	{
       
   177 	Close();
       
   178 	delete this;
       
   179 	}
       
   180 
       
   181 EXPORT_C TUint32 RWindowTreeNode::ClientHandle() const
       
   182 /** Gets the window's client handle
       
   183 
       
   184 The return value is the client's integer handle that was passed as an argument
       
   185 to the window's Construct() function: see RWindow::Construct()
       
   186 for a description of the client handle.
       
   187 
       
   188 This function always causes a flush of the window server buffer.
       
   189 
       
   190 @return Handle ID for the window.
       
   191 @see RWindow::Construct() */
       
   192 	{
       
   193 	return(WriteReply(EWsWinOpClientHandle));
       
   194 	}
       
   195 
       
   196 EXPORT_C TUint32 RWindowTreeNode::Parent() const
       
   197 /** Gets the node's parent. 
       
   198 
       
   199 The return value is the client's integer handle that was passed as an argument 
       
   200 to the parent window tree node's Construct() function: see RWindow::Construct() 
       
   201 for a description of the client handle.
       
   202 If called on a window group, this function returns 0, as window groups have 
       
   203 no parent.
       
   204  
       
   205 This function always causes a flush of the window server buffer.
       
   206 
       
   207 @return Handle ID for the parent, or zero for window groups. 
       
   208 @see Child() 
       
   209 @see RWindow::Construct() */
       
   210 	{
       
   211 	return(WriteReply(EWsWinOpParent));
       
   212 	}
       
   213 
       
   214 EXPORT_C TUint32 RWindowTreeNode::PrevSibling() const
       
   215 /** Gets the node before this one in the sibling list. 
       
   216 
       
   217 The return value is the client handle that was passed in the previous sibling window's 
       
   218 Construct() function: see RWindow::Construct() for a description of the client handle.
       
   219  
       
   220 This function always causes a flush of the window server buffer.
       
   221 
       
   222 @return Handle ID for the previous sibling, or zero if no previous sibling exists. 
       
   223 @see NextSibling() 
       
   224 @see RWindow::Construct() */
       
   225 	{
       
   226 	return(WriteReply(EWsWinOpPrevSibling));
       
   227 	}
       
   228 
       
   229 EXPORT_C TUint32 RWindowTreeNode::NextSibling() const
       
   230 /** Gets the next window after this one in its sibling list. 
       
   231 
       
   232 The return value is the client handle that was passed in the next sibling 
       
   233 window's Construct() function: see RWindow::Construct() for a description of the 
       
   234 client handle.
       
   235  
       
   236 This function always causes a flush of the window server buffer.
       
   237 
       
   238 @return Window handle of next sibling, or 0 if no next sibling exists. 
       
   239 @see PrevSibling()
       
   240 @see Child()
       
   241 @see Parent() */
       
   242 	{
       
   243 	return(WriteReply(EWsWinOpNextSibling));
       
   244 	}
       
   245 
       
   246 EXPORT_C TUint32 RWindowTreeNode::Child() const
       
   247 /** Gets the first child of the node.
       
   248  
       
   249 This function always causes a flush of the window server buffer.
       
   250 
       
   251 @return The client handle of the child node that currently has ordinal position 
       
   252 0. This is 0 if there isn't a child. */
       
   253 	{
       
   254 	return(WriteReply(EWsWinOpChild));
       
   255 	}
       
   256 
       
   257 EXPORT_C void RWindowTreeNode::__DbgTestInvariant() const
       
   258 /** In debug builds, this function always causes a flush of the window 
       
   259 server buffer. */
       
   260 	{
       
   261 #if defined(_DEBUG)
       
   262 	if (WriteReply(EWsWinOpTestInvariant))
       
   263 		User::Invariant();
       
   264 #endif
       
   265 	}
       
   266 
       
   267 EXPORT_C void RWindowTreeNode::SetOrdinalPosition(TInt aPos)
       
   268 /** Sets the ordinal position of a window. 
       
   269 
       
   270 A window's ordinal position is relative to its siblings with the same 
       
   271 ordinal priority. The ordinal priority of displayable windows (in other words, 
       
   272 not window groups) is almost always zero (the default). To set the ordinal priority 
       
   273 as well as the ordinal position, use the other overload of this function. 
       
   274 
       
   275 The lower the ordinal position, the nearer the window will be to the front of the z-order. 
       
   276 The frontmost window has ordinal position zero. Specifying a negative value has the effect 
       
   277 of sending the window to the back of the z-order.
       
   278 
       
   279 Note: If this window is a window group in a chain, then all other window groups in the chain will be moved also.
       
   280 When this function is called on Group Window with aPos set to KOrdinalPositionSwitchToOwningWindow then the 
       
   281 function doesn't change the ordinal position of the group window, if instead it has focus then the window group 
       
   282 that would come to the forground if it died will be moved to the foreground.
       
   283 
       
   284 @param aPos The window's new ordinal position. The lower the ordinal, the closer to the 
       
   285 front of the z-order the window will be. Specifying any negative value however, sends 
       
   286 the window to the back of the z-order. */
       
   287 	{
       
   288 	WriteInt(aPos,EWsWinOpSetOrdinalPosition);
       
   289 	}
       
   290 
       
   291 EXPORT_C void RWindowTreeNode::SetOrdinalPosition(TInt aPos,TInt aOrdinalPriority)
       
   292 /** Sets the ordinal position and ordinal priority of a window. 
       
   293 
       
   294 Ordinal priority is a number assigned to a window that determines its position in the z-order. 
       
   295 For sibling windows or group windows, the higher the priority, the closer it will be to the 
       
   296 front. Ordinal priority overrides ordinal position, so that the ordinal position 
       
   297 is only taken into account for sibling windows or window groups with the same ordinal priority. 
       
   298 For a description of ordinal position, see the other overload of this function.
       
   299 
       
   300 Most windows have an ordinal priority of zero. Only window groups are normally 
       
   301 given non-default ordinal priorities.
       
   302 
       
   303 To set priority of KPasswordWindowGroupPriority or greater on a window group, client will require 
       
   304 SwEvent capability. If client does not have SwEvent capability then priority will be reduced 
       
   305 to KPasswordWindowGroupPriority-1. This function doesn't return an error thus the client cannot 
       
   306 tell if the priority is reduced, however, there is another function that can be used if the client 
       
   307 does require an error, this is RWindowGroup::SetOrdinalPositionErr.
       
   308 
       
   309 Note: If this window is a window group in a chain, then all other window groups in the chain will be moved also. 
       
   310 And further they will all have their ordinal priority set to the specified value.
       
   311 When this function is called on Group Window with aPos set to KOrdinalPositionSwitchToOwningWindow then the 
       
   312 function doesn't change the ordinal position of the group window, if instead it has focus then the window group 
       
   313 that would come to the forground if it died will be moved to the foreground.
       
   314 
       
   315 @param aPos The window's new ordinal position. The lower the ordinal, the closer to the 
       
   316 front of the z-order the window will be. Specifying any negative value however, sends 
       
   317 the window to the back of the z-order.
       
   318 @param aOrdinalPriority The window's new ordinal priority. */
       
   319 	{
       
   320 	TWsWinCmdOrdinalPos ordinalPos;
       
   321 	ordinalPos.pos=aPos;
       
   322 	ordinalPos.ordinalPriority=aOrdinalPriority;
       
   323 	Write(&ordinalPos,sizeof(ordinalPos),EWsWinOpSetOrdinalPositionPri);
       
   324 	}
       
   325 
       
   326 EXPORT_C TInt RWindowTreeNode::OrdinalPriority() const
       
   327 /** Gets the ordinal priority of the specified window.
       
   328 
       
   329 This function was added for FEPs that need to know the priority in their dialogues. 
       
   330 
       
   331 This function and RWsSession::GetWindowGroupOrdinalPriority() may return different 
       
   332 values because this function isn't subject to any ordinal priority adjustment, 
       
   333 while the window group ordinal priority may be.
       
   334  
       
   335 This function always causes a flush of the window server buffer.
       
   336 
       
   337 @return The ordinal priority of the specified window */
       
   338 	{
       
   339 	return(WriteReply(EWsWinOpOrdinalPriority));
       
   340 	}
       
   341 
       
   342 EXPORT_C TInt RWindowTreeNode::OrdinalPosition() const
       
   343 /** Gets the current ordinal position of the window tree node. 
       
   344 
       
   345 The ordinal position returned is the window's position amongst windows with 
       
   346 the same parent (an with the same priority). Displayable windows almost always 
       
   347 have the same priority, but window groups might typically have different priorities. 
       
   348 If a window group's ordinal position among window groups of all priorities 
       
   349 is required, use FullOrdinalPosition().
       
   350 
       
   351 Note: all group windows (across all clients) have the same parent.
       
   352  
       
   353 This function always causes a flush of the window server buffer.
       
   354 
       
   355 @return The window's ordinal position. */
       
   356 	{
       
   357 	return(WriteReply(EWsWinOpOrdinalPosition));
       
   358 	}
       
   359 
       
   360 EXPORT_C TInt RWindowTreeNode::FullOrdinalPosition() const
       
   361 /** Get the current full ordinal position of a window. 
       
   362 
       
   363 This function normally returns a useful value only when called on a window 
       
   364 group, because only window groups are normally given different priorities. 
       
   365 For other types of window the value returned is usually the same as that returned 
       
   366 by OrdinalPosition().
       
   367  
       
   368 This function always causes a flush of the window server buffer.
       
   369 
       
   370 @return The window's full ordinal position. */
       
   371 	{
       
   372 	return(WriteReply(EWsWinOpFullOrdinalPosition));
       
   373 	}
       
   374 
       
   375 /**Get the screen number that a window is located on
       
   376 
       
   377 @return The screen number that the window is located on
       
   378  */
       
   379 EXPORT_C TInt RWindowTreeNode::ScreenNumber() const
       
   380 	{
       
   381 	return(WriteReply(EWsWinOpScreenNumber));
       
   382 	}
       
   383 
       
   384 EXPORT_C TInt RWindowTreeNode::WindowGroupId() const
       
   385 /** Returns the window group Id of the parent window group
       
   386 
       
   387 If the window is a window group it will return it's Id. If it is not it scans 
       
   388 up the window tree to find the group window from which this window is descended 
       
   389 and returns it's Id.
       
   390 
       
   391 This function always causes a flush of the window server buffer.
       
   392 
       
   393 @return The window group Id of the window group from which this window is descended. */
       
   394 	{
       
   395 	return(WriteReply(EWsWinOpWindowGroupId));
       
   396 	}
       
   397 
       
   398 EXPORT_C TInt RWindowTreeNode::EnableOnEvents(TEventControl aCircumstances)
       
   399 /** Requests notification of 'on' events. 'On' events are of type EEventSwitchOn.
       
   400  
       
   401 This function always causes a flush of the window server buffer.
       
   402 
       
   403 @param aCircumstances The circumstances in which 'on' events are to be reported. 
       
   404 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   405 @see DisableOnEvents() */
       
   406 	{
       
   407 	return(WriteReplyInt(aCircumstances,EWsWinOpEnableOnEvents));
       
   408 	}
       
   409 
       
   410 EXPORT_C void RWindowTreeNode::DisableOnEvents()
       
   411 /** Cancels notification of 'on' events. 
       
   412 
       
   413 This function instructs the server to stop reporting 'on' events to this window. 
       
   414 If the window server has not previously been instructed to report 'on' events, 
       
   415 this method has no effect (i.e. the default is that windows do not get the 
       
   416 events).
       
   417 
       
   418 @see EnableOnEvents() */
       
   419 	{
       
   420 	if (iWsHandle)
       
   421 		Write(EWsWinOpDisableOnEvents);
       
   422 	}
       
   423 
       
   424 EXPORT_C TInt RWindowTreeNode::EnableGroupChangeEvents()
       
   425 /** Requests notification of group-change events.
       
   426 
       
   427 Use this function to instruct the window server to report group-change events 
       
   428 to this window. These events will typically be of interest to a shell or similar 
       
   429 application, for example to notify it that it should update its list of running 
       
   430 applications. Window group changed events are of type EEventWindowGroupsChanged.
       
   431  
       
   432 This function always causes a flush of the window server buffer.
       
   433 
       
   434 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   435 @see DisableGroupChangeEvents() */
       
   436 	{
       
   437 	return(WriteReply(EWsWinOpEnableGroupChangeEvents));
       
   438 	}
       
   439 
       
   440 EXPORT_C void RWindowTreeNode::DisableGroupChangeEvents()
       
   441 /** Cancels notification of group changed events. 
       
   442 
       
   443 Use this function to instruct the server to stop reporting window group changed 
       
   444 events to this window. If the window server has not previously been instructed 
       
   445 to report window group changed events, this function has no effect (i.e. the 
       
   446 default is that windows do not get the events).
       
   447 
       
   448 @see EnableGroupChangeEvents() */
       
   449 	{
       
   450 	if (iWsHandle)
       
   451 		Write(EWsWinOpDisableGroupChangeEvents);
       
   452 	}
       
   453 
       
   454 EXPORT_C TInt RWindowTreeNode::EnableFocusChangeEvents()
       
   455 /** Enables focus changed events.
       
   456 
       
   457 After this function is called, the EEventFocusGroupChanged event is delivered 
       
   458 to the window server message queue every time the focus window group changes. 
       
   459 The handle of the event is set to the client handle of the window that this 
       
   460 function is called on.
       
   461  
       
   462 This function always causes a flush of the window server buffer.
       
   463 
       
   464 @return KErrNone if successful, otherwise another of the system-wide error 
       
   465 codes. 
       
   466 @see DisableFocusChangeEvents() */
       
   467 	{
       
   468 	return(WriteReply(EWsWinOpEnableFocusChangeEvents));
       
   469 	}
       
   470 
       
   471 EXPORT_C void RWindowTreeNode::DisableFocusChangeEvents()
       
   472 /** Disables delivery of focus changed events.
       
   473 
       
   474 Use this function to instruct the server to stop reporting window group focus 
       
   475 changed events to this window. If the window server has not previously been 
       
   476 instructed to report window group changed events, this function has no effect 
       
   477 (i.e. the default is that windows do not get the events).
       
   478 
       
   479 @see EnableFocusChangeEvents() */
       
   480 	{
       
   481 	if (iWsHandle)
       
   482 		Write(EWsWinOpDisableFocusChangeEvents);
       
   483 	}
       
   484 
       
   485 EXPORT_C TInt RWindowTreeNode::EnableGroupListChangeEvents()
       
   486 /** Enables reporting of window group list change events.
       
   487 
       
   488 The window group list is a list of all window groups and their z-order. Calling 
       
   489 this function will cause notification events (of type EEventWindowGroupListChanged) 
       
   490 for any change in the window group list: additions, removals and reorderings.
       
   491 
       
   492 This function is useful when you need to know about changes to window groups 
       
   493 beneath the focused one, for instance when the screen is showing windows from 
       
   494 more than one window group at the same time.
       
   495 
       
   496 The handle of the event is set to the client handle of the window that this 
       
   497 function is called on.
       
   498  
       
   499 This function always causes a flush of the window server buffer.
       
   500 
       
   501 @return KErrNone if successful, otherwise another of the system-wide error 
       
   502 codes. */
       
   503 	{
       
   504 	return(WriteReply(EWsWinOpEnableGroupListChangeEvents));
       
   505 	}
       
   506 
       
   507 EXPORT_C void RWindowTreeNode::DisableGroupListChangeEvents()
       
   508 /** Disables reporting of window group list change events.
       
   509 
       
   510 This function instructs the window server to stop sending window group list 
       
   511 change events to this window. If the window server has not previously been 
       
   512 instructed to report window group list change events, this function has no 
       
   513 effect (i.e. the default is that windows do not receive group list change 
       
   514 events). */
       
   515 	{
       
   516 	if (iWsHandle)
       
   517 		Write(EWsWinOpDisableGroupListChangeEvents);
       
   518 	}
       
   519 
       
   520 EXPORT_C TInt RWindowTreeNode::EnableVisibilityChangeEvents()
       
   521 /** Enables reporting of window visibility change events.
       
   522 
       
   523 The window visibility is based on whether or not any area of the window can be seen
       
   524 on the screen.  This can be affected by SetVisible(), but also by other windows in
       
   525 front of this one, and by the presence of transparent windows which it can be seen
       
   526 through.  Calling this function will cause notification events (of type
       
   527 EEventWindowVisibilityChanged) for any change in the window's visibility.
       
   528 
       
   529 This function is useful when you are performing graphical processing such as animations
       
   530 and would like to stop them while they cannot be seen, for efficiency reasons.
       
   531 
       
   532 The handle of the event is set to the client handle of the window that this 
       
   533 function is called on.
       
   534  
       
   535 This function always causes a flush of the window server buffer.
       
   536 
       
   537 @return KErrNone if successful, otherwise another of the system-wide error 
       
   538 codes. */
       
   539 	{
       
   540 	return(WriteReply(EWsWinOpEnableVisibilityChangeEvents));
       
   541 	}
       
   542 
       
   543 EXPORT_C void RWindowTreeNode::DisableVisibilityChangeEvents()
       
   544 /** Disables reporting of window visibility change events.
       
   545 
       
   546 This function instructs the window server to stop sending window visibility 
       
   547 change events to this window. If the window server has not previously been 
       
   548 instructed to report window visibility change events, this function has no 
       
   549 effect (i.e. the default is that windows do not receive visibility change 
       
   550 events). */
       
   551 	{
       
   552 	if (iWsHandle)
       
   553 		Write(EWsWinOpDisableVisibilityChangeEvents);
       
   554 	}
       
   555 
       
   556 EXPORT_C TInt RWindowTreeNode::EnableErrorMessages(TEventControl aCircumstances)
       
   557 /** Requests notification of error message events. 
       
   558 
       
   559 Use this function to instruct the window server to report error message events 
       
   560 (of type EEventErrorMessage).
       
   561  
       
   562 This function always causes a flush of the window server buffer.
       
   563 
       
   564 @param aCircumstances The circumstances in which error message events are 
       
   565 to be reported. 
       
   566 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   567 @see DisableErrorMessages() */
       
   568 	{
       
   569 	return(WriteReplyInt(aCircumstances,EWsWinOpEnableErrorMessages));
       
   570 	}
       
   571 
       
   572 EXPORT_C void RWindowTreeNode::DisableErrorMessages()
       
   573 /** Cancels notification of error message events. 
       
   574 
       
   575 Use this function to instruct the server to stop reporting error message events 
       
   576 to this window. If the window server has not previously been instructed to 
       
   577 report error message events, this function has no effect (i.e. the default 
       
   578 is that windows do not get error messages).
       
   579 
       
   580 @see EnableErrorMessages() */
       
   581 	{
       
   582 	if (iWsHandle)
       
   583 		Write(EWsWinOpDisableErrorMessages);
       
   584 	}
       
   585 
       
   586 EXPORT_C TInt RWindowTreeNode::EnableModifierChangedEvents(TUint aModifierMask, TEventControl aCircumstances)
       
   587 /** Requests notification of modifier changed events. 
       
   588 
       
   589 Use this function to instruct the window server to report modifier changed 
       
   590 events to this window. Values for the modifier keys are defined in TEventModifier. 
       
   591 If more than one modifier key is to be monitored, their values should be combined 
       
   592 using a bit-wise OR operation. Modifier changed events are of type EEventModifiersChanged.
       
   593  
       
   594 This function always causes a flush of the window server buffer.
       
   595 
       
   596 @param aModifierMask The modifiers to be reported. May be a combination of 
       
   597 values defined in TEventModifier 
       
   598 @param aCircumstances The circumstances in which modifier changed events are 
       
   599 to be reported. 
       
   600 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   601 @see DisableModifierChangedEvents() */
       
   602 	{
       
   603 	TWsWinCmdEnableModifierChangedEvents params(aModifierMask, aCircumstances);
       
   604 	return(WriteReply(&params,sizeof(params),EWsWinOpEnableModifierChangedEvents));
       
   605 	}
       
   606 
       
   607 EXPORT_C void RWindowTreeNode::DisableModifierChangedEvents()
       
   608 /** Cancels notification of modifier changed events. 
       
   609 
       
   610 Use this function to instruct the server to stop reporting modifier changed 
       
   611 events to this window. If the window server has not previously been instructed 
       
   612 to report modifier changed events, this function has no effect (i.e. the default 
       
   613 is that windows do not get the events).
       
   614 
       
   615 @see EnableModifierChangedEvents() */
       
   616 	{
       
   617 	if (iWsHandle)
       
   618 		Write(EWsWinOpDisableModifierChangedEvents);
       
   619 	}
       
   620 
       
   621 EXPORT_C TInt RWindowTreeNode::SetPointerCursor(TInt aCursorNumber)
       
   622 /** Sets the pointer cursor from the system pointer cursor list. 
       
   623 
       
   624 Use this function to set the current cursor to one contained in the system 
       
   625 pointer cursor list. If the list does not contain a cursor with an index of 
       
   626 aCursorNumber, the function will attempt to set the cursor to the default 
       
   627 system pointer cursor, which has an index of 0 in the list.
       
   628 
       
   629 The RWsSession class provides functions for setting and controlling the system 
       
   630 pointer cursor list.
       
   631  
       
   632 This function always causes a flush of the window server buffer.
       
   633 
       
   634 @param aCursorNumber The cursor index in the system pointer cursor list. 
       
   635 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   636 @see ClearPointerCursor() */
       
   637 	{
       
   638 	return(WriteReplyInt(aCursorNumber,EWsWinOpSetPointerCursor));
       
   639 	}
       
   640 
       
   641 EXPORT_C void RWindowTreeNode::SetCustomPointerCursor(const RWsPointerCursor &aPointerCursor)
       
   642 /** Sets the pointer cursor to an application-defined cursor.
       
   643 
       
   644 @param aPointerCursor The cursor to use. */
       
   645 	{
       
   646 	WriteInt(aPointerCursor.WsHandle(),EWsWinOpSetCustomPointerCursor);
       
   647 	}
       
   648 
       
   649 EXPORT_C void RWindowTreeNode::SetNonFading(TBool aNonFading)
       
   650 /** Sets whether a window is non-fading.
       
   651 
       
   652 When the non-fading flag is set the window will unfade if needed and remain 
       
   653 unfaded until this flag is removed. This is useful for toolbars etc. which 
       
   654 must never be faded.
       
   655 
       
   656 @param aNonFading ETrue to set the non-fading flag, EFalse (the default) to 
       
   657 re-set it. */
       
   658 	{
       
   659 	WriteInt(aNonFading,EWsWinOpSetNonFading);
       
   660 	}
       
   661 
       
   662 EXPORT_C void RWindowTreeNode::SetFaded(TBool aFaded,TFadeControl aIncludeChildren)
       
   663 /** Sets the window as faded or unfaded.
       
   664 
       
   665 This function allows a single window to be faded or unfaded. The function 
       
   666 also allows the same action to be applied to all of the window's children.
       
   667 
       
   668 Notes:
       
   669 
       
   670 A redraw is required to un-fade a window because information is lost during 
       
   671 fading (blank and backup windows deal with this themselves). Areas in shadow 
       
   672 when the window is faded also require a redraw. 
       
   673 
       
   674 While a window is faded, all drawing to that window will be adjusted appropriately 
       
   675 by the window server.
       
   676 
       
   677 @param aFaded ETrue to fade the window, EFalse to un-fade it. 
       
   678 @param aIncludeChildren Fade control flags. These set whether fading/un-fading 
       
   679 also apply to child windows. */
       
   680 	{
       
   681 	TWsWinCmdSetFaded params(aFaded,aIncludeChildren);
       
   682 	Write(&params,sizeof(params),EWsWinOpSetFade);
       
   683 	}
       
   684 
       
   685 EXPORT_C void RWindowTreeNode::SetFaded(TBool aFaded,TFadeControl aIncludeChildren,TUint8 aBlackMap,TUint8 aWhiteMap)
       
   686 /** Sets one or more windows as faded or unfaded, specifying a fading map. 
       
   687 
       
   688 Fading is used to change the colour of a window to make other windows stand 
       
   689 out. For example, you would fade all other windows when displaying a dialogue. 
       
   690 
       
   691 Fading makes a window closer to white or closer to black.
       
   692 Setting the fading map allows you to over-ride the default fading parameters 
       
   693 set in RWsSession::SetDefaultFadingParameters(). 
       
   694 
       
   695 The white and black fading values define the range over which colours are 
       
   696 re-mapped when a window is faded. As the values get closer together, all colours 
       
   697 in the faded window becomes more similar, creating the fading effect. 
       
   698 When the numbers cross over (so that the black value is greater than the white 
       
   699 value) the colours in the faded window start to invert, i.e. colours that 
       
   700 were closer to white in the unfaded window are mapped to a darker colour when 
       
   701 the window is faded.
       
   702 
       
   703 The function also allows the fading action applied to this window to be applied 
       
   704 to all of its children.
       
   705 
       
   706 Notes:
       
   707 
       
   708 Fading a window for a 2nd time will not change the fading map used. 
       
   709 
       
   710 A redraw is required to un-fade a window because information is lost during 
       
   711 fading. Note that blank (RBlankWindow) and backup (RBackedUpWindow) windows 
       
   712 deal with this themselves. Areas in shadow when the window is faded also require 
       
   713 a redraw. 
       
   714 
       
   715 While a window is faded all drawing to that window will be adjusted appropriately 
       
   716 by the window server.
       
   717 
       
   718 @param aFaded ETrue to fade the window, EFalse to un-fade it. 
       
   719 @param aIncludeChildren Fade control flags. This sets whether fading/un-fading 
       
   720 is also to apply to all child windows. 
       
   721 @param aBlackMap Black map fading parameter.
       
   722 @param aWhiteMap White map fading parameter. 
       
   723 @see RWsSession::SetDefaultFadingParameters()
       
   724 @see CWindowGc::SetFadingParameters() */
       
   725 	{
       
   726 	TWsWinCmdSetFaded params(aFaded,aIncludeChildren,EFalse,aBlackMap,aWhiteMap);
       
   727 	Write(&params,sizeof(params),EWsWinOpSetFade);
       
   728 	}
       
   729 
       
   730 EXPORT_C void RWindowTreeNode::ClearPointerCursor()
       
   731 /** Clears pointer cursor settings.
       
   732 
       
   733 These are the settings made by calling SetPointerCursor(). */
       
   734 	{
       
   735 	Write(EWsWinOpClearPointerCursor);
       
   736 	}
       
   737 
       
   738 /** Returns the window server session that is used to create this window handle. 
       
   739 
       
   740 This functions returns null if the window handle is not initialised.
       
   741 
       
   742 @see RWindowTreeNode(RWsSession &aWs)
       
   743 */
       
   744 EXPORT_C RWsSession* RWindowTreeNode::Session() const
       
   745 	{
       
   746 	return iBuffer? iBuffer->Session() : NULL;
       
   747 	}
       
   748 
       
   749 /** @panic TW32Panic 17 in debug builds if called on an already constructed object.*/
       
   750 TInt RWindowBase::construct(const RWindowTreeNode &parent,TUint32 aClientHandle, TInt aType, TDisplayMode aDisplayMode)
       
   751 	{
       
   752 	__ASSERT_DEBUG(iWsHandle == KNullHandle, Panic(EW32PanicGraphicDoubleConstruction));
       
   753 	TWsClCmdCreateWindow createWindow;
       
   754 	createWindow.parent=parent.WsHandle();
       
   755 	createWindow.clientHandle=aClientHandle;
       
   756 	createWindow.type=(TWinTypes)aType;
       
   757 	createWindow.displayMode=aDisplayMode;
       
   758 	TInt ret=iBuffer->WriteReplyWs(&createWindow,sizeof(createWindow),EWsClOpCreateWindow);
       
   759 	if (ret<0)
       
   760 		return(ret);
       
   761 	iWsHandle=ret;
       
   762 	return(KErrNone);
       
   763 	}
       
   764 
       
   765 EXPORT_C void RWindowBase::Activate()
       
   766 /** Displays the window and enables it to receive events. 
       
   767 
       
   768 Calling this method on a window causes it to receive a redraw event 
       
   769 if it is a non-backed-up window, and should be called after a window has 
       
   770 been constructed and initialised.
       
   771 
       
   772 Windows are not displayed automatically when they are constructed. This allows 
       
   773 them to be customised using SetPosition(), SetOrdinalPosition(), SetExtent(), 
       
   774 etc., before they are displayed. */
       
   775 	{
       
   776 	Write(EWsWinOpActivate);
       
   777 	}
       
   778 
       
   779 EXPORT_C TPoint RWindowBase::Position() const
       
   780 /** Gets a window's position relative to its parent.
       
   781  
       
   782 This function always causes a flush of the window server buffer.
       
   783 
       
   784 @return Position of this window's origin relative to the origin of its parent. */
       
   785 	{
       
   786 	TPckgBuf<TPoint> pntPkg;
       
   787   	WriteReplyP(&pntPkg,EWsWinOpPosition);
       
   788 	return(pntPkg());
       
   789 	}
       
   790 
       
   791 EXPORT_C TPoint RWindowBase::AbsPosition() const
       
   792 /** Gets a window's absolute position - ie the windows position relative 
       
   793 to the current screen size mode.
       
   794  
       
   795 This function always causes a flush of the window server buffer.
       
   796 
       
   797 @return Position of this window's origin relative to the screen. */
       
   798 	{
       
   799 	TPckgBuf<TPoint> pntPkg;
       
   800   	WriteReplyP(&pntPkg,EWsWinOpAbsPosition);
       
   801 	return(pntPkg());
       
   802 	}
       
   803 
       
   804 EXPORT_C TSize RWindowBase::Size() const
       
   805 /** Gets the window's current size.
       
   806  
       
   807 This function always causes a flush of the window server buffer.
       
   808 
       
   809 @return Current size of window. */
       
   810 	{
       
   811 	TPckgBuf<TSize> sizePkg;
       
   812   	WriteReplyP(&sizePkg,EWsWinOpSize);
       
   813 	return(sizePkg());
       
   814 	}
       
   815 
       
   816 EXPORT_C void RWindowBase::SetPosition(const TPoint &aPos)
       
   817 /** Sets the position of a window relative to its parent. 
       
   818 
       
   819 The co-ordinates given in aPos specify the position of the top left-hand 
       
   820 corner of the window, relative to the top left-hand corner of its parent. 
       
   821 A positive value indicates a direction to the right and down. Negative values 
       
   822 are valid but will cause part of the window to be outside its parent's extent, 
       
   823 and therefore clipped.
       
   824 
       
   825 This function may be called at any time after the window's Construct() function: 
       
   826 the window's position will change dynamically.
       
   827 
       
   828 A window's position can also be set using the RWindow::SetExtent() and RWindowBase::SetExtentErr() 
       
   829 functions.
       
   830 
       
   831 Note: upon creation, a window's extent is the same as its parent’s. In other words 
       
   832 it has the same origin and size. If the window’s parent is a group window, it is 
       
   833 initialised to be full screen.
       
   834 
       
   835 @param aPos The position of the window's origin, relative to its parent */
       
   836 	{
       
   837 	WritePoint(aPos,EWsWinOpSetPos);
       
   838 	}
       
   839 
       
   840 EXPORT_C TInt RWindowBase::SetSizeErr(const TSize &aSize)
       
   841 /** Sets the size of a backed-up window. 
       
   842 
       
   843 A window's size is not constrained by the size of its parent. However, its 
       
   844 visible region is, and the child window's visible region will always be clipped 
       
   845 to the parent's visible region.
       
   846 
       
   847 Avoid using this function for a window known to be of type RBlankWindow or 
       
   848 RWindow (i.e. not a backed-up window). Instead, use SetSize(), which is more 
       
   849 efficient as it does not return a value. However, if the window is a backed-up 
       
   850 window, or of unknown type, SetSizeErr() should be used, because 
       
   851 setting the size of a backed-up window may cause an out-of-memory error.
       
   852 
       
   853 This function may be called at any time after the window's Construct() function: 
       
   854 the window's size will change dynamically.
       
   855  
       
   856 This function always causes a flush of the window server buffer.
       
   857 
       
   858 @param aSize Window size.
       
   859 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
   860 @see RWindow::SetSize()
       
   861 @see RWindow::SetExtent()
       
   862 @see RWindowBase::SetExtentErr() */
       
   863 	{
       
   864 	return(WriteReply(&aSize,sizeof(aSize),EWsWinOpSetSizeErr));
       
   865 	}
       
   866 
       
   867 EXPORT_C TInt RWindowBase::SetExtentErr(const TPoint &pos,const TSize &size)
       
   868 /** Sets a backed-up window's extent, relative to its parent, and returns an error 
       
   869 code from the server. 
       
   870 
       
   871 See SetPosition() and SetSizeErr() for a description of the rules applying 
       
   872 to aPoint and aSize respectively.
       
   873 
       
   874 Avoid using this function for a window of type RBlankWindow or RWindow (in other words, 
       
   875 not a backed-up window). Instead, use SetExtent(), which is more efficient 
       
   876 as it does not return a value. However, if the window is a backed-up window, 
       
   877 or of unknown type, SetExtentErr() should be used, because setting 
       
   878 the extent of a backed-up window may cause an out-of-memory error.
       
   879 
       
   880 This function may be called at any time after the window's Construct() function: 
       
   881 the window's extent will change dynamically.
       
   882  
       
   883 This function always causes a flush of the window server buffer.
       
   884 
       
   885 @param pos The position of the window's origin, relative to its parent. 
       
   886 @param size Window size. 
       
   887 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
   888 	{
       
   889 	TWsWinCmdSetExtent setExtent(pos,size);
       
   890 	return(WriteReply(&setExtent,sizeof(setExtent),EWsWinOpSetExtentErr));
       
   891 	}
       
   892 
       
   893 EXPORT_C TPoint RWindowBase::InquireOffset(const RWindowTreeNode &aWindow) const
       
   894 /** Enquires the offset between this and another window. 
       
   895 
       
   896 A positive value indicates a position to the right and down from aWindow, 
       
   897 a negative value indicates a position to the left and up.
       
   898  
       
   899 This function always causes a flush of the window server buffer.
       
   900 
       
   901 @param aWindow Another window tree node. 
       
   902 @return The offset of this window relative to aWindow. */
       
   903 	{
       
   904 	TPckgBuf<TPoint> pkgPoint;
       
   905 	TUint32 handle=aWindow.WsHandle();
       
   906 	WriteReplyP(&handle,sizeof(handle),&pkgPoint,EWsWinOpInquireOffset);
       
   907 	return(pkgPoint());
       
   908 	}
       
   909 
       
   910 EXPORT_C void RWindowBase::PointerFilter(TUint32 aFilterMask, TUint32 aFilter)
       
   911 /** Sets the filter which controls which pointer events are sent to the client 
       
   912 session. 
       
   913 
       
   914 A pointer filter can be defined for each window separately, and changed dynamically. 
       
   915 The default behaviour when a window is created is that move, drag, enter and 
       
   916 exit events are filtered out and not delivered to the client.
       
   917 
       
   918 @param aFilterMask Bitwise OR of values from TPointerFilter masking event 
       
   919 types which will be updated. 
       
   920 @param aFilter Bits containing new values for the masked event types. A 1 bit 
       
   921 causes the corresponding event to be filtered out, a 0 bit lets through the 
       
   922 corresponding event. 
       
   923 @see TPointerFilter */
       
   924 	{
       
   925 	TWsWinCmdPointerFilter params;
       
   926 	params.mask=aFilterMask;
       
   927 	params.flags=aFilter;
       
   928 	Write(&params,sizeof(params),EWsWinOpPointerFilter);
       
   929 	}
       
   930 
       
   931 EXPORT_C void RWindowBase::SetPointerCapture(TInt aFlags)
       
   932 /** Sets the pointer capture state.
       
   933 
       
   934 A window which has called this function can capture events that would otherwise 
       
   935 go to other windows. Normally, pointer events are sent to the window at 
       
   936 the co-ordinates where the event occurs. Capturing only works on windows which 
       
   937 are behind the capturing window in the z order. 
       
   938 
       
   939 Capture can be enabled or disabled. If capturing is enabled a window will, 
       
   940 by default, capture events only from windows in the same window group. A flag 
       
   941 can be specified to allow it to capture events across all window groups.
       
   942 
       
   943 Another flag can be used to specify drag-drop capture. This causes a drag-drop 
       
   944 message to be sent to the window within which the pen was lifted. Drag-drop 
       
   945 with a pen is a tap-drag-lift sequence.
       
   946 
       
   947 Capture functionality is useful in situations where only the foreground window 
       
   948 should receive events, e.g. in a modal dialogue.
       
   949 
       
   950 @param aFlags Bitwise OR of flag values from TCaptureFlags. 
       
   951 @see TCaptureFlags */
       
   952 	{
       
   953 	WriteInt(aFlags,EWsWinOpSetPointerCapture);		//The data is actually interpreted as a TUint
       
   954 	}
       
   955 
       
   956 EXPORT_C void RWindowBase::SetPointerGrab(TBool aState)
       
   957 /** Allows or disallows pointer grabs in a window. 
       
   958 
       
   959 If the pointer grab is set, any down event in this window will cause 
       
   960 a pointer grab, terminated by the next corresponding up event. All pointer 
       
   961 events up to and including the next up event will be sent to that window.
       
   962 
       
   963 Pointer grab can be used for drag-and-drop or other situations when you want 
       
   964 the events delivered to the same window even though the pen will be dragged 
       
   965 outside that window. This function is typically called during window construction 
       
   966 so that pointer grab is enabled for the lifetime of the window.
       
   967 
       
   968 Pointer grab is disabled by default.
       
   969 
       
   970 @param aState New state for the pointer grab setting. 
       
   971 @see ClaimPointerGrab() */
       
   972 	{
       
   973 	WriteInt(aState,EWsWinOpSetPointerGrab);
       
   974 	}
       
   975 
       
   976 EXPORT_C TInt RWindowBase::ClaimPointerGrab(const TUint8, const TBool)
       
   977 /** Dummy implementation in order to preserve compatibility with WSERV NGA.
       
   978     @internalComponent */ 
       
   979 	{
       
   980 	ASSERT(EFalse);
       
   981 	return KErrNotSupported;
       
   982 	}
       
   983 
       
   984 EXPORT_C void RWindowBase::ClaimPointerGrab(TBool aSendUpEvent)
       
   985 /** Claims the pointer grab from another window. 
       
   986 
       
   987 If a pointer grab is already in effect in another window, a window can claim 
       
   988 the pointer grab from that window by calling this function. All subsequent 
       
   989 events will be delivered to this window, up to and including the next "up" 
       
   990 event. This next up event terminates the pointer grab.
       
   991 
       
   992 This function would typically be used where clicking in a window pops up another 
       
   993 window, and where the popped-up window wishes to grab the pointer as though 
       
   994 the original click had been in that window.
       
   995 
       
   996 Note:
       
   997 
       
   998 If aSendUpEvent is set to ETrue, the window losing the grab is immediately 
       
   999 sent an up event, signalling the end of its pointer grab.
       
  1000 
       
  1001 @param aSendUpEvent Whether to deliver an up event to the window that previously 
       
  1002 had the grab. 
       
  1003 @see SetPointerGrab() */
       
  1004 	{
       
  1005 	WriteInt(aSendUpEvent,EWsWinOpClaimPointerGrab);
       
  1006 	}
       
  1007 
       
  1008 EXPORT_C void RWindowBase::SetPointerCapturePriority(TInt aPriority)
       
  1009 /** Sets the window's pointer capture priority.
       
  1010 
       
  1011 To allow window gain a property that allows them to be clicked on even when they are behind a modal
       
  1012 window. The priority will be 0 by default. Windows that need to stop modal window in front of them, 
       
  1013 should set this value to positive. Window can only capture pointer events from another window 
       
  1014 of same group, if it has at least the same pointer capture priority.
       
  1015 
       
  1016 @param aPriority Pointer capture priority */
       
  1017 	{
       
  1018 	WriteInt(aPriority,EWsWinOpSetPointerCapturePriority);
       
  1019 	}
       
  1020 
       
  1021 EXPORT_C TInt RWindowBase::GetPointerCapturePriority() const
       
  1022 /** Gets the windows's pointer capture priority
       
  1023 
       
  1024 @return Window's pointer capture priority 
       
  1025 @see SetPointerCapturePriority() */
       
  1026 	{
       
  1027 	return WriteReply(EWsWinOpGetPointerCapturePriority);
       
  1028 	}
       
  1029 
       
  1030 EXPORT_C void RWindowBase::SetVisible(TBool aState)
       
  1031 /** Sets the window's visibility. 
       
  1032 
       
  1033 This function can be called after the window has been created to dynamically 
       
  1034 change its visibility.
       
  1035 
       
  1036 Notes:
       
  1037 
       
  1038 When a window is invisible, it receives no events from the window server.
       
  1039 
       
  1040 A window is invisible before it is activated, irrespective of the state of 
       
  1041 its visibility flag.
       
  1042 
       
  1043 @param aState New value for the visibility. */
       
  1044 	{
       
  1045 	WriteInt(aState,EWsWinOpSetVisible);
       
  1046 	}
       
  1047 
       
  1048 EXPORT_C void RWindowBase::SetShadowHeight(TInt aHeight)
       
  1049 /** Sets a window's shadow height.
       
  1050 
       
  1051 This is the height that this window is above the window immediately behind 
       
  1052 it. The offset of the shadow's bottom right corner from the window's bottom 
       
  1053 right corner is the product of the window's shadow height and the system shadow 
       
  1054 vector. 
       
  1055 
       
  1056 A shadow is only displayed on top-level windows.
       
  1057 
       
  1058 @param aHeight Shadow height. The default is 0. */
       
  1059 	{
       
  1060 	WriteInt(aHeight,EWsWinOpSetShadowHeight);
       
  1061 	}
       
  1062 
       
  1063 EXPORT_C void RWindowBase::SetShadowDisabled(TBool aState)
       
  1064 /** Enables or disables whether a window casts a shadow. 
       
  1065 
       
  1066 By default, when a window is created, its shadow is not disabled. (But note 
       
  1067 that a shadow is only cast by top-level windows.)
       
  1068 
       
  1069 @param aState ETrue if the shadow is to be disabled (not displayed). EFalse 
       
  1070 if the shadow is to be displayed */
       
  1071 	{
       
  1072 	WriteInt(aState,EWsWinOpShadowDisabled);
       
  1073 	}
       
  1074 
       
  1075 EXPORT_C TInt RWindowBase::SetCornerType(TCornerType aCornerType, TInt aCornerFlags)
       
  1076 /** Sets the shape of a window's corners.
       
  1077  
       
  1078 This function always causes a flush of the window server buffer.
       
  1079 
       
  1080 @param aCornerType Corner type to apply. 
       
  1081 @param aCornerFlags Bitwise OR of flags indicating corners to exclude. 
       
  1082 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  1083 @see TCornerFlags 
       
  1084 @deprecated */
       
  1085 	{
       
  1086 	TWsWinCmdSetCornerType params;
       
  1087 	params.type=aCornerType;
       
  1088 	params.flags=aCornerFlags;
       
  1089 	return(WriteReply(&params,sizeof(params),EWsWinOpSetCornerType));
       
  1090 	}
       
  1091 
       
  1092 EXPORT_C TInt RWindowBase::SetShape(const TRegion &aRegion)
       
  1093 /** Sets a window's shape arbitrarily, if rectangular windows are not required.
       
  1094  
       
  1095 This function always causes a flush of the window server buffer.
       
  1096 
       
  1097 @param aRegion Region defining window shape. 
       
  1098 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  1099 @deprecated */
       
  1100 	{
       
  1101 	__ASSERT_DEBUG(!aRegion.CheckError(),Panic(EW32PanicInvalidRegion));
       
  1102 	const TInt regionCount=aRegion.Count();
       
  1103 	TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
       
  1104 	return(WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpSetShape));
       
  1105 	}
       
  1106 
       
  1107 EXPORT_C TInt RWindowBase::SetRequiredDisplayMode(TDisplayMode aMode)
       
  1108 /** Sets the window's display mode. 
       
  1109 
       
  1110 Each window can be given an individual display mode because some windows may 
       
  1111 require a greater number of different colours than others.
       
  1112 
       
  1113 The default display mode of a window is dependent on the individual target 
       
  1114 device. The default mode may not reflect the full capabilities of the display. 
       
  1115 On some devices a simpler colour mode may be used as the default in order 
       
  1116 to save battery power. In these cases, this method may be used to request 
       
  1117 a different display mode on a per-window basis.
       
  1118 
       
  1119 At any given time, the window server uses the highest display mode of the 
       
  1120 windows currently visible, and switches the hardware into that mode. Therefore, 
       
  1121 if an application contains a window with display mode EGray16, but only EGray4 
       
  1122 windows are visible, the screen hardware will use EGray4 until the EGray16 
       
  1123 window becomes visible.
       
  1124  
       
  1125 This function always causes a flush of the window server buffer.
       
  1126 
       
  1127 @param aMode The display mode: can have any TDisplayMode value except TDisplayMode::ERgb 
       
  1128 (since this isn't a mode that screen hardware can ever take). 
       
  1129 @return The display mode to which the window has been set. This is the closest 
       
  1130 display mode to aMode supported by the hardware. */
       
  1131 	{
       
  1132 	return(WriteReplyInt(aMode,EWsWinOpRequiredDisplayMode));
       
  1133 	}
       
  1134 
       
  1135 EXPORT_C TDisplayMode RWindowBase::DisplayMode() const
       
  1136 /** Gets the window's current display mode.
       
  1137  
       
  1138 This function always causes a flush of the window server buffer.
       
  1139 
       
  1140 @return The window's current display mode. */
       
  1141 	{
       
  1142 	return((TDisplayMode)WriteReply(EWsWinOpGetDisplayMode));
       
  1143 	}
       
  1144 
       
  1145 EXPORT_C void RWindowBase::EnableBackup(TUint aBackupType/*=EWindowBackupAreaBehind*/)
       
  1146 /** Requests that this window backs up all or part of the screen's contents. There 
       
  1147 are two backup possibilities:- just the area behind this window (the default), 
       
  1148 or the whole screen. Backing up the whole screen is useful for windows that 
       
  1149 require the rest of the screen to fade when they are displayed. In this case, 
       
  1150 the full screen backup is of the unfaded content of the screen.
       
  1151 
       
  1152 It is possible to specify both types of backup at the same time. This may 
       
  1153 be used by fade behind windows that can be dragged across the screen, e.g. 
       
  1154 a dialog. This is done by calling this function with the parameter EWindowBackupAreaBehind|EWindowBackupFullScreen.
       
  1155 
       
  1156 When backing up the whole screen, this function should be called before the 
       
  1157 window is activated, and before you call fade behind on it (RWindowBase::FadeBehind()).
       
  1158 
       
  1159 Backing up a window is an optimisation feature that is honoured only if there 
       
  1160 is enough memory to do so, (it requires bitmaps and a region to be created 
       
  1161 and maintained). If there is not enough memory, all or part of the backup 
       
  1162 will be lost. In this case, a redraw will be issued at the relevant point 
       
  1163 just as if the window had not been backed up.
       
  1164 
       
  1165 The backup bitmap is made and is claimed by the window not when EnableBackup() 
       
  1166 is called, but when the window becomes visible (this is normally when the 
       
  1167 window is activated).
       
  1168 
       
  1169 Only one backed up window of the same type can exist at any one time (although 
       
  1170 the same window can have both types of backup at the same time). If a window 
       
  1171 requests a backup of type EWindowBackupAreaBehind, any window that has already 
       
  1172 claimed a backup of this type will lose it. If a window requests a backup 
       
  1173 of type EWindowBackupFullScreen, this request will fail if another window 
       
  1174 has already claimed a backup of this type.
       
  1175 
       
  1176 @param aBackupType The type of backed up window. See the TWindowBackupType 
       
  1177 enum for possible values.
       
  1178 @see TWindowBackupType */
       
  1179 	{
       
  1180 	WriteInt(aBackupType,EWsWinOpEnableBackup);
       
  1181 	}
       
  1182 
       
  1183 EXPORT_C void RWindowBase::RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 aTime,const TRect &aRect)
       
  1184 /** Requests a pointer repeat event. 
       
  1185 
       
  1186 This function instructs the window server to send a single pointer repeat event if 
       
  1187 the pointer state that caused the last event (e.g. EButton1Down) has not changed 
       
  1188 within aTime and the pointer has not moved outside aRect. Pointer repeat events 
       
  1189 are pointer events of type TPointerEvent::EButtonRepeat.
       
  1190 
       
  1191 While the repeat is in operation all move and drag events within the rectangle 
       
  1192 are filtered out. The repeat is cancelled if the pointer moves outside the 
       
  1193 rectangle or generates any other pointer event.
       
  1194 
       
  1195 A typical use of this function would be for a scrollbar, so that holding down 
       
  1196 the pointer results in a continuous scroll.
       
  1197 
       
  1198 @param aTime Time interval before pointer repeat event should be sent. 
       
  1199 @param aRect Repeat event occurs only if pointer is within this rectangle. 
       
  1200 @see CancelPointerRepeatEventRequest() */
       
  1201 	{
       
  1202 	TWsWinCmdRequestPointerRepeatEvent params(aTime,aRect);
       
  1203 	Write(&params,sizeof(params),EWsWinOpRequestPointerRepeatEvent);
       
  1204 	}
       
  1205 
       
  1206 EXPORT_C void RWindowBase::CancelPointerRepeatEventRequest()
       
  1207 /** Cancels a request for a pointer repeat event.
       
  1208 
       
  1209 @see RequestPointerRepeatEvent() */
       
  1210 	{
       
  1211 	if (iWsHandle)
       
  1212 		Write(EWsWinOpCancelPointerRepeatEventRequest);
       
  1213 	}
       
  1214 
       
  1215 EXPORT_C TInt RWindowBase::RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 /*aTime*/,const TRect &/*aRect*/, const TUint8 /*aPointerNumber*/)
       
  1216 /** Dummy implementation in order to preserve compatibility with WSERV NGA.
       
  1217     @internalComponent */ 
       
  1218 	{
       
  1219 	// No multipointer in WSERV NONNGA, so ignore pointer number by redirecting to appropriate API
       
  1220 	ASSERT(0);
       
  1221 	return KErrNotSupported;
       
  1222 	}
       
  1223 
       
  1224 EXPORT_C TInt RWindowBase::CancelPointerRepeatEventRequest(const TUint8 /*aPointerNumber*/)
       
  1225 /** Dummy implementation in order to preserve compatibility with WSERV NGA.
       
  1226     @internalComponent */ 
       
  1227 	{
       
  1228 	// No multipointer in WSERV NONNGA, so ignore pointer number by redirecting to appropriate API
       
  1229 	ASSERT(0);	
       
  1230 	return KErrNotSupported;
       
  1231 	}
       
  1232 
       
  1233 EXPORT_C void RWindowBase::EnableAdvancedPointers()
       
  1234 /** Dummy implementation in order to preserve compatibility with WSERV NGA.
       
  1235     @internalComponent */ 
       
  1236 	{
       
  1237 	ASSERT(0);	
       
  1238 	}
       
  1239 
       
  1240 EXPORT_C TInt RWindowBase::AllocPointerMoveBuffer(TInt aMaxNumPoints, TUint aFlags)
       
  1241 /** Allocates a buffer for storing pointer movements. 
       
  1242 
       
  1243 The pointer move buffer is used by applications that need to process every 
       
  1244 single pointer move or drag event: for example, a freehand drawing application.
       
  1245 
       
  1246 Normally, multiple drag events which the window server receives from the pointer 
       
  1247 device driver are translated into a single drag event. The single drag event 
       
  1248 incorporates all pointer events that occurred while the client was processing 
       
  1249 the previous pointer event. If the pointer move buffer is used, the window 
       
  1250 server stores all pointer events in a pointer buffer, and then delivers the 
       
  1251 entire buffer when it is full.
       
  1252 
       
  1253 AllocPointerMoveBuffer() must be called before the pointer move buffer can 
       
  1254 be used. It would typically be called during window construction.
       
  1255 
       
  1256 After the pointer move buffer has been allocated, the window server does not 
       
  1257 start putting pointer events into it until EnablePointerMoveBuffer() is called.
       
  1258 
       
  1259 Note: move events are not available on all hardware.
       
  1260  
       
  1261 This function always causes a flush of the window server buffer.
       
  1262 
       
  1263 @param aMaxPoints Maximum number of pointer events the buffer can hold. This 
       
  1264 affects the frequency at which the buffer is flushed. 
       
  1265 @param aFlags Obsolete argument: set to zero always. 
       
  1266 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  1267 	{
       
  1268 	TWsWinCmdAllocPointerMoveBuffer params;
       
  1269 	params.maxNumPoints=aMaxNumPoints;
       
  1270 	params.flags=aFlags;
       
  1271 	return(WriteReply(&params,sizeof(params),EWsWinOpAllocPointerMoveBuffer));
       
  1272 	}
       
  1273 
       
  1274 EXPORT_C void RWindowBase::FreePointerMoveBuffer()
       
  1275 /** Frees the pointer move buffer. 
       
  1276 
       
  1277 This function should be called on a window which calls AllocPointerMoveBuffer(). */
       
  1278 	{
       
  1279 	if (iWsHandle)
       
  1280 		Write(EWsWinOpFreePointerMoveBuffer);
       
  1281 	}
       
  1282 
       
  1283 EXPORT_C void RWindowBase::EnablePointerMoveBuffer()
       
  1284 /** Enables the pointer move buffer for receiving pointer move events. 
       
  1285 
       
  1286 This function instructs the window server to begin putting pointer events 
       
  1287 into the pointer move buffer. AllocPointerMoveBuffer() must have previously 
       
  1288 been called, or a panic will occur.
       
  1289 
       
  1290 As soon as the pointer buffer has at least one point in it, the window server 
       
  1291 sends an event of type EEventPointerBufferReady to the client, and the events 
       
  1292 can be retrieved from the pointer move buffer using RetrievePointerMoveBuffer().
       
  1293 
       
  1294 Note: pointer move, drag and enter/exit events are not delivered to a window 
       
  1295 by default. An application using the pointer move buffer should use PointerFilter() 
       
  1296 to request that these events be delivered.
       
  1297 
       
  1298 @see DisablePointerMoveBuffer() */
       
  1299 	{
       
  1300 	Write(EWsWinOpEnablePointerMoveBuffer);
       
  1301 	}
       
  1302 
       
  1303 EXPORT_C void RWindowBase::DisablePointerMoveBuffer()
       
  1304 /** Instructs the window server to stop adding pointer events to the pointer move 
       
  1305 buffer. */
       
  1306 	{
       
  1307 	Write(EWsWinOpDisablePointerMoveBuffer);
       
  1308 	}
       
  1309 
       
  1310 EXPORT_C TInt RWindowBase::RetrievePointerMoveBuffer(TDes8 &aBuf) const
       
  1311 /** Retrieves events from the pointer move buffer. 
       
  1312 
       
  1313 Use this function to get pointer events from the pointer move buffer. This 
       
  1314 function should be called when an event has occurred of type EEventPointerBufferReady 
       
  1315 (defined in TEventCode).
       
  1316  
       
  1317 This function always causes a flush of the window server buffer.
       
  1318 
       
  1319 @param aBuf Buffer to store events retrieved from pointer move buffer 
       
  1320 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  1321 	{
       
  1322 	TInt maxPoints=aBuf.MaxSize()/sizeof(TPoint);
       
  1323 	return(WriteReplyP(&maxPoints,sizeof(maxPoints),&aBuf,EWsWinOpRetrievePointerMoveBuffer));
       
  1324 	}
       
  1325 
       
  1326 EXPORT_C void RWindowBase::DiscardPointerMoveBuffer()
       
  1327 /** Discards all events in the pointer move buffer. 
       
  1328 
       
  1329 The window server subsequently continues to put new pointer events into the 
       
  1330 pointer move buffer as usual (if the buffer is enabled). */
       
  1331 	{
       
  1332 	Write(EWsWinOpDiscardPointerMoveBuffer);
       
  1333 	}
       
  1334 
       
  1335 EXPORT_C TInt RWindowBase::AddKeyRect(const TRect &aRect, TInt aScanCode, TBool aActivatedByPointerSwitchOn)
       
  1336 /** Adds an on-screen key rectangle. 
       
  1337 
       
  1338 This function configures an area of the screen, given by aRect, to act as 
       
  1339 an on-screen key. Any subsequent pointer events within this area will be translated 
       
  1340 by the window server into key events with a scan code of aScanCode.
       
  1341 
       
  1342 aActivatedByPointerSwitchOn indicates whether or not to generate a key event 
       
  1343 as a result of a pointer event that acts to switch the machine on.
       
  1344 
       
  1345 Before v7.0, calling this function stopped the window from receiving pointer 
       
  1346 events (they were received as key events) and pointer events outside the specified 
       
  1347 key rectangle were discarded. From v7.0, pointer events outside the key rectangles 
       
  1348 are not discarded and may be handled.
       
  1349  
       
  1350 This function always causes a flush of the window server buffer.
       
  1351 
       
  1352 @param aRect Rectangle to act as an on-screen key, relative to the window 
       
  1353 origin 
       
  1354 @param aScanCode Scan code of key events generated by this on-screen key 
       
  1355 @param aActivatedByPointerSwitchOn If ETrue, a switch-on pointer event will 
       
  1356 produce a key event. If EFalse, a switch-on pointer event will not produce 
       
  1357 a key event. 
       
  1358 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  1359 @see RemoveAllKeyRects() */
       
  1360 	{
       
  1361 	TWsWinCmdAddKeyRect params(aRect, aScanCode, aActivatedByPointerSwitchOn);
       
  1362 	return(WriteReply(&params,sizeof(params),EWsWinOpAddKeyRect));
       
  1363 	}
       
  1364 
       
  1365 EXPORT_C void RWindowBase::RemoveAllKeyRects()
       
  1366 /** Removes all the on-screen keys that have been added to this window.
       
  1367 
       
  1368 After this function has been called, all pointer events are delivered to the window, 
       
  1369 reversing the effect of AddKeyRect().
       
  1370 
       
  1371 @see AddKeyRect() */
       
  1372 	{
       
  1373 	Write(EWsWinOpRemoveAllKeyRects);
       
  1374 	}
       
  1375 
       
  1376 EXPORT_C TInt RWindowBase::PasswordWindow(TPasswordMode aPasswordMode)
       
  1377 /** Makes this window the password window.
       
  1378 
       
  1379 Only one password window can exist concurrently. Another window may take over 
       
  1380 as the password window if either (a) the current password window calls this 
       
  1381 function with aPasswordMode=EPasswordCancel, or (b) the current password window 
       
  1382 is destroyed.
       
  1383  
       
  1384 This function always causes a flush of the window server buffer.
       
  1385 
       
  1386 @param aPasswordMode The type of password handling required. 
       
  1387 @return KErrNone if successful, KErrInUse if this function is called when another 
       
  1388 password window already exists, otherwise another of the system-wide error 
       
  1389 codes. 
       
  1390 
       
  1391 @deprecated */
       
  1392 	{
       
  1393 	return(WriteReplyInt(aPasswordMode,EWsWinOpPasswordWindow));
       
  1394 	}
       
  1395 
       
  1396 EXPORT_C void RWindowBase::FadeBehind(TBool aFade)
       
  1397 /** Sets whether or not all windows behind the current window, in the same window 
       
  1398 group, should be faded or unfaded. 
       
  1399 
       
  1400 This function can be used to fade all windows used by an application when 
       
  1401 a dialogue is displayed.
       
  1402 
       
  1403 Fading works on a count basis. Fading increases the fade count, while unfading 
       
  1404 decreases it. If the fade count is greater than zero the window will be drawn 
       
  1405 faded. Only when it drops back to zero will it stop being faded.
       
  1406 
       
  1407 This functionality is used to support nested dialogues. When bringing up a 
       
  1408 dialogue the rest of the application windows are faded. If an option is selected 
       
  1409 to launch another dialogue, the original dialogue is faded (fade count 1) 
       
  1410 and the remaining windows have their fade count increased to 2. When the dialogue 
       
  1411 is closed the fade count is reduced by one, which displays the original dialogue, 
       
  1412 but the remaining windows remain faded. They are only displayed when the other 
       
  1413 dialogue is closed and their fade count is reduced to zero.
       
  1414 
       
  1415 Note:
       
  1416 
       
  1417 Information is lost when a window is faded, so a redraw is required to restore 
       
  1418 the window content when it is unfaded (blank and backup windows deal with 
       
  1419 this themselves). A redraw is also required for the areas that were in shadow 
       
  1420 when the window was faded, since the shadowing also causes information loss. 
       
  1421 While a window is faded all drawing to that window will be adjusted appropriately 
       
  1422 by the window server.
       
  1423 
       
  1424 @param aFade ETrue to increase the fade count of all windows behind the current 
       
  1425 window (within the current window group), EFalse to reduce the fade count. 
       
  1426 @see RWindowTreeNode::SetFaded()
       
  1427 @see RWindowTreeNode::SetNonFading() */
       
  1428 	{
       
  1429 	WriteInt(aFade,EWsWinOpFadeBehind);
       
  1430 	}
       
  1431 
       
  1432 EXPORT_C TBool RWindowBase::IsFaded() const
       
  1433 /** Tests whether the current window is faded.
       
  1434  
       
  1435 This function always causes a flush of the window server buffer.
       
  1436 
       
  1437 @return ETrue if the current window is faded, otherwise EFalse. */
       
  1438 	{
       
  1439 	return WriteReply(EWsWinOpGetIsFaded);
       
  1440 	}
       
  1441 
       
  1442 EXPORT_C TBool RWindowBase::IsNonFading() const
       
  1443 /** Tests whether the current window is non-fading.
       
  1444  
       
  1445 This function always causes a flush of the window server buffer.
       
  1446 
       
  1447 @return ETrue if the current window is non-fading, otherwise EFalse. 
       
  1448 @see RWindowTreeNode::SetNonFading() */
       
  1449 	{
       
  1450 	return WriteReply(EWsWinOpGetIsNonFading);
       
  1451 	}
       
  1452 
       
  1453 EXPORT_C TInt RWindowBase::MoveToGroup(TInt aIdentifier)
       
  1454 /** Moves this window to another window group. 
       
  1455 
       
  1456 This function allows a window with a window group as its immediate parent 
       
  1457 to be moved from one window group to another one. The two window groups must 
       
  1458 be owned by the same client. The new parent window group is specified by its 
       
  1459 identifier.
       
  1460  
       
  1461 This function always causes a flush of the window server buffer.
       
  1462 
       
  1463 @param aIdentifier The identifier of the target window group. This is the 
       
  1464 value returned by RWindowGroup::Identifier(). 
       
  1465 @return KErrNone if successful, otherwise another of the system-wide error 
       
  1466 codes. An error is returned if an attempt is made to move the window between 
       
  1467 window groups in different clients. */
       
  1468 	{
       
  1469 	return WriteReplyInt(aIdentifier,EWsWinOpMoveToGroup);
       
  1470 	}
       
  1471 
       
  1472 /** This sets the background of the window to be the given surface.
       
  1473 
       
  1474 The surface will be stretched or compressed to fill the extent of the window.
       
  1475 The background is updated on screen when the window is next redrawn.
       
  1476 
       
  1477 When the window is moved, the surface will move with it. If the window is
       
  1478 resized, the surface will be similarly scaled. If a 1-1 pixel mapping is
       
  1479 required and the window size changes, the function will need to be called
       
  1480 again with a different TSurfaceId for a surface with the new size of the
       
  1481 window.
       
  1482 
       
  1483 The key color to use in chroma key composition mode is defined by the system,
       
  1484 for all TSurfaceId background windows to use. In alpha composition mode,
       
  1485 transparent black is used. The composition mode is determined by the screen
       
  1486 display mode: if the mode supports an alpha channel, alpha composition is used;
       
  1487 otherwise chroma key composition is used.
       
  1488 
       
  1489 @param aSurface  The surface to act as the background of the window
       
  1490 @return KErrNone on success or a system-wide error code.
       
  1491 @pre aSurface has been initialized.
       
  1492 @pre The window is either an RWindow or an RBlankWindow, or the client is
       
  1493 panicked with the code EWservPanicDrawable.
       
  1494 @pre The surface must be compatible with being composited on the screen this
       
  1495 window appears on; otherwise the client thread is panicked with code
       
  1496 EWservPanicIncompatibleSurface.
       
  1497 @post The window has its background set to be the surface.
       
  1498 @post The window is opaque.
       
  1499 @post The base area of the window is the full extent of the window.
       
  1500 @post A GCE surface layer has been created to associate the surface with a
       
  1501 location on screen.
       
  1502 @post The surface's content is in an undefined state, but the surface remains
       
  1503 initialized.
       
  1504 @post This function always causes a flush of the window server buffer.
       
  1505 
       
  1506 @publishedPartner
       
  1507 @prototype
       
  1508 */
       
  1509 EXPORT_C TInt RWindowBase::SetBackgroundSurface(const TSurfaceId& aSurface)
       
  1510 	{
       
  1511 	(void) aSurface;	//avoid unreferenced warning
       
  1512 	return KErrNotSupported;
       
  1513 	}
       
  1514 
       
  1515 
       
  1516 /**
       
  1517 This sets a surface to appear in front of the window's background within a 
       
  1518 given area of that window. 
       
  1519 
       
  1520 Any rendering performed by CWindowGc operations will appear in front of surface 
       
  1521 for the window. The TSurfaceConfiguration object contains the Surface ID and 
       
  1522 allows various surface presentation attributes to be specified. This describes 
       
  1523 the mapping from surface co-ordinates to screen co-ordinates, allowing for scaling, 
       
  1524 cropping, and rotation. 
       
  1525 
       
  1526 For details on the attributes see TSurfaceConfiguration.
       
  1527 
       
  1528 The composition mode is determined by the screen display mode: if the mode supports an 
       
  1529 alpha channel, alpha composition is used; otherwise chroma key composition is used. 
       
  1530 In chroma key composition mode, the key color used is defined by the system, for all 
       
  1531 TSurfaceId background windows to use. In alpha composition mode, transparent 
       
  1532 black is used.
       
  1533 
       
  1534 If the same surface ID is already set as the window background surface, then only 
       
  1535 the configuration parameters will be updated. 
       
  1536 
       
  1537 If the window already has a background surface (that is not same as the new surface) 
       
  1538 or then that surface will be removed and the new 
       
  1539 background surface will be set. The Surface ID will be registered while attached 
       
  1540 to this window. This is in addition to any call to RWsSession::RegisterSurface.
       
  1541 
       
  1542 @param aConfiguration The set of configuration that applies to the surface.
       
  1543 @param aTriggerRedraw If set causes WServ to repaint any affected portions of the display.
       
  1544 @return KErrNone on success or any system-wide error code
       
  1545 	- KErrNotSupported if surface support is not available
       
  1546 	- KErrNoMemory If a memory allocation fault occurs
       
  1547 	- KErrArgument If the surface ID is not accepted by the GCE 
       
  1548 @pre The window is either a RWindow or an RBlankWindow, or the client is panicked 
       
  1549 with the code EWservPanicDrawable.
       
  1550 @pre The surface is opaque; otherwise results are not defined.
       
  1551 @pre All members of the TSurfaceConfiguration recognised by the server must have valid 
       
  1552 values. If not, the client is panicked with code EWservPanicInvalidSurfaceConfiguration.
       
  1553 @pre The surface must not be the UI surface; otherwise the client thread is panicked 
       
  1554 with code EWservPanicInvalidSurface.
       
  1555 @pre The surface must not be the null surface ID; otherwise the client thread is 
       
  1556 panicked with code EWservPanicInvalidSurface.
       
  1557 @post The window has a new background surface set to be within the given area. Outside 
       
  1558 the area, the window’s background color will be visible.
       
  1559 @post The window must be redrawn before the surface becomes visible, and the surface's 
       
  1560 content will be visible after the composition and refresh. Composition of the surface 
       
  1561 will be automatically triggered if required. The aTriggerRedraw flush parameter will 
       
  1562 cause this redraw, or the client should cause a redraw after this call.
       
  1563 @post This function always causes a flush of the WServ session buffer.
       
  1564 @see RemoveBackgroundSurface
       
  1565 @see GetBackgroundSurface
       
  1566 
       
  1567 @publishedPartner
       
  1568 @prototype
       
  1569 */
       
  1570 EXPORT_C TInt RWindowBase::SetBackgroundSurface(const TSurfaceConfiguration& aConfiguration, TBool aTriggerRedraw)
       
  1571 	{
       
  1572 	(void) aConfiguration;	//avoid unreferenced warning
       
  1573 	(void) aTriggerRedraw;	//avoid unreferenced warning
       
  1574 	return KErrNotSupported;
       
  1575 	}
       
  1576 
       
  1577 
       
  1578 /**
       
  1579 This removes any background surface that has been set to the window.
       
  1580 
       
  1581 The surface ID registration associated with the window will be released. 
       
  1582 This is independent of any outstanding calls to RWsSession::RegisterSurface, 
       
  1583 which should be completed with a corresponding call to UnregisterSurface.
       
  1584 
       
  1585 The aTriggerRedraw parameter triggers a redraw of at least the affected 
       
  1586 areas of the window at the end of this method. 
       
  1587 
       
  1588 @param aTriggerRedraw If set causes WServ to repaint any affected portions of the display.
       
  1589 @post Any background surface associated with this window has been removed. The 
       
  1590 appearance on screen may not change until the window is redrawn and the next 
       
  1591 refresh occurs. The aTriggerRedraw parameter can be set to trigger this redrawing.
       
  1592 @post This function does not explicitly force a flush of the WServ session buffer. 
       
  1593 Internal reference counting will keep the Surface ID "live" until the client code 
       
  1594 has released any handles and provisioners, and WServ processes the buffered remove 
       
  1595 command, and the final frame containing this surface has finished being displayed.
       
  1596 @see SetBackgroundSurface
       
  1597 @see GetBackgroundSurface
       
  1598 
       
  1599 @publishedPartner
       
  1600 @prototype
       
  1601 */
       
  1602 EXPORT_C void RWindowBase::RemoveBackgroundSurface(TBool aTriggerRedraw)
       
  1603 	{
       
  1604 	(void) aTriggerRedraw;	//avoid unreferenced warning
       
  1605 	}
       
  1606 
       
  1607 
       
  1608 /**
       
  1609 Retrieves a copy of the current configuration for background surface attached to the window.
       
  1610 
       
  1611 The client must present a properly initialized TSurfaceConfiguration on entry – in 
       
  1612 particular the size field must be valid before the call. The server will then fill 
       
  1613 the object with the available data.
       
  1614 
       
  1615 If the server supports more fields it will truncate the returned data to the size the 
       
  1616 client has requested. If the server has fewer fields it will set the returned size 
       
  1617 field to the lower value. 
       
  1618 
       
  1619 Note that the returned attribute values will only be guaranteed equivalent to the 
       
  1620 input values, not exact copies, as the values may be calculated from internal flags 
       
  1621 rather than reported from a cached exact copy.
       
  1622 
       
  1623 @param aConfiguration
       
  1624 	- On entry the Size field specifies the maximum size of the object.
       
  1625 	- On return fields up to this size are filled in.
       
  1626 @return KErrNone on success or any system-wide error code
       
  1627 	- KErrNotFound The window does not have a background surface attached.
       
  1628 	- KErrNoMemory If a memory allocation fault occurs.
       
  1629 @pre The window is either a RWindow or an RBlankWindow, or the client is panicked 
       
  1630 with the code EWservPanicDrawable.
       
  1631 @pre The window has not been set as transparent, or the client is panicked with 
       
  1632 the code EWservPanicTransparencyMisuse.
       
  1633 @pre The Size member of the configuration must be an acceptable value. The size 
       
  1634 must match the Size() member of a defined TSurfaceConfiguration variant, or be 
       
  1635 larger than all variants known to the server. If not, the client is panicked with 
       
  1636 code EWservPanicInvalidSurfaceConfiguration.
       
  1637 @post aConfiguration object filled to specified size.
       
  1638 @post This function always causes a flush of the WServ session buffer.
       
  1639 @see SetBackgroundSurface
       
  1640 @see RemoveBackgroundSurface
       
  1641 
       
  1642 @publishedPartner
       
  1643 @prototype
       
  1644 */
       
  1645 EXPORT_C TInt RWindowBase::GetBackgroundSurface(TSurfaceConfiguration& aConfiguration) const
       
  1646 	{
       
  1647 	(void) aConfiguration;	//avoid unreferenced warning
       
  1648 	return KErrNotSupported;
       
  1649 	}
       
  1650 
       
  1651 /**
       
  1652 Not supported in non-NGA
       
  1653  */
       
  1654 EXPORT_C void RWindowBase::SetSurfaceTransparency(TBool aSurfaceTransparency)
       
  1655     {
       
  1656     (void) aSurfaceTransparency;
       
  1657     }
       
  1658 
       
  1659 /** This function returns the key color for the window, if used.
       
  1660 
       
  1661 In chroma key composition mode, this will be an opaque color; in alpha
       
  1662 composition mode, it will be transparent black, i.e. TRgb(0, 0, 0, 0). If the
       
  1663 window does not have a surface or overlay background, the return value is
       
  1664 transparent black.
       
  1665 
       
  1666 The value of a chroma key color depends on the background type. Windows with
       
  1667 surface backgrounds return the system defined key color, whereas windows with
       
  1668 overlay backgrounds return the color passed in.
       
  1669 
       
  1670 If the return value is opaque, the client should take care to avoid using the
       
  1671 color when rendering further content in the window, since it may cause that
       
  1672 content to become invisible.
       
  1673 
       
  1674 @return The key color used in this window, or transparent black.
       
  1675 @post This function always causes a flush of the window server buffer.
       
  1676 
       
  1677 @publishedPartner
       
  1678 @prototype
       
  1679 */
       
  1680 EXPORT_C TRgb RWindowBase::KeyColor() const
       
  1681 	{
       
  1682 	return KRgbBlack;
       
  1683 	}
       
  1684 
       
  1685 
       
  1686 // RDrawableWindow //
       
  1687 
       
  1688 void RDrawableWindow::doScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect, TInt aOpcode)
       
  1689 	{
       
  1690 	TWsWinCmdScroll scroll(aClipRect,aOffset,aRect);
       
  1691 	Write(&scroll,sizeof(scroll),aOpcode);
       
  1692 	}
       
  1693 
       
  1694 EXPORT_C void RDrawableWindow::Scroll(const TPoint &aOffset)
       
  1695 /** Scrolls the window contents by an offset. 
       
  1696 
       
  1697 All parts of an RWindow are either drawn with content copied from another 
       
  1698 part of the window or are invalidated. Areas are invalidated when the source 
       
  1699 content of the scroll would be outside the window or obscured behind another 
       
  1700 window. The areas that are invalidated are not blanked off.
       
  1701 
       
  1702 For example, if the window is scrolled towards the right, then there is no 
       
  1703 content (from outside the window) to move into area on the left hand side. 
       
  1704 This area is invalidated. Similarly, no content can be scrolled out from under 
       
  1705 an obscuring window, so the area from beneath the obscuring window is also 
       
  1706 invalidated.
       
  1707 
       
  1708 Note that for an RBackedUpWindow, the contents of areas obscured by other windows 
       
  1709 are stored. In this case the window contents are scrolled out from "underneath" 
       
  1710 the obscuring window. In the example above the area on the left was invalidated 
       
  1711 but for this type of window the area simply contains its old pre-scroll contents.
       
  1712 
       
  1713 @param aOffset Scroll offset, in pixels. Positive values cause the window 
       
  1714 contents to move downwards/right. Negative values cause contents to move upwards/left. */
       
  1715 	{
       
  1716 	doScroll(TRect(), aOffset, TRect(), EWsWinOpScroll);
       
  1717 	}
       
  1718 
       
  1719 EXPORT_C void RDrawableWindow::Scroll(const TRect &aClipRect,const TPoint &aOffset)
       
  1720 /** Scrolls the contents of a clip rectangle, independently of the other contents 
       
  1721 of the window.
       
  1722 
       
  1723 This function behaves in exactly the same way as the single parameter overload, 
       
  1724 except that the scroll region is a clipping rectangle rather than the whole window. 
       
  1725 All parts of the clipping rectangle are either drawn with content copied from 
       
  1726 another part of the rectangle or are invalidated.
       
  1727 
       
  1728 The RBackedUpWindow behaviour is also similar to the behaviour in the function 
       
  1729 above.
       
  1730 
       
  1731 @param aClipRect Rectangle to which scrolling is to be clipped 
       
  1732 @param aOffset Scroll offset, in pixels. Positive values cause the window contents 
       
  1733 to move downwards and right. Negative values cause contents to move upwards 
       
  1734 and left. */
       
  1735 	{
       
  1736 	doScroll(aClipRect, aOffset, TRect(), EWsWinOpScrollClip);
       
  1737 	}
       
  1738 
       
  1739 EXPORT_C void RDrawableWindow::Scroll(const TPoint &aOffset, const TRect &aRect)
       
  1740 /** Scrolls a rectangle within a window.
       
  1741 
       
  1742 This function effectively moves the specified rectangle by the given offset 
       
  1743 with respect to the window. The destination rectangle may overlap and cover 
       
  1744 the old rectangle.
       
  1745 
       
  1746 Note that if the source of this rectangle is an invalid area, ie it is obscured 
       
  1747 or lies outside the window, then this area in the destination rectangle will 
       
  1748 be invalidated.
       
  1749 
       
  1750 @param aOffset Scroll offset, in pixels. Positive values cause the window 
       
  1751 contents to move downwards and right. Negative values cause contents to move 
       
  1752 upwards and left. 
       
  1753 @param aRect The source rectangle for the scroll. */
       
  1754 	{
       
  1755 	doScroll(TRect(), aOffset, aRect, EWsWinOpScrollRect);
       
  1756 	}
       
  1757 
       
  1758 EXPORT_C void RDrawableWindow::Scroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
       
  1759 /** Scrolls the contents of a source rectangle within a clipping rectangle.
       
  1760 
       
  1761 The source rectangle is effectively copied from one position to another, with 
       
  1762 both the source and destination clipped to the clipping rectangle. Hence if 
       
  1763 the source and destination rectangles are inside the clipping region then 
       
  1764 this function behaves exactly like the Scroll(const TPoint &aOffset, const TRect &aRect) 
       
  1765 overload. However if the source or destination for the scrolled rectangle intersect 
       
  1766 the clipping rectangle then the function behaves similarly to the 
       
  1767 Scroll(const TRect &aClipRect,const TPoint &aOffset) overload, with regards to 
       
  1768 invalidated regions etc.
       
  1769 
       
  1770 @param aClipRect Rectangle to which scrolling is to be clipped.
       
  1771 @param aOffset Scroll offset, in pixels. Positive values cause the window contents 
       
  1772 to move downwards and right. Negative values cause contents to move upwards 
       
  1773 and left. 
       
  1774 @param aRect Source rectangle for the scroll. */
       
  1775 	{
       
  1776 	doScroll(aClipRect, aOffset, aRect, EWsWinOpScrollClipRect);
       
  1777 	}
       
  1778 
       
  1779 /**Protected system function.
       
  1780 
       
  1781 Sets the current redraw reference rectangle that is being drawn. 
       
  1782 This is called between a BeingRedraw() / EndRedraw() pair by the system.
       
  1783 
       
  1784 @param aRect Rectangle reference area that is currently being drawn.
       
  1785 @see GetDrawRect() */
       
  1786 void RDrawableWindow::SetDrawRect(const TRect &aRect)
       
  1787 	{
       
  1788 	iDrawRect = aRect;
       
  1789 	}
       
  1790 
       
  1791 /**Obtains the current rectangle being drawn to this window, during a window redraw cycle.
       
  1792 
       
  1793 This function can be called between a BeginRedraw() / EndRedraw() pair to obtain 
       
  1794 the current window redraw reference rectangle.
       
  1795 
       
  1796 @return The current reference rectangle that is being redrawn*/
       
  1797 EXPORT_C TRect RDrawableWindow::GetDrawRect() const
       
  1798 	{
       
  1799 	return iDrawRect;
       
  1800 	}
       
  1801 
       
  1802 EXPORT_C void RWindow::BeginRedraw(const TRect &aRect)
       
  1803 /** Begins the redraw of a rectangle within the window's invalid region.
       
  1804 
       
  1805 This method tells the window server that the window is about to respond to the 
       
  1806 last redraw event by redrawing the specified rectangle. This causes the window 
       
  1807 server to clear the rectangle, and remove it from the invalid region. 
       
  1808 
       
  1809 After the redraw is complete the window should call EndRedraw().
       
  1810 
       
  1811 Note:
       
  1812 
       
  1813 When handling a redraw event, this rectangle would typically be the rectangle 
       
  1814 returned by TWsRedrawEvent::Rect().
       
  1815 
       
  1816 The redraw is clipped to the area that is validated, i.e. the intersection 
       
  1817 of the rectangle with the previously invalid region.
       
  1818 
       
  1819 If you only validate part of the rectangle given in the redraw event then, 
       
  1820 after EndRedraw() is called, drawing will be clipped to the visible area which 
       
  1821 is not invalid. This is because drawing (that is non-redrawing) is always 
       
  1822 clipped to the visible region less the invalid region. You will get another 
       
  1823 message telling you to redraw the area that is still invalid. 
       
  1824 
       
  1825 @param aRect The rectangle to be redrawn. 
       
  1826 @see EndRedraw() */
       
  1827 	{
       
  1828 	WriteRect(aRect,EWsWinOpBeginRedraw);
       
  1829 	SetDrawRect(aRect);
       
  1830 	}
       
  1831 
       
  1832 EXPORT_C void RWindow::BeginRedraw()
       
  1833 /** Begins redrawing the window's invalid region. 
       
  1834 
       
  1835 This method tells the window server that the window is about to respond to 
       
  1836 the last redraw event by redrawing the entire invalid region. This causes 
       
  1837 the window server to validate the entire invalid region. 
       
  1838 
       
  1839 After the redraw is complete the entire region that was previously invalid 
       
  1840 is validated. The window should then call EndRedraw().
       
  1841 
       
  1842 Note: the redraw is clipped to the region that was previously invalid.
       
  1843 
       
  1844 This function always causes a flush of the window server buffer.
       
  1845 
       
  1846 @see EndRedraw() */
       
  1847 	{
       
  1848 	Write(EWsWinOpBeginRedrawFull);
       
  1849 	SetDrawRect(TRect(Size()));
       
  1850 	}
       
  1851 
       
  1852 EXPORT_C void RWindow::EndRedraw()
       
  1853 /** Ends the current redraw. 
       
  1854 
       
  1855 This function should be called when redrawing is complete. */
       
  1856 	{
       
  1857 	Write(EWsWinOpEndRedraw);
       
  1858 	SetDrawRect(TRect::EUninitialized);
       
  1859 	}
       
  1860 
       
  1861 EXPORT_C void RWindow::Invalidate(const TRect &aRect)
       
  1862 /** Invalidates an area within the window. 
       
  1863 
       
  1864 This function invalidates the specified rectangle, which causes the window 
       
  1865 to get a redraw message. This allows an application-initiated redraw of a 
       
  1866 specified rectangle.
       
  1867 
       
  1868 @param aRect Area to invalidate. */
       
  1869 	{
       
  1870 	WriteRect(aRect,EWsWinOpInvalidate);
       
  1871 	}
       
  1872 
       
  1873 EXPORT_C void RWindow::Invalidate()
       
  1874 /** Invalidates the entire window. 
       
  1875 
       
  1876 This function causes the window to get a redraw message specifying its entire 
       
  1877 visible area, allowing an application-initiated redraw. */
       
  1878 	{
       
  1879 	Write(EWsWinOpInvalidateFull);
       
  1880 	}
       
  1881 
       
  1882 EXPORT_C void RWindow::GetInvalidRegion(RRegion &aRegion) const
       
  1883 /** Gets the invalid region.
       
  1884 
       
  1885 Note: if there is not enough memory to create the region, the region's error flag 
       
  1886 will be set.
       
  1887  
       
  1888 This function always causes a flush of the window server buffer.
       
  1889 
       
  1890 @param aRegion On return, contains the invalid region. */
       
  1891 	{
       
  1892 	aRegion.Clear();
       
  1893 retry:
       
  1894 	TInt count=WriteReply(EWsWinOpGetInvalidRegionCount);
       
  1895 	if (count>0)
       
  1896 		{
       
  1897 		HBufC8 *rectBuf=NULL;
       
  1898 		TRAPD(err,rectBuf=HBufC8::NewMaxL(count*sizeof(TRect)));
       
  1899 		if (err==KErrNone)
       
  1900 			{
       
  1901 			TPtr8 des=rectBuf->Des();
       
  1902 			if (WriteReplyP(&count,sizeof(count),&des,EWsWinOpGetInvalidRegion))
       
  1903 				{
       
  1904 				User::Free(rectBuf);
       
  1905 				goto retry;
       
  1906 				}
       
  1907 			for(TInt index=0;index<count;index++)
       
  1908 				aRegion.AddRect(((TRect *)rectBuf->Ptr())[index]);
       
  1909 			User::Free(rectBuf);
       
  1910 			}
       
  1911 		else
       
  1912 			aRegion.ForceError();
       
  1913 		}
       
  1914 	}
       
  1915 
       
  1916 EXPORT_C void RWindow::SetBackgroundColor(TRgb aColor)
       
  1917 /** Sets the background colour used for clearing in server-initiated redraws. 
       
  1918 
       
  1919 The window will be cleared to its background colour when a window server-initiated 
       
  1920 redraw occurs. Background colour can be changed dynamically after a window 
       
  1921 has been created and activated, however, the new background colour will not 
       
  1922 be visible until the window has been redrawn.
       
  1923 
       
  1924 @param aColor Background colour to be used during redraws. */
       
  1925 	{
       
  1926 	WriteInt(aColor.Internal(),EWsWinOpSetBackgroundColor);
       
  1927 	}
       
  1928 
       
  1929 EXPORT_C void RWindow::SetBackgroundColor()
       
  1930 /** Sets the background colour used for clearing in server-initiated redraws to 
       
  1931 none. 
       
  1932 
       
  1933 The window will not be cleared to its background colour when a window server-initiated 
       
  1934 redraw occurs. 
       
  1935 
       
  1936 For a window on which SetTransparencyAlphaChannel() has been called, this function means
       
  1937 that the transparent window has no background.
       
  1938 
       
  1939 If a client calls this function for an opaque window, it is their responsibility to provide
       
  1940 opaque drawing to every pixel in the window (for example, a background bitmap). Otherwise,
       
  1941 undefined behaviour will result. */
       
  1942 	{
       
  1943 	Write(EWsWinOpSetNoBackgroundColor);
       
  1944 	}
       
  1945 
       
  1946 EXPORT_C TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aClientHandle)
       
  1947 /** Completes the construction of the window handle. 
       
  1948 
       
  1949 This method should be called after the RWindow() constructor, before any other 
       
  1950 functions are performed on the window. It creates a window in the window server 
       
  1951 corresponding to the RWindow object. The window is initialised to inherit 
       
  1952 the size and extent of its parent window, given by the first parameter. If its 
       
  1953 parent is a group window then it will be full screen.
       
  1954  
       
  1955 This function always causes a flush of the window server buffer.
       
  1956 
       
  1957 @param parent The window's parent. 
       
  1958 @param aClientHandle Client handle for the window. This is an integer value 
       
  1959 chosen by the client that must be unique within the current server session. The 
       
  1960 usual way of doing this is to cast the address of the object that owns the window 
       
  1961 to a TUint32; this allows event handlers which are given a window handle to obtain 
       
  1962 a reference to the window an event is intended for. For example, CCoeControl uses 
       
  1963 this technique when it constructs a window. Note that in GUI applications, every 
       
  1964 window is created and owned by a control. Therefore it is rare for 3rd party code 
       
  1965 to ever need to call a window's Construct() function directly.
       
  1966 
       
  1967 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  1968 	{
       
  1969 	return(construct(parent,aClientHandle,EWinRedraw,ENone));
       
  1970 	}
       
  1971 
       
  1972 EXPORT_C void RWindow::SetSize(const TSize &size)
       
  1973 /** Sets the size of a window. 
       
  1974 
       
  1975 This function may be called at any time after the window's Construct() function: 
       
  1976 the window's size will change dynamically.
       
  1977 
       
  1978 If the window size is increased, any new area will be cleared to the background 
       
  1979 colour and a redraw event will be generated for it.
       
  1980 
       
  1981 @param size The window size. */
       
  1982 	{
       
  1983 	WriteSize(size,EWsWinOpSetSize);
       
  1984 	}
       
  1985 
       
  1986 EXPORT_C void RWindow::SetExtent(const TPoint &pos,const TSize &size)
       
  1987 /** Sets the size and position of a window. 
       
  1988 
       
  1989 This function may be called at any time after the window's Construct() function: 
       
  1990 the window's extent will change dynamically.
       
  1991 
       
  1992 If the window size is increased, any new area will be cleared to the background 
       
  1993 colour and a redraw event will be generated for it.
       
  1994 
       
  1995 @param pos The position of the window's origin, relative to its parent. 
       
  1996 @param size The window size. 
       
  1997 @see RBackedUpWindow */
       
  1998 	{
       
  1999 	TWsWinCmdSetExtent setExtent(pos,size);
       
  2000 	Write(&setExtent,sizeof(setExtent),EWsWinOpSetExtent);
       
  2001 	}
       
  2002 
       
  2003 /** Enables or Disables the storing of redraw operations that do not 
       
  2004 intersect the viewport for a window.
       
  2005 
       
  2006 The window server stores operations required to redraw a window in a redraw 
       
  2007 store. Calling this function with ETrue causes all such drawing operations 
       
  2008 to be stored. The EnableRedrawStore(EFalse) call serves as a hint to store 
       
  2009 only the subset of draw commands which intersect the viewport.
       
  2010 
       
  2011 @param aEnabled Indicates whether the redraw store should be enabled or disabled. */
       
  2012 EXPORT_C void RWindow::EnableRedrawStore(TBool aEnabled)
       
  2013 	{
       
  2014 	WriteInt(aEnabled, EWsWinOpStoreDrawCommands);
       
  2015 	}
       
  2016 
       
  2017 /** Enables/Disables the WSERV to use its OSB
       
  2018 @param bool value that dertermines whether to trun OSB on or off
       
  2019 */
       
  2020 EXPORT_C void RWindow::EnableOSB(TBool aStatus)
       
  2021 	{
       
  2022 	if(aStatus)
       
  2023 		{
       
  2024 		Write(EWsWinOpEnableOSB);
       
  2025 		}
       
  2026 	else
       
  2027 		{
       
  2028 		Write(EWsWinOpDisableOSB);
       
  2029 		}
       
  2030 	}
       
  2031 
       
  2032 /** Clears the draw commands that are stored for this window from the redraw store.
       
  2033 	Windows that have had their redraw store cleared are not ready to draw again until 
       
  2034 	a new set of draw commands enclosed by BeginRedraw/EndRedraw have been issued.
       
  2035 */	
       
  2036 EXPORT_C void RWindow::ClearRedrawStore()
       
  2037 	{
       
  2038 	Write(EWsWinOpClearRedrawStore);
       
  2039 	}
       
  2040 	
       
  2041 EXPORT_C void RWindowGroup::SetOrdinalPriorityAdjust(TInt aAdjust)
       
  2042 /** Sets the window group's priority adjust value. 
       
  2043 
       
  2044 This function is primarily designed for sessions that own multiple window 
       
  2045 groups. After this function has been called by a window group, that window 
       
  2046 group's priority will be adjusted by the amount given by aAdjust whenever 
       
  2047 another window group owned by the same session gains keyboard focus.
       
  2048 
       
  2049 When the session loses focus, the priority returns to its original value.
       
  2050 
       
  2051 Note: This is ignored for window groups in chains.
       
  2052 
       
  2053 @param aAdjust Value to be added to window group's existing priority. */
       
  2054 	{
       
  2055 	WriteInt(aAdjust,EWsWinOpSetOrdinalPriorityAdjust);
       
  2056 	}
       
  2057 
       
  2058 EXPORT_C TInt RWindowGroup::SetOrdinalPositionErr(TInt aPos,TInt aOrdinalPriority)
       
  2059 /** Sets the ordinal position and ordinal priority of a window.
       
  2060  
       
  2061 Ordinal priority is a number assigned to a window that determines its position in the z-order. 
       
  2062 For a description of ordinal priority, see the RWindowTreeNode::SetOrdinalPosition function.
       
  2063 To set a priority of KPasswordWindowGroupPriority or greater, client will require 
       
  2064 SwEvent capability. If client does not have SwEvent capability then it will return error 
       
  2065 code.
       
  2066 
       
  2067 Note: If this window is a window group in a chain, then all other window groups in the chain will be moved also. 
       
  2068 And further they will all have their ordinal priority set to the specified value.
       
  2069 When this function is called on Window with aPos set to KOrdinalPositionSwitchToOwningWindow then the function 
       
  2070 doesn't change the ordinal position of the window, if instead it has focus then the window that would come to 
       
  2071 the forground if it died will be moved to the foreground.
       
  2072 
       
  2073 This function always causes a flush of the window server buffer.
       
  2074 
       
  2075 @param aPos The window's new ordinal position. The lower the ordinal, the closer to the 
       
  2076 front of the z-order the window will be. Specifying any negative value however, sends 
       
  2077 the window to the back of the z-order.
       
  2078 @param aOrdinalPriority The window's new ordinal priority.
       
  2079 @return	if not successful, one of the system-wide error codes. */
       
  2080 	{
       
  2081 	TWsWinCmdOrdinalPos ordinalPos;
       
  2082 	ordinalPos.pos=aPos;
       
  2083 	ordinalPos.ordinalPriority=aOrdinalPriority;
       
  2084 	return(WriteReply(&ordinalPos,sizeof(ordinalPos),EWsWinOpSetOrdinalPositionErr));
       
  2085 	}
       
  2086 
       
  2087 /**
       
  2088 Window transparency based on the use of a separate window mask bitmap has been 
       
  2089 deprecated. Calling this method method has no effect. For window transparency 
       
  2090 see the the support for window alpha channel.
       
  2091 
       
  2092 @see RWindow::SetTransparencyAlphaChannel() 
       
  2093 @deprecated
       
  2094 */
       
  2095 EXPORT_C void RWindow::HandleTransparencyUpdate()
       
  2096 	{
       
  2097 	// deprecated. this call does nothing. always return KErrNone.
       
  2098 	Write(EWsWinOpHandleTransparencyUpdate);
       
  2099 	}
       
  2100 
       
  2101 /**
       
  2102 The support for window transparency factor has been deprecated. Calling this 
       
  2103 method has no effect. For window transparency see the the support for window 
       
  2104 alpha channel.
       
  2105 
       
  2106 @param aTransparencyFactor Ignored.
       
  2107 @return	Always KErrNone.
       
  2108 @see RWindow::SetTransparencyAlphaChannel() 
       
  2109 @deprecated
       
  2110 */
       
  2111 EXPORT_C TInt RWindow::SetTransparencyFactor(const TRgb& aTransparencyFactor)
       
  2112 	{
       
  2113 	// deprecated. this call does nothing. always return KErrNone.
       
  2114 	return WriteReplyInt(aTransparencyFactor.Internal(), EWsWinOpSetTransparencyFactor);
       
  2115 	}
       
  2116 	
       
  2117 /**
       
  2118 Window transparency based on the use of a separate window mask bitmap has been 
       
  2119 deprecated. Calling this method method has no effect. For window transparency 
       
  2120 see the the support for window alpha channel.
       
  2121 
       
  2122 @param aTransparencyBitmap Ignored.
       
  2123 @return	Always KErrNone.
       
  2124 @see RWindow::SetTransparencyAlphaChannel() 
       
  2125 @deprecated
       
  2126 */
       
  2127 EXPORT_C TInt RWindow::SetTransparencyBitmap(const CFbsBitmap& aTransparencyBitmap)
       
  2128 	{
       
  2129 	// deprecated. this call does nothing. always return KErrNone.
       
  2130 	return WriteReplyInt(aTransparencyBitmap.Handle(), EWsWinOpSetTransparencyBitmap);	
       
  2131 	}
       
  2132 	
       
  2133 /**
       
  2134 Window transparency based on the use of a separate window mask bitmap has been 
       
  2135 deprecated. Calling this method method has no effect. For window transparency 
       
  2136 see the the support for window alpha channel.
       
  2137 
       
  2138 @param aTransparencyBitmap Ignored.
       
  2139 @return	Always KErrNone.
       
  2140 @see RWindow::SetTransparencyAlphaChannel() 
       
  2141 @deprecated
       
  2142 */
       
  2143 EXPORT_C TInt RWindow::SetTransparencyWsBitmap(const CWsBitmap& aTransparencyBitmap)
       
  2144 	{
       
  2145 	// deprecated. this call does nothing. always return KErrNone.
       
  2146 	return WriteReplyInt(aTransparencyBitmap.WsHandle(), EWsWinOpSetTransparencyBitmapCWs);
       
  2147 	}	
       
  2148 
       
  2149 /**
       
  2150 Window transparency based on the use of a separate window mask bitmap has been 
       
  2151 deprecated. Calling this method method has no effect. To guarantee a window being
       
  2152 opaque; see SetTransparentRegion().
       
  2153 
       
  2154 @see RWindow::SetTransparentRegion()
       
  2155 @deprecated
       
  2156 */
       
  2157 EXPORT_C void RWindow::SetNonTransparent()
       
  2158 	{}
       
  2159 
       
  2160 /**
       
  2161 Enables the use of an alpha channel to control the window's transparency.
       
  2162 
       
  2163 Note that the window's invalid area will be cleared using the window's 
       
  2164 background color before any drawing commence. Thus setting the background 
       
  2165 color to fully transparent is essential in most use cases.
       
  2166    
       
  2167 @see RWindow::SetBackgroundColor()
       
  2168 @return	KErrNone if successful, otherwise one of the system-wide error codes. */
       
  2169 EXPORT_C TInt RWindow::SetTransparencyAlphaChannel()
       
  2170 	{
       
  2171 	return WriteReply(EWsWinOpSetTransparencyAlphaChannel);
       
  2172 	}
       
  2173 
       
  2174 EXPORT_C TInt RWindow::SetTransparentRegion(const TRegion& aRegion)
       
  2175 /** Sets the user-defined transparent region of a window.
       
  2176 
       
  2177 This will replace the default transparent region in a transparent window which is normally the full window 
       
  2178 base area.
       
  2179 The area outside of the transparent region will be treated by window server as being opaque. The client
       
  2180 is responsible for ensuring that opaque drawing is present in all pixels of this area. If the client 
       
  2181 fails to do this, undefined behaviour will result.
       
  2182 It is possible to make the transparent window completely opaque by passing an empty region. Passing a region
       
  2183 equal to the window base area or larger will revert the window to its default behaviour (i.e. full window
       
  2184 transparency).
       
  2185 No screen content changes will occur immediately as a result of calling this function.
       
  2186  
       
  2187 This function applies to transparent window only and always causes a flush of the window server buffer.
       
  2188 
       
  2189 @param aRegion User defined windows's transparent region. 
       
  2190 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  2191 @see RWindow::SetTransparencyAlphaChannel() */
       
  2192 	{
       
  2193 	__ASSERT_ALWAYS(!aRegion.CheckError(),Panic(EW32PanicInvalidRegion));
       
  2194 	const TInt regionCount=aRegion.Count();
       
  2195 	TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
       
  2196 	return WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpSetTransparentRegion);
       
  2197 	}
       
  2198 
       
  2199 EXPORT_C TInt RWindow::SetTransparencyPolicy(TWsTransparencyPolicy aPolicy)
       
  2200 /** Sets the transparency policy of a window.
       
  2201 
       
  2202 No screen content changes will occur immediately as a result of calling this function.
       
  2203  
       
  2204 This function applies to transparent window only.
       
  2205 
       
  2206 @param aPolicy Transparent window policy. 
       
  2207 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  2208 @see TWsTransparencyPolicy */
       
  2209 	{
       
  2210 	return WriteReplyInt(aPolicy,EWsWinOpSetTransparencyPolicy);
       
  2211 	}
       
  2212 
       
  2213 
       
  2214 /** Returns whether the window uses a redraw store to store drawing commands.
       
  2215 
       
  2216 The current WServ implementation always uses a redraw store. Therefore this function always returns ETrue.
       
  2217 
       
  2218 This function always causes a flush of the window server buffer.
       
  2219 
       
  2220 @return ETrue 
       
  2221 @see RWindow::EnableRedrawStore()
       
  2222 @deprecated */
       
  2223 EXPORT_C TBool RWindow::IsRedrawStoreEnabled() const
       
  2224 	{
       
  2225 	return WriteReply(EWsWinOpIsRedrawStoreEnabled);
       
  2226 	}
       
  2227 
       
  2228 EXPORT_C TInt RWindowGroup::Construct(TUint32 aClientHandle)
       
  2229 /** Completes construction of a window group. 
       
  2230 
       
  2231 Construction must be complete before any other window group methods can be 
       
  2232 called.
       
  2233 
       
  2234 This function always causes a flush of the window server buffer.
       
  2235 
       
  2236 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  2237 for a description of the client handle.
       
  2238 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely 
       
  2239 of which is KErrNoMemory. 
       
  2240 @see RWindow::Construct() */
       
  2241 	{
       
  2242 	return(ConstructChildApp(0,aClientHandle,ETrue));
       
  2243 	}
       
  2244 
       
  2245 EXPORT_C TInt RWindowGroup::Construct(TUint32 aClientHandle,CWsScreenDevice* aScreenDevice) 
       
  2246 /** Completes construction of a window group on a screen. 
       
  2247 
       
  2248 Construction must be complete before any other window group methods can be 
       
  2249 called.
       
  2250 
       
  2251 This function always causes a flush of the window server buffer.
       
  2252 
       
  2253 @param aScreenDevice A screen device is used to specify on which screen the window should be. The screen device must exist for as long as the window 
       
  2254 is in use. Different screen devices for two different window groups in an application allow the windows to have different screen size modes and WSERV 
       
  2255 will automatically switch from one to the other when there is a screen size mode change.
       
  2256 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  2257 for a description of the client handle.
       
  2258 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely 
       
  2259 of which is KErrNoMemory. 
       
  2260 @see RWindow::Construct() */
       
  2261 	{
       
  2262 	return (Construct(0,aClientHandle,ETrue,aScreenDevice));
       
  2263 	}
       
  2264 
       
  2265 EXPORT_C TInt RWindowGroup::Construct(TUint32 aClientHandle,TBool aIsFocusable,CWsScreenDevice* aScreenDevice)
       
  2266 /** Completes construction of a window group on a screen. 
       
  2267 
       
  2268 Construction must be complete before any other window group methods can be called.
       
  2269 
       
  2270 The purpose of this Construct function for RWindowGroup is that it allows chains of window groups to be created on a specific screen. When one of 
       
  2271 the window groups in a chain is moved with SetOrdinalPosition then all window groups in that chain will be moved to be consecutative, 
       
  2272 with the parent being at the back in the Z-order. The purpose of this feature is to allow embedding of applications.
       
  2273 
       
  2274 Note: The term parent should not be confused with the paremeter used in the function RWindow::Construct.  There it means that this window 
       
  2275 is a child of that window in the tree.  Here is just means that the two window groups involved will have an extra association.
       
  2276 Note: This window group will be given the same ordinal priority as it's parent window group.
       
  2277 
       
  2278 This function always causes a flush of the window server buffer.
       
  2279 
       
  2280 @param aScreenDevice A screen device is used to specify on which screen the window should be. The screen device must exist for as long as the window 
       
  2281 is in use. Different screen devices for two different window groups in an application allow the windows to have different screen size modes and WSERV 
       
  2282 will automatically switch from one to the other when there is a screen size mode change.
       
  2283 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  2284 for a description of the client handle.
       
  2285 @param aIdOfParentWindowGroup The Identifier of the parent window group.
       
  2286 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely of which is KErrNoMemory. 
       
  2287 It will return KErrPermissionDenied if the requested parent has not allowed this window group to be its child, 
       
  2288 and it will return KErrInUse if the parent already has a child.
       
  2289 @see RWindow::Construct() */
       
  2290 	{
       
  2291 	return(Construct(0,aClientHandle,aIsFocusable,aScreenDevice));	
       
  2292 	}
       
  2293 	
       
  2294 EXPORT_C TInt RWindowGroup::Construct(TUint32 aClientHandle,TBool aIsFocusable)
       
  2295 /** Completes the construction of a window group, setting its initial focus state. 
       
  2296 
       
  2297 Construction must be complete before any other window group methods can be 
       
  2298 called.
       
  2299 
       
  2300 aInitialFocusState can be specified in order to prevent a window group from 
       
  2301 automatically taking the keyboard focus when it is created. If specified, 
       
  2302 it sets the initial focus state of the window group. If a window group has 
       
  2303 a focus state of ETrue (the default), it can receive keyboard focus; if EFalse, 
       
  2304 it is prevented from receiving keyboard focus until this setting is changed. 
       
  2305 If a window group is constructed without specifying an initial focus state, 
       
  2306 keyboard focus will be enabled by default and the window group will receive 
       
  2307 keyboard focus automatically when it is created. To prevent this, set aInitialFocusState 
       
  2308 to EFalse.
       
  2309 
       
  2310 This function always causes a flush of the window server buffer.
       
  2311 
       
  2312 @param aClientHandle The client's integer handle for the window. See RWindow::Construct() 
       
  2313 for a description of the client handle.
       
  2314 @param aIsFocusable Whether the window is focusable. Set ETrue for it to 
       
  2315 be able to receive focus, EFalse otherwise. 
       
  2316 @return KErrNone if successful, otherwise one of the system-wide error codes, 
       
  2317 the most likely of which is KErrNoMemory.
       
  2318 @see EnableReceiptOfFocus() 
       
  2319 @see RWindow::Construct() */
       
  2320 	{
       
  2321 	return(ConstructChildApp(0,aClientHandle,aIsFocusable));
       
  2322 	}
       
  2323 
       
  2324 EXPORT_C TInt RWindowGroup::ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle)
       
  2325 /** Completes construction of a window group. 
       
  2326 
       
  2327 Construction must be complete before any other window group methods can be called.
       
  2328 
       
  2329 The purpose of this Construct function for RWindowGroup is that it allows chains of window groups to be created. When one of 
       
  2330 the window groups in a chain is moved with SetOrdinalPosition then all window groups in that chain will be moved to be consecutative, 
       
  2331 with the parent being at the back in the Z-order. The purpose of this feature is to allow embedding of applications.
       
  2332 
       
  2333 Note: The term parent should not be confused with the paremeter used in the function RWindow::Construct.  There it means that this window 
       
  2334 is a child of that window in the tree.  Here is just means that the two window groups involved will have an extra association.
       
  2335 Note: This window group will be given the same ordinal priority as it's parent window group.
       
  2336 
       
  2337 This function always causes a flush of the window server buffer.
       
  2338 
       
  2339 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  2340 for a description of the client handle.
       
  2341 @param aIdOfParentWindowGroup The Identifier of the parent window group.
       
  2342 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely of which is KErrNoMemory. 
       
  2343 It will return KErrPermissionDenied if the requested parent has not allowed this window group to be its child, 
       
  2344 and it will return KErrInUse if the parent already has a child.
       
  2345 @see RWindow::Construct() */
       
  2346 	{
       
  2347 	return(ConstructChildApp(aIdOfParentWindowGroup,aClientHandle,ETrue));
       
  2348 	}
       
  2349 
       
  2350 TInt RWindowGroup::Construct(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable, CWsScreenDevice* aScreenDevice)
       
  2351 /** Completes construction of a window group on a screen. 
       
  2352 
       
  2353 Construction must be complete before any other window group methods can be called.
       
  2354 
       
  2355 This function always causes a flush of the window server buffer.
       
  2356 
       
  2357 @param aScreenDevice A screen device is used to specify on which screen the window should be. The screen device must exist for as long as the window 
       
  2358 is in use. Different screen devices for two different window groups in an application allow the windows to have different screen size modes and WSERV 
       
  2359 will automatically switch from one to the other when there is a screen size mode change.
       
  2360 @param aClientHandle The client's handle for the window. See RWindow::Construct() for a description of the client handle.
       
  2361 @param aIdOfParentWindowGroup The Identifier of the parent window group.
       
  2362 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely of which is KErrNoMemory. 
       
  2363 It will return KErrPermissionDenied if the requested parent has not allowed this window group to be its child, 
       
  2364 and it will return KErrInUse if the parent already has a child.
       
  2365 @param aIsFocusable Whether the window is focusable. Set ETrue for it to be able to receive focus, EFalse otherwise. 
       
  2366 @panic TW32Panic 17 in debug builds if called on an already constructed object.
       
  2367 @see RWindow::Construct() */
       
  2368 	{
       
  2369 	__ASSERT_DEBUG(iWsHandle == KNullHandle, Panic(EW32PanicGraphicDoubleConstruction));
       
  2370 	TWsClCmdCreateWindowGroup create;
       
  2371 	create.clientHandle=aClientHandle;
       
  2372 	create.focus=aIsFocusable;
       
  2373 	create.parentId=aIdOfParentWindowGroup;
       
  2374 	create.screenDeviceHandle = (aScreenDevice) ? aScreenDevice->WsHandle() : 0;
       
  2375 	
       
  2376 	TInt ret;
       
  2377 	if ((ret=iBuffer->WriteReplyWs(&create,sizeof(create),EWsClOpCreateWindowGroup))<0)
       
  2378 		{
       
  2379 		return ret;
       
  2380 		}
       
  2381 	iWsHandle=ret;
       
  2382 	return KErrNone;
       
  2383 	}
       
  2384 
       
  2385 EXPORT_C TInt RWindowGroup::ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable)
       
  2386 /** Completes construction of a window group. 
       
  2387 
       
  2388 Construction must be complete before any other window group methods can be called.
       
  2389 
       
  2390 This Construct function of RWindowGroup allows both the creation of the group window in a chain and for and for it not to recieve focus.  
       
  2391 
       
  2392 This function always causes a flush of the window server buffer.
       
  2393 
       
  2394 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  2395 for a description of the client handle.
       
  2396 @param aIdOfParentWindowGroup The Identifier of the parent window group.
       
  2397 @return KErrNone if successful, otherwise one of the system-wide error codes, the most likely of which is KErrNoMemory. 
       
  2398 It will return KErrPermissionDenied if the requested parent has not allowed this window group to be its child, 
       
  2399 and it will return KErrInUse if the parent already has a child.
       
  2400 @param aIsFocusable Whether the window is focusable. Set ETrue for it to be able to receive focus, EFalse otherwise. 
       
  2401 @see RWindow::Construct() */
       
  2402 	{
       
  2403 	return (Construct(aIdOfParentWindowGroup,aClientHandle,aIsFocusable,NULL));
       
  2404 	}
       
  2405     
       
  2406 EXPORT_C void RWindowGroup::AllowProcessToCreateChildWindowGroups(TUid aProcessSID)
       
  2407 /** Allows a Window Group in the specified process to be be a child of this one
       
  2408 
       
  2409 This function will need to be called to allow another window group to become a child window group of this one.
       
  2410 
       
  2411 This function always causes a flush of the window server buffer.
       
  2412 
       
  2413 @param aProcessSID This is the process security Id of the process that will be allowed to make child window groups*/
       
  2414 	{
       
  2415 	WriteReplyInt(aProcessSID.iUid,EWsWinOpAllowChildWindowGroup);		//Use WriteReply to cause it to flush
       
  2416 	}
       
  2417 
       
  2418 EXPORT_C void RWindowGroup::EnableReceiptOfFocus(TBool aState)
       
  2419 /** Enables or disables receipt of keyboard focus.
       
  2420 
       
  2421 The front most focusable window has keyboard focus. This function sets whether 
       
  2422 or not the window can receive keyboard focus.
       
  2423 
       
  2424 @param aState Whether this window group can accept keyboard focus. */
       
  2425 	{
       
  2426 	WriteInt(aState,EWsWinOpReceiveFocus);
       
  2427 	}
       
  2428 
       
  2429 EXPORT_C void RWindowGroup::AutoForeground(TBool aState)
       
  2430 /** Sets or disables auto-foreground behaviour. 
       
  2431 
       
  2432 If this behaviour is set for a window, it will automatically be given ordinal 
       
  2433 position zero whenever a pointer event of type EButton1Down occurs in any 
       
  2434 of its child windows. This will cause it to be brought to the foreground, 
       
  2435 unless another window group exists with a higher priority.
       
  2436 
       
  2437 A window group that is moved to the foreground will automatically get keyboard 
       
  2438 focus unless it has explicitly had receipt-of-focus disabled or there is a 
       
  2439 focusable window group of higher priority. See EnableReceiptOfFocus().
       
  2440 
       
  2441 @param aState Whether this group should be automatically brought to the foreground 
       
  2442 on an EButton1Down. */
       
  2443 	{
       
  2444 	WriteInt(aState,EWsWinOpAutoForeground);
       
  2445 	}
       
  2446 
       
  2447 TInt32 RWindowGroup::doCaptureKey(TUint aKey, TUint aModifierMask, TUint aModifiers, TInt aPriority, TInt aOpcode)
       
  2448 	{
       
  2449 	TWsWinCmdCaptureKey captureKey;
       
  2450 
       
  2451 	captureKey.key=aKey;
       
  2452 	captureKey.modifiers=aModifiers;
       
  2453 	captureKey.modifierMask=aModifierMask;
       
  2454 	captureKey.priority=aPriority;
       
  2455 
       
  2456 	return(WriteReply(&captureKey,sizeof(captureKey),aOpcode));
       
  2457 	}
       
  2458 
       
  2459 void RWindowGroup::doCancelCaptureKey(TInt32 aCaptureKeyHandle, TInt aOpcode)
       
  2460 	{
       
  2461 	if (iWsHandle && aCaptureKeyHandle)
       
  2462 		WriteReplyInt(aCaptureKeyHandle,aOpcode);
       
  2463 	}
       
  2464 
       
  2465 EXPORT_C TInt32 RWindowGroup::CaptureKey(TUint aKeyCode, TUint aModifierMask, TUint aModifiers)
       
  2466 /** Requests key capture.
       
  2467 
       
  2468 This function instructs the window server to send key events (of type EEventKey) 
       
  2469 with the specified key code and modifier state to this window group, regardless 
       
  2470 of which window group currently has the keyboard focus. 
       
  2471 
       
  2472 Key events for the key given by aKeyCode are captured only when the modifier keys 
       
  2473 specified by aModifierMask are in the states specified by aModifier. For example, 
       
  2474 calling  
       
  2475 @code
       
  2476 wsGroup->CaptureKey(EKeyDevice2, EModifierAlt|EModifierCtrl, EModifierCtrl); 
       
  2477 @endcode
       
  2478 will capture the EKeyDevice2 key only if Ctrl is pressed and Alt is not.
       
  2479 
       
  2480 Normally, keyboard key presses result in three events being delivered to the client: 
       
  2481 EEventKeyDown, EEventKey and EEventKeyUp. However, CaptureKey() results in only 
       
  2482 the EEventKey being delivered to the window group that called it: the EEventKeyUp 
       
  2483 and EEventKeyDown events are sent to the window group that has focus. If a window 
       
  2484 group wishes to capture the EEventKeyUp and EEventKeyDown events as well as the 
       
  2485 EEventKey, it should call CaptureKeyUpAndDowns().
       
  2486 
       
  2487 Note that a window group can call this function more than once (to request capture 
       
  2488 for more than one key), and more than one window group may have requested key 
       
  2489 capture. If multiple window groups have requested to capture the same key using 
       
  2490 this function, the key is sent to the window group that most recently requested 
       
  2491 the key capture.
       
  2492 
       
  2493 This function always causes a flush of the window server buffer.
       
  2494 
       
  2495 @param aKeyCode The key code for the key to be captured. Key codes for special 
       
  2496 keys are defined in TKeyCode. 
       
  2497 @param aModifierMask Bitmask that identifies the modifier keys of interest. 
       
  2498 Possible values are defined in TEventModifier.
       
  2499 @param aModifiers Bitmask that identifies which of the modifier keys in 
       
  2500 aModifierMask need to be set and which need to be unset. For example, see the 
       
  2501 description above. 
       
  2502 @return A handle identifying the capture key, or one of the system-wide error 
       
  2503 codes (if <0). KErrPermissionDenied indicates that the requested key cannot be 
       
  2504 captured by this window group, because it has been protected by another window group. 
       
  2505 For more information, see the PROTECTEDKEY parameter in wsini.ini. 
       
  2506 Handles should be kept in order to be passed to CancelCaptureKey() 
       
  2507 later. KErrPermissionDenied, if 
       
  2508 @capability SwEvent */
       
  2509 	{
       
  2510 	return(doCaptureKey(aKeyCode, aModifierMask, aModifiers, 0, EWsWinOpCaptureKey));
       
  2511 	}
       
  2512 
       
  2513 EXPORT_C TInt32 RWindowGroup::CaptureKey(TUint aKeyCode, TUint aModifierMask, TUint aModifiers, TInt aPriority)
       
  2514 /** Requests key capture, with a priority.
       
  2515 
       
  2516 This function instructs the window server to send key events (of type EEventKey) 
       
  2517 with the specified key code and modifier state to this window group, regardless 
       
  2518 of which window group currently has the keyboard focus. 
       
  2519 
       
  2520 Key events for the key given by aKeyCode are captured only when the modifier keys 
       
  2521 specified by aModifierMask are in the states specified by aModifier. For example, 
       
  2522 calling  
       
  2523 @code
       
  2524 wsGroup->CaptureKey(EKeyDevice2, EModifierAlt|EModifierCtrl, EModifierCtrl, priority); 
       
  2525 @endcode
       
  2526 will capture the EKeyDevice2 key only if Ctrl is pressed and Alt is not.
       
  2527 
       
  2528 Normally, keyboard key presses result in three events being delivered to the client: 
       
  2529 EEventKeyDown, EEventKey and EEventKeyUp. However, CaptureKey() results in only 
       
  2530 the EEventKey being delivered to the window group that called it: the EEventKeyUp 
       
  2531 and EEventKeyDown events are sent to the window group that has focus. If a window 
       
  2532 group wishes to capture the EEventKeyUp and EEventKeyDown events as well as the 
       
  2533 EEventKey, it should call CaptureKeyUpAndDowns().
       
  2534 
       
  2535 Note that a window group can call this function more than once (to request capture 
       
  2536 for more than one key), and more than one window group may have requested key 
       
  2537 capture. If multiple window groups have requested to capture the same key at the 
       
  2538 same priority, the key is sent to the window group that most recently requested 
       
  2539 the key capture.
       
  2540 
       
  2541 This function always causes a flush of the window server buffer.
       
  2542 
       
  2543 @param aKeyCode The key code for the key to be captured. Key codes for special 
       
  2544 keys are defined in TKeyCode. 
       
  2545 @param aModifierMask Bitmask that identifies the modifier keys of interest. 
       
  2546 Possible values are defined in TEventModifier.
       
  2547 @param aModifiers Bitmask that identifies which of the modifier keys in 
       
  2548 aModifierMask need to be set and which need to be unset. For example, see the 
       
  2549 description above. 
       
  2550 @param aPriority A priority value - if more than one window group has requested 
       
  2551 capture for the same key event, the one with the highest priority will capture it.
       
  2552 @return A handle identifying the capture key, or one of the system-wide error 
       
  2553 codes (if <0). KErrPermissionDenied indicates that the requested key cannot be 
       
  2554 captured by this window group, because it has been protected by another window group. 
       
  2555 For more information, see the PROTECTEDKEY parameter in wsini.ini. Handles should be 
       
  2556 kept in order to be passed to CancelCaptureKey() later. 
       
  2557 @capability SwEvent */	{
       
  2558 	return(doCaptureKey(aKeyCode, aModifierMask, aModifiers, aPriority, EWsWinOpCaptureKey));
       
  2559 	}
       
  2560 
       
  2561 EXPORT_C void RWindowGroup::CancelCaptureKey(TInt32 aHotKey)
       
  2562 /** Cancels a request for key capture. 
       
  2563 
       
  2564 Use this function to cancel a request to capture a key previously made with 
       
  2565 CaptureKey(). If the value passed in aHotKey is not a valid capture key 
       
  2566 handle, this function will cause a panic.
       
  2567 
       
  2568 This function always causes a flush of the window server buffer.
       
  2569 
       
  2570 @param aHotKey The key for which the capture request is cancelled. */
       
  2571 	{
       
  2572 	doCancelCaptureKey(aHotKey, EWsWinOpCancelCaptureKey);
       
  2573 	}
       
  2574 
       
  2575 EXPORT_C TInt32 RWindowGroup::CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifiers)
       
  2576 /** Requests the capture of key-up and key-down events on behalf of a window group.
       
  2577 
       
  2578 This function requests the window server to send EEventKeyUp and EEventKeyDown 
       
  2579 key events from the specified key to this window group, regardless of which 
       
  2580 window group currently has the keyboard focus. This contrasts with CaptureKey(), 
       
  2581 which causes the window server to send the EEventKey event.
       
  2582 
       
  2583 Key events for the key given by aScanCode are captured only when the modifier 
       
  2584 keys specified by aModifierMask are in the states specified by aModifiers. 
       
  2585 See RWsSession::SetHotKey() for examples of how to set aModifierMask and aModifiers.
       
  2586 
       
  2587 Note: in general, keyboard key presses result in three events being delivered to 
       
  2588 the client: EEventKeyDown, EEventKey and EEventKeyUp.
       
  2589 
       
  2590 This function always causes a flush of the window server buffer.
       
  2591 
       
  2592 @param aScanCode Scan code for the key to be captured. Scan codes are defined 
       
  2593 in TStdScanCode. 
       
  2594 @param aModifierMask Bitmask that identifies the modifier keys of interest. 
       
  2595 Possible values are defined in TEventModifier. 
       
  2596 @param aModifiers Bitmask that identifies which of the modifier keys in 
       
  2597 aModifierMask need to be set and which need to be unset. 
       
  2598 @return A handle identifying the capture key, or one of the system-wide error 
       
  2599 codes (if < 0). KErrPermissionDenied indicates that the requested key cannot be 
       
  2600 captured by this window group, because it has been protected by another window group. 
       
  2601 For more information, see the PROTECTEDKEY parameter in wsini.ini. Handles should be 
       
  2602 kept in order to be passed to CancelCaptureKeyUpAndDowns() later.
       
  2603 @capability SwEvent */
       
  2604 	{
       
  2605 	return(doCaptureKey(aScanCode, aModifierMask, aModifiers, 0, EWsWinOpCaptureKeyUpsAndDowns));
       
  2606 	}
       
  2607 
       
  2608 EXPORT_C TInt32 RWindowGroup::CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifiers, TInt aPriority)
       
  2609 /** Requests the capture of key-up and key-down events on behalf of a window group.
       
  2610 This function is identical to the other overload, except that it allows a priority to be specified.
       
  2611 This function always causes a flush of the window server buffer.
       
  2612 @param aScanCode Scan code for the key to be captured. Scan codes are defined 
       
  2613 in TStdScanCode. 
       
  2614 @param aModifierMask Bitmask that identifies the modifier keys of interest. 
       
  2615 Possible values are defined in TEventModifier. 
       
  2616 @param aModifiers Bitmask that identifies which of the modifier keys in 
       
  2617 aModifierMask need to be set and which need to be unset. 
       
  2618 @param aPriority A priority value - if more than one window group has requested 
       
  2619 capture for the same key event, the one with the highest priority will capture it.
       
  2620 @return A handle identifying the capture key, or one of the system-wide error 
       
  2621 codes (if < 0). KErrPermissionDenied indicates that the requested key cannot be captured by this 
       
  2622 window group, because it has been protected by another window group. For more information, see 
       
  2623 the PROTECTEDKEY parameter in wsini.ini. Handles should be kept in order to be passed to 
       
  2624 CancelCaptureKeyUpAndDowns() later.
       
  2625 @capability SwEvent */
       
  2626 	{
       
  2627 	return(doCaptureKey(aScanCode, aModifierMask, aModifiers, aPriority, EWsWinOpCaptureKeyUpsAndDowns));
       
  2628 	}
       
  2629 
       
  2630 EXPORT_C void RWindowGroup::CancelCaptureKeyUpAndDowns(TInt32 aHotKey)
       
  2631 /** Cancels a capture request for a key up or key down event. 
       
  2632 
       
  2633 Use this function to cancel a request to capture a key, previously made with 
       
  2634 CaptureKeyUpAndDowns(). If the value passed in aHotKey is not a valid 
       
  2635 capture key handle, this function will cause a panic.
       
  2636 
       
  2637 This function always causes a flush of the window server buffer.
       
  2638 
       
  2639 @param aHotKey Cancels the request to capture this key. */
       
  2640 	{
       
  2641 	doCancelCaptureKey(aHotKey, EWsWinOpCancelCaptureKeyUpsAndDowns);
       
  2642 	}
       
  2643 
       
  2644 EXPORT_C TInt32 RWindowGroup::CaptureLongKey(TUint aInputKeyCode,TUint aOutputKeyCode,TUint aModifierMask,TUint aModifiers
       
  2645 																											,TInt aPriority,TUint aFlags)
       
  2646 /** Requests capture of long key presses.
       
  2647 
       
  2648 This function causes the window server to send a long key event (which 
       
  2649 is generated when the key has been held down for the initial keyboard 
       
  2650 repeat time), to this window group, regardless of whether it currently has 
       
  2651 keyboard focus. The key that is output can have a different key code to the 
       
  2652 key that was captured.
       
  2653 
       
  2654 Key events for the key given by aInputKeyCode are captured only when the modifier 
       
  2655 keys specified by aModifierMask are in the states specified by aModifiers.
       
  2656 
       
  2657 A priority can be specified to resolve any conflicts that arise when multiple 
       
  2658 window groups attempt to capture the same long key event.
       
  2659 
       
  2660 Normal key press behaviour (where no long key press capture requests have been 
       
  2661 made) is as follows. When a key is pressed, a key down event occurs, followed by 
       
  2662 one or more standard (short) key events, followed by a key up event. All of 
       
  2663 these key events are sent to the application in the foreground.
       
  2664 
       
  2665 Key press behaviour when an application has made a long key press capture request 
       
  2666 is as follows. When the key is pressed and held down, a long key event is generated 
       
  2667 in addition to the events described above (although if a long key event occurs, 
       
  2668 then there will never be more than one standard key event) and this is sent to the 
       
  2669 application that made the request, even if it is not in the foreground. 
       
  2670 
       
  2671 If that application also wants to capture the up and down key events then it needs to call 
       
  2672 CaptureKeyUpAndDowns(). If it wants to capture the standard key event, then it needs to 
       
  2673 call CaptureKey(). Depending on flags (enumerated in TLongCaptureFlags) specified when making 
       
  2674 the long key capture request, the standard key event can either be generated when the key is 
       
  2675 pressed, as it would be if no long key capture request had been made, or it can be generated 
       
  2676 when the key is released. In the latter case, the standard key event is only generated if the 
       
  2677 key was not held down long enough to generate a long key event.
       
  2678 
       
  2679 This function always causes a flush of the window server buffer.
       
  2680 
       
  2681 @param aInputKeyCode The key code for the key to be captured. Key codes for 
       
  2682 special keys are defined in TKeyCode.
       
  2683 @param aOutputKeyCode The key code that will be output.
       
  2684 @param aModifierMask Only the modifier keys in this mask are tested against 
       
  2685 the states specified in aModifier.
       
  2686 @param aModifiers The key is captured only when the modifier keys specified 
       
  2687 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
       
  2688 not set. Modifier key states are defined in TEventModifier. 
       
  2689 @param aPriority If more than one window group has requested capture for the 
       
  2690 same long key event, the one with the highest priority will capture the event.
       
  2691 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
       
  2692 enum.
       
  2693 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
       
  2694 function.
       
  2695 @see TLongCaptureFlags 
       
  2696 @capability SwEvent */
       
  2697 	{
       
  2698 	return(CaptureLongKey(TTimeIntervalMicroSeconds32(-1),aInputKeyCode,aOutputKeyCode,aModifierMask,aModifiers,aPriority,aFlags));
       
  2699 	}
       
  2700 
       
  2701 EXPORT_C TInt32 RWindowGroup::CaptureLongKey(TTimeIntervalMicroSeconds32 aRepeatTime,TUint aInputKeyCode,TUint aOutputKeyCode
       
  2702 																	,TUint aModifierMask,TUint aModifiers,TInt aPriority,TUint aFlags)
       
  2703 /** Requests capture of long key presses.
       
  2704 
       
  2705 This function causes the window server to send a long key event (which 
       
  2706 is generated when the key has been held down for the specified time), 
       
  2707 to this window group, regardless of whether it currently has 
       
  2708 keyboard focus.
       
  2709 
       
  2710 For more information on this function, see the other CaptureLongKey() overload.
       
  2711 
       
  2712 This function always causes a flush of the window server buffer.
       
  2713 
       
  2714 @param aRepeatTime The time interval in microseconds between the initial 
       
  2715 key event and the first auto repeat.
       
  2716 @param aInputKeyCode The key code for the key to be captured. Key codes for 
       
  2717 special keys are defined in TKeyCode.
       
  2718 @param aOutputKeyCode The key code that will be output.
       
  2719 @param aModifierMask Only the modifier keys in this mask are tested against 
       
  2720 the states specified in aModifier.
       
  2721 @param aModifiers The key is captured only when the modifier keys specified 
       
  2722 in aModifierMask match these states, where 1 = modifier set, and 0 = modifier 
       
  2723 not set. Modifier key states are defined in TEventModifier. 
       
  2724 @param aPriority If more than one window group has requested capture for the 
       
  2725 same long key event, the one with the highest priority will capture the event.
       
  2726 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
       
  2727 enum.
       
  2728 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
       
  2729 function.
       
  2730 @see TLongCaptureFlags
       
  2731 @capability SwEvent */
       
  2732 	{
       
  2733 	TWsWinCmdCaptureLongKey captureKey(aModifiers,aModifierMask,aInputKeyCode,aOutputKeyCode,aRepeatTime,aPriority,aFlags);
       
  2734 	return(WriteReply(&captureKey,sizeof(captureKey),EWsWinOpCaptureLongKey));
       
  2735 	}
       
  2736 
       
  2737 EXPORT_C void RWindowGroup::CancelCaptureLongKey(TInt32 aCaptureKey)
       
  2738 /** Cancels a previous long key capture request.
       
  2739 
       
  2740 This function always causes a flush of the window server buffer.
       
  2741 
       
  2742 @param aCaptureKey The value returned by the previous call to CaptureLongKey(). 
       
  2743 Identifies which long key capture request to cancel. */
       
  2744 	{
       
  2745 	doCancelCaptureKey(aCaptureKey, EWsWinOpCancelCaptureLongKey);
       
  2746 	}
       
  2747 
       
  2748 EXPORT_C TInt RWindowGroup::AddPriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifiers)
       
  2749 /** Adds a priority key. 
       
  2750 
       
  2751 Priority key events are typically used for providing "Abort" or "Escape" keys 
       
  2752 for an application. For priority key events to occur they must first be configured 
       
  2753 using this function. Functions provided by RWsSession can then be used to 
       
  2754 get priority key events. Note that unlike other events, the Control Framework 
       
  2755 does not get priority key events for you.
       
  2756 
       
  2757 Priority key events for the key given by aKeyCode are only delivered when 
       
  2758 the modifier keys specified by aModifierMask are in the states specified by 
       
  2759 aModifiers. See RWsSession::SetHotKey() for examples of how to use aModifierMask 
       
  2760 and aModifiers.
       
  2761 
       
  2762 More than one priority key can be added for each keycode, each having a different 
       
  2763 set of modifier requirements.
       
  2764 
       
  2765 Note: if you press a priority key while another is waiting to be sent to the client 
       
  2766 then the first key is lost.
       
  2767 
       
  2768 This function always causes a flush of the window server buffer.
       
  2769 
       
  2770 @param aKeycode The priority key to be added. 
       
  2771 @param aModifierMask Only the modifier keys in this mask are tested against 
       
  2772 the states specified in aModifiers. 
       
  2773 @param aModifiers Key is captured only when modifier keys specified in aModifierMask 
       
  2774 match these states, where 1 = modifier key on, and 0 = modifier key off. Modifier 
       
  2775 key states are defined in TEventModifier. 
       
  2776 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  2777 	{
       
  2778 	TWsWinCmdPriorityKey priorityKey;
       
  2779 
       
  2780 	priorityKey.keycode=aKeycode;
       
  2781 	priorityKey.modifiers=aModifiers;
       
  2782 	priorityKey.modifierMask=aModifierMask;
       
  2783 	return(WriteReply(&priorityKey,sizeof(priorityKey),EWsWinOpAddPriorityKey));
       
  2784 	}
       
  2785 
       
  2786 EXPORT_C void RWindowGroup::RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifier)
       
  2787 /** Removes a priority key. 
       
  2788 
       
  2789 Use this function to remove a priority key that was added using AddPriorityKey(). 
       
  2790 If the specified priority key does not exist, this function does nothing.
       
  2791 
       
  2792 Note: all 3 parameters must match exactly for a successful removal.
       
  2793 
       
  2794 @param aKeycode Key code for the priority key to be removed 
       
  2795 @param aModifierMask Modifier mask for the priority key to be removed 
       
  2796 @param aModifier Modifier states for the priority key to be removed */
       
  2797 	{
       
  2798 	if (iWsHandle)
       
  2799 		{
       
  2800 		TWsWinCmdPriorityKey priorityKey;
       
  2801 
       
  2802 		priorityKey.keycode=aKeycode;
       
  2803 		priorityKey.modifiers=aModifier;
       
  2804 		priorityKey.modifierMask=aModifierMask;
       
  2805 		Write(&priorityKey,sizeof(priorityKey),EWsWinOpRemovePriorityKey);
       
  2806 		}
       
  2807 	}
       
  2808 
       
  2809 EXPORT_C void RWindowGroup::SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor, const TRect &aClipRect)
       
  2810 /** Sets the text cursor and its clipping rectangle. 
       
  2811 
       
  2812 Use this function to set a text cursor for this window group, or to change 
       
  2813 the existing text cursor's position or appearance.
       
  2814 
       
  2815 The cursor is clipped to aClipRect. This allows, for example, the window 
       
  2816 to have a border region in which the cursor is not displayed.
       
  2817 
       
  2818 @param aWin The text cursor is in this window, and is hence clipped to it 
       
  2819 and positioned relative to it. 
       
  2820 @param aPos Position of the text cursor's origin, relative to the origin of 
       
  2821 aWin. 
       
  2822 @param aCursor The cursor to set. This may be a standard rectangular cursor, 
       
  2823 of type TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle, 
       
  2824 or it may be a custom cursor, in which case it should have previously been 
       
  2825 added to the window server using RWsSession::SetCustomTextCursor().
       
  2826 @param aClipRect The cursor is clipped to this rectangle. Rectangle co-ordinates 
       
  2827 are relative to the origin of aWin. */
       
  2828 	{
       
  2829 	TWsWinCmdSetTextCursor SetTextCursor(aWin.WsHandle(),aPos,aCursor,aClipRect);
       
  2830 	Write(&SetTextCursor,sizeof(SetTextCursor),EWsWinOpSetTextCursorClipped);
       
  2831 	}
       
  2832 
       
  2833 EXPORT_C void RWindowGroup::SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor)
       
  2834 /** Sets the text cursor.
       
  2835 
       
  2836 Use this function to set a text cursor for this window group, or to change 
       
  2837 the existing text cursor's position or appearance.
       
  2838 
       
  2839 @param aWin The text cursor is in this window, and is hence clipped to it 
       
  2840 and positioned relative to it.
       
  2841 @param aPos Position of the text cursor's origin, relative to the origin of 
       
  2842 aWin.
       
  2843 @param aCursor The cursor to set. This may be a standard rectangular cursor, 
       
  2844 of type TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle, 
       
  2845 or it may be a custom cursor, in which case it should have previously been 
       
  2846 added to the window server using RWsSession::SetCustomTextCursor(). */
       
  2847 	{
       
  2848 	TWsWinCmdSetTextCursor SetTextCursor(aWin.WsHandle(),aPos,aCursor);
       
  2849 	Write(&SetTextCursor,sizeof(SetTextCursor),EWsWinOpSetTextCursor);
       
  2850 	}
       
  2851 
       
  2852 EXPORT_C void RWindowGroup::CancelTextCursor()
       
  2853 /** Removes the text cursor. 
       
  2854 
       
  2855 Use this function to remove the current text cursor from this window group. 
       
  2856 This function does nothing if the cursor is currently in another window group. */
       
  2857 	{
       
  2858 	if (iWsHandle)
       
  2859 		Write(EWsWinOpCancelTextCursor);
       
  2860 	}
       
  2861 
       
  2862 EXPORT_C TInt RWindowGroup::SetName(const TDesC &aName)
       
  2863 /** Sets the window group's name. 
       
  2864 
       
  2865 Use this function to set the name of a window group. Window group names are 
       
  2866 arbitrary and can contain any data that can be stored in a descriptor 
       
  2867 of type TDesC.
       
  2868 
       
  2869 Note: if this function is successful, a window group change event is sent to everything 
       
  2870 that is set up to receive these events.
       
  2871 
       
  2872 This function always causes a flush of the window server buffer.
       
  2873 
       
  2874 @param aName The name for the window group. 
       
  2875 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  2876 	{
       
  2877 	const TInt nameLength=aName.Length();
       
  2878 	return WriteReplyByProvidingRemoteReadAccess(&nameLength,sizeof(TInt),&aName,EWsWinOpSetName);
       
  2879 	}
       
  2880 
       
  2881 EXPORT_C TInt RWindowGroup::Name(TDes &aWindowName) const
       
  2882 /** Gets the window group's name, as set by SetName().
       
  2883 
       
  2884 This function always causes a flush of the window server buffer.
       
  2885 
       
  2886 @param aWindowName On return, contains the name of this window group. 
       
  2887 @return KErrNone if successful, otherwise one of the system-wide error codes. */
       
  2888 	{
       
  2889 	return(WriteReplyIntP(aWindowName.MaxLength(),&aWindowName,EWsWinOpName));
       
  2890 	}
       
  2891 
       
  2892 EXPORT_C void RWindowGroup::SetOwningWindowGroup(TInt aIdentifier)
       
  2893 /** Sets the owning window group for this window group.
       
  2894 
       
  2895 The owning window group is the group that is brought to the foreground when 
       
  2896 the window group which has keyboard focus (the foreground application) dies.
       
  2897 
       
  2898 If the owning window group is not set, then the window group brought to the 
       
  2899 foreground when the application dies will be the default owning window group.
       
  2900 
       
  2901 @param aIdentifier The window group's identifier. */
       
  2902 	{
       
  2903 	WriteInt(aIdentifier,EWsWinOpSetOwningWindowGroup);
       
  2904 	}
       
  2905 
       
  2906 EXPORT_C void RWindowGroup::DefaultOwningWindow()
       
  2907 /** 
       
  2908 @publishedPartner
       
  2909 @released
       
  2910 
       
  2911 Makes this window group the default owning window group.
       
  2912 
       
  2913 The default owning window group is the group that is brought to the foreground 
       
  2914 when the window group which has keyboard focus (the foreground application) 
       
  2915 dies, if no other window has been set up as the owning group.
       
  2916 
       
  2917 This window group will take over as the default owning window group even if 
       
  2918 another window group has previously called this function. However, if this 
       
  2919 window group is subsequently destroyed, the default owning window group will 
       
  2920 revert to being the previous window group.
       
  2921 
       
  2922 @see SetOwningWindowGroup() 
       
  2923 @capability WriteDeviceData */
       
  2924 	{
       
  2925 	Write(EWsWinOpDefaultOwningWindow);
       
  2926 	}
       
  2927 
       
  2928 EXPORT_C TInt RWindowGroup::Identifier() const
       
  2929 /** Gets the identifier of the window group.
       
  2930 
       
  2931 This function always causes a flush of the window server buffer.
       
  2932 
       
  2933 @return The window group identifier. */
       
  2934 	{
       
  2935 	return(WriteReply(EWsWinOpIdentifier));
       
  2936 	}
       
  2937 
       
  2938 EXPORT_C void RWindowGroup::DisableKeyClick(TBool aState)
       
  2939 /** Disables key clicks.
       
  2940 
       
  2941 If a window group calls this function with aState=ETrue, key clicks (i.e. 
       
  2942 the sound generated when keys are pressed) will be disabled whenever this 
       
  2943 window group has the keyboard focus. Key clicks for this window group can be 
       
  2944 re-enabled by calling this function with aState=EFalse. 
       
  2945 
       
  2946 Note that this function doesn't do anything in v6.0 and v6.1.
       
  2947 
       
  2948 @param aState If ETrue, no key clicks occur when this window group has keyboard focus. 
       
  2949 If EFalse, key clicks are enabled when this window group has keyboard focus. */
       
  2950 	{
       
  2951 	WriteInt(aState,EWsWinOpDisableKeyClick);
       
  2952 	}
       
  2953 
       
  2954 EXPORT_C TInt RWindowGroup::EnableScreenChangeEvents()
       
  2955 /** Enables screen change event sending.
       
  2956 
       
  2957 This function ensures that window groups are sent screen change events, which 
       
  2958 are sent, for example, when the cover on a phone that supports screen flipping 
       
  2959 is opened or closed.
       
  2960 
       
  2961 Note that not getting screen change events is the default behaviour.
       
  2962 
       
  2963 This function always causes a flush of the window server buffer.
       
  2964 
       
  2965 @return KErrNone if successful, otherwise another of the system-wide error 
       
  2966 codes. 
       
  2967 @see DisableScreenChangeEvents() */
       
  2968 	{
       
  2969 	return(WriteReply(EWsWinOpEnableScreenChangeEvents));
       
  2970 	}
       
  2971 
       
  2972 EXPORT_C void RWindowGroup::DisableScreenChangeEvents()
       
  2973 /** Disables screen change event sending.
       
  2974 
       
  2975 This function prevents window groups from getting screen change events, which 
       
  2976 are sent, for example, when the cover on a phone that supports screen flipping is 
       
  2977 opened or closed.
       
  2978 
       
  2979 Note that not getting screen change events is the default behaviour.
       
  2980 
       
  2981 See EnableScreenChangeEvents(). */
       
  2982 	{
       
  2983 	if (iWsHandle)
       
  2984 		Write(EWsWinOpDisableScreenChangeEvents);
       
  2985 	}
       
  2986 
       
  2987 EXPORT_C void RWindowGroup::SimulatePointerEvent(TRawEvent aEvent)
       
  2988 /** Simulates a pointer event.
       
  2989 
       
  2990 This function sends a pointer event to the window as if it had come 
       
  2991 from the kernel, except that it will be sent to a window which is a child 
       
  2992 of the window group it is called on. 
       
  2993 
       
  2994 Notes:
       
  2995 
       
  2996 The function can be used to send a pointer event to an application when 
       
  2997 it is in the background.
       
  2998 
       
  2999 The function is supported for testing purposes only.
       
  3000 
       
  3001 @param aEvent The simulated raw event. */
       
  3002 	{
       
  3003 	Write(&aEvent,sizeof(aEvent),EWsWinOpSendPointerEvent);
       
  3004 	}
       
  3005 
       
  3006 EXPORT_C void RWindowGroup::SimulateAdvancedPointerEvent(TRawEvent /*aEvent*/)
       
  3007 /** Dummy implementation in order to preserve compatibility with WSERV NGA.
       
  3008     @internalComponent */ 
       
  3009 	{
       
  3010 	ASSERT(0);
       
  3011 	}
       
  3012 
       
  3013 EXPORT_C TInt RWindowGroup::ClearChildGroup()
       
  3014 /** Clears all children of the current window group.
       
  3015 
       
  3016 The window group chain is broken directly after the current window group. In the 
       
  3017 general case (consider clearing the child group of a window group in the middle of a 
       
  3018 long chain), this results in two distinct chains. In the special cases where either
       
  3019 the parent window group or the child window group ends up as the only member of a 
       
  3020 resultant chain, it is removed from that chain.
       
  3021 
       
  3022 @return KErrArgument if trying to clear the child window group of a window group that
       
  3023 has no children; KErrNoMemory if, when splitting into 2 chains, there is insufficient
       
  3024 memory to create the second chain (in this case the child window groups are all cleared
       
  3025 from the current chain, then the error is returned). Otherwise KErrNone or one of the 
       
  3026 system-wide error codes.
       
  3027 
       
  3028 @see SetChildGroup() */
       
  3029 	{
       
  3030 	return WriteReply(EWsWinOpClearChildGroup);
       
  3031 	}
       
  3032 	
       
  3033 EXPORT_C TInt RWindowGroup::SetChildGroup(TInt aId)
       
  3034 /** Sets a window group chain onto the current window group.
       
  3035 
       
  3036 Appends all the window groups chained to the child window group onto the chain
       
  3037 containing the current window group. 
       
  3038 
       
  3039 @param aId. ID of the child window group that is head of the chain
       
  3040 
       
  3041 @return KErrArgument if any of these are true:
       
  3042 - child group referred to by aId does not exist
       
  3043 - the current window group already has a child 
       
  3044 - the window group requested to be the child is already a child of another window group
       
  3045 - the window group requested to the child is already the parent or grand parent etc. of the current window group
       
  3046 KErrNoMemory: If the group and it's child are not currently in a chain then a new chain needs to be created
       
  3047 which can fail due to lack of memory;
       
  3048 otherwise one of the system-wide error codes is returned.
       
  3049 
       
  3050 @see ClearChildGroup() */
       
  3051 	{
       
  3052 	return WriteReplyInt(aId,EWsWinOpSetChildGroup);
       
  3053 	}
       
  3054 
       
  3055 //
       
  3056 // Backed up window
       
  3057 //
       
  3058 
       
  3059 EXPORT_C TInt RBackedUpWindow::Construct(const RWindowTreeNode &parent, TDisplayMode aDisplayMode, TUint32 aClientHandle)
       
  3060 /** Completes the construction of a backed up window. 
       
  3061 
       
  3062 This method should be called after the RBackedUpWindow(RWsSession&) constructor, 
       
  3063 and before any other functions are performed on the window. It creates a window 
       
  3064 in the window server corresponding to the RBackedUpWindow object, and allocates 
       
  3065 a bitmap with which to perform the window backup.
       
  3066 
       
  3067 Unlike non backed up windows, the size of a backed up window is not inherited 
       
  3068 from its parent. The window will be created with an initial size of zero, 
       
  3069 but this can be altered. The display mode must be specified because it determines 
       
  3070 the amount of memory required to store the backup bitmap.
       
  3071 
       
  3072 This function always causes a flush of the window server buffer.
       
  3073 
       
  3074 @param parent The window's parent. 
       
  3075 @param aDisplayMode The display mode for the window. 
       
  3076 @param aClientHandle The client's handle for the window. See RWindow::Construct() 
       
  3077 for a description of the client handle.
       
  3078 @return KErrNone if successful, otherwise one of the system-wide error codes, the 
       
  3079 most likely of which is KErrNoMemory. 
       
  3080 @see RWindowBase::SetSizeErr()
       
  3081 @see RWindowBase::SetExtentErr() 
       
  3082 @see RWindow::Construct() */
       
  3083 	{
       
  3084 	return(construct(parent,aClientHandle,EWinBackedUp,aDisplayMode));
       
  3085 	}
       
  3086 
       
  3087 EXPORT_C TInt RBackedUpWindow::BitmapHandle() const
       
  3088 /** Gets a handle to the backup bitmap. 
       
  3089 
       
  3090 This handle can then be passed to CFbsBitmap::Duplicate() to gain access 
       
  3091 to the bitmap. Once the bitmap has been obtained, it can be drawn to or read 
       
  3092 from by the application.
       
  3093 
       
  3094 Notes: in most circumstances this function should be used only after MaintainBackup() 
       
  3095 has been called. Otherwise, the content of the backup bitmap will be unpredictable.
       
  3096 
       
  3097 This function always causes a flush of the window server buffer.
       
  3098 
       
  3099 @return The handle of the backup bitmap. */
       
  3100 	{
       
  3101 	return(WriteReply(EWsWinOpBitmapHandle));
       
  3102 	}
       
  3103 
       
  3104 EXPORT_C void RBackedUpWindow::UpdateScreen(const TRegion &aRegion)
       
  3105 /** Copies a part of the backup bitmap to the on-screen bitmap. 
       
  3106 
       
  3107 This function behaves in the same way as UpdateScreen(), but copies only the 
       
  3108 specified region of the backup bitmap to the window on screen.
       
  3109 
       
  3110 This function always causes a flush of the window server buffer.
       
  3111 
       
  3112 @param aRegion Area of the backup bitmap to copy. */
       
  3113 	{
       
  3114 	const TInt regionCount=aRegion.Count();
       
  3115 	TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
       
  3116 	WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpUpdateScreenRegion);
       
  3117 	}
       
  3118 
       
  3119 EXPORT_C void RBackedUpWindow::UpdateScreen()
       
  3120 /** Copies the backup bitmap's image to the on-screen bitmap. 
       
  3121 
       
  3122 This function should be used if the application draws directly to the backup 
       
  3123 bitmap. Any changes made to the backup bitmap will not be reflected on the 
       
  3124 screen until this function is called. */
       
  3125 	{
       
  3126 	Write(EWsWinOpUpdateScreen);
       
  3127 	}
       
  3128 
       
  3129 EXPORT_C void RBackedUpWindow::UpdateBackupBitmap()
       
  3130 /** Copies to the backup bitmap any areas of the window which are not currently 
       
  3131 stored in the bitmap.
       
  3132 
       
  3133 This method does not need to be called if the server has not been instructed 
       
  3134 to maintain the backup buffer constantly
       
  3135 
       
  3136 @see MaintainBackup() */
       
  3137 	{
       
  3138 	Write(EWsWinOpUpdateBackupBitmap);
       
  3139 	}
       
  3140 
       
  3141 EXPORT_C void RBackedUpWindow::MaintainBackup()
       
  3142 /** Tells the window server to start maintaining a backup bitmap with the entire 
       
  3143 window contents. 
       
  3144 
       
  3145 By default, the window only backs up the non-visible and shadowed part of the 
       
  3146 window. Calling this function makes drawing to the window much faster.
       
  3147 
       
  3148 Once this function has been called, it cannot be reversed. */
       
  3149 	{
       
  3150 	Write(EWsWinOpMaintainBackup);
       
  3151 	}
       
  3152 
       
  3153 //
       
  3154 // Blank window
       
  3155 //
       
  3156 
       
  3157 EXPORT_C TInt RBlankWindow::Construct(const RWindowTreeNode &parent, TUint32 aClientHandle)
       
  3158 /** Completes the construction of a valid blank-window handle. 
       
  3159 
       
  3160 This function should be called after the RBlankWindow(RWsSession&) constructor, 
       
  3161 and before any other functions are performed on the window. It creates a window 
       
  3162 in the window server corresponding to the RBlankWindow object. The window 
       
  3163 is initialised to inherit the size and extent of its parent window, or to be full 
       
  3164 screen if its parent is a group window.
       
  3165 
       
  3166 This function always causes a flush of the window server buffer.
       
  3167 
       
  3168 @param parent The window's parent. 
       
  3169 @param aClientHandle Client handle for the window. See RWindow::Construct() for a 
       
  3170 description of the client handle. 
       
  3171 @return KErrNone if successful, otherwise one of the system-wide error codes, 
       
  3172 the most likely of which is KErrNoMemory.
       
  3173 @see TWsEvent::Handle()
       
  3174 @see TWsPriorityKeyEvent::Handle() 
       
  3175 @see RWindow::Construct() */
       
  3176 	{
       
  3177 	return(construct(parent,aClientHandle,EWinBlank,ENone));
       
  3178 	}
       
  3179 
       
  3180 EXPORT_C void RBlankWindow::SetColor(TRgb aColor)
       
  3181 /** Sets the colour of the blank window.
       
  3182 
       
  3183 @param aColor Colour for the window. */
       
  3184 	{
       
  3185 	WriteInt(aColor.Internal(),EWsWinOpSetColor);
       
  3186 	}
       
  3187 
       
  3188 EXPORT_C void RBlankWindow::SetColor()
       
  3189 /** Sets the background colour used for clearing when the window becomes uncovered 
       
  3190 or visible to none. 
       
  3191 
       
  3192 The window content will be left with whatever happened to be on the screen at the time. */
       
  3193 	{
       
  3194 	Write(EWsWinOpSetNoBackgroundColor);
       
  3195 	}
       
  3196 
       
  3197 EXPORT_C void RBlankWindow::SetSize(const TSize &aSize)
       
  3198 /** Sets the size of the blank window.
       
  3199 
       
  3200 @param aSize Size. */
       
  3201 	{
       
  3202 	WriteSize(aSize,EWsWinOpSetSize);
       
  3203 	}
       
  3204 
       
  3205 EXPORT_C void RBlankWindow::SetExtent(const TPoint &pos,const TSize &size)
       
  3206 /** Sets the extent of the blank window.
       
  3207 
       
  3208 @param pos The position of the window's origin, relative to its parent. 
       
  3209 @param size Size for the window. */
       
  3210 	{
       
  3211 	Write(&pos,sizeof(pos),&size,sizeof(size),EWsWinOpSetExtent);
       
  3212 	}