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