1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Standard window server header file
21 #ifndef __FNTSTORE_H__
31 _LIT(KWSERVThreadName,"Wserv");
36 _LIT(KWSERVServerName,"!Windowserver");
41 class MWsObjectProvider;
43 /** Used for testing purpose.
52 inline TSizeMode(TSize& aSize);
53 static inline TInt ScaledCord(TInt aOrigin,TInt aScale);
54 inline TPoint ScaledOrigin();
56 CFbsBitGc::TGraphicsOrientation iRotation;
59 TSize iScreenTwipsSize;
60 TUint iAlternativeRotations;
61 TRect iPointerCursorArea;
63 TDisplayMode iDefaultDisplayMode;
66 /** Screen mode enforcement flags.
68 Screen mode enforcement ensures that windows must meet certain requirements
69 if they are to be displayed. When the screen mode changes, window groups that
70 are incorrectly set up, according to these requirements, are locked out. The
71 windows are notified of the change, and will be displayed if they are updated
72 (according to the current enforcement requirement) to match the new screen
77 @see CWsScreenDevice::ScreenModeEnforcement()
78 @see CWsScreenDevice::SetScreenModeEnforcement() */
79 enum TScreenModeEnforcement
83 All windows that are the children of window groups will be displayed, irrespective
86 This is not properly supported and is provided for testing purposes. */
88 /** Pixels and rotation enforcement.
90 Group windows must be set up for the correct rotation and be working in the
91 correct size in pixels to be displayed. */
92 ESizeEnforcementPixelsAndRotation,
93 /** Pixels and Twips enforcement.
95 Group windows must have the correct rotation and be working in the correct
96 size in pixels and twips to be displayed.
98 This setting might be used if the display pixels are not square, and would
99 distort fonts when rotated. */
100 ESizeEnforcementPixelsTwipsAndRotation,
103 struct TPixelsAndRotation
104 /** Pixels and rotation struct.
106 This is used to define a particular screen mode's screen size in pixels,
111 @see CWsScreenDevice::GetScreenModeSizeAndRotation() */
113 /** The screen size, for a given screen mode, in pixels. */
115 /** The current screen orientation. */
116 CFbsBitGc::TGraphicsOrientation iRotation;
119 struct TPixelsTwipsAndRotation
120 /** Pixels, twips and rotation struct.
122 This is used to define a particular screen mode's screen size in twips
123 and pixels, and its rotation.
127 @see CWsScreenDevice::GetScreenModeSizeAndRotation() */
129 /** The screen size, for a given screen mode, in pixels. */
131 /** The screen size, for a given screen mode, in twips. */
133 /** The screen rotation. */
134 CFbsBitGc::TGraphicsOrientation iRotation;
137 /** Log message text length.
139 This defines the length of the log text message buffer TLogMessageText,
140 which is used in RWsSession::LogMessage().
145 /** The length of the log message text buffer in characters. */
146 KLogMessageLength=0x80
149 /** Log message text buffer.
151 This is used in RWsSession::LogMessage().
155 typedef TBuf<KLogMessageLength> TLogMessageText;
157 /** Password window group priority.
159 This priority is assigned to the password window group when the window server is displaying the password window.
160 This is the highest priority, which ensures that the machine password window is in front of all other windows -
161 hence password tests cannot be bypassed.
167 /** Password window group priority. */
168 KPasswordWindowGroupPriority=1000
171 /** Switch ordinal position to owning window.
173 This enum can be specified as the 2nd parameter to RWsSession::SetWindowGroupOrdinalPosition()
174 or as the 1st parameter to RWindowTreeNode::SetOrdinalPosition() (if this is being called on an
177 When called with this value, the functions don't change the ordinal position of the group window
178 in question, but rather bring to the front the window that would come to the front if that group
179 window were to die with keyboard focus.
183 @see RWsSession::SetWindowGroupOrdinalPosition()
184 @see RWindowTreeNode::SetOrdinalPosition() */
186 /** Switch ordinal position to owning window. */
187 KOrdinalPositionSwitchToOwningWindow=0x80000000
190 /** Window corner types.
192 Corners may be specified square or stepped, with varying numbers of pixels
193 removed to make the stepping. Picturing a corner as the top left corner of
194 a window, the numbers denote the number of pixels removed from the top row
200 @see RWindowBase::SetCornerType() */
202 // Bottom 16 bits available for corner type
204 /** Square corner. */
206 /** Corner pixel removed. */
210 3 pixels are removed: the corner pixel and a single pixel from each side. */
212 /** Three pixel step.
214 5 pixels are removed: the corner pixel, the two pixels next to it and the
215 2 pixels above or below it. */
219 12 pixels are removed: the corner pixel, the four pixels next to it, the
220 four pixels above or below it, the pixel which was diagonal to the corner
221 pixel, and the pixels to both sides of that pixel. */
223 EWindowCornerRegion, // Private
224 /** Corner type mask.
226 This value is used by the window server, and may be used by developers, to
227 separate TCornerType and TCornerFlags values from a TInt which contains both
229 ECornerTypeMask=0xFFFF
234 These are used by RWindowBase::SetCornerType() to set which corners of a window
235 are not to have corner types applied to them.
241 // Top 16 bits available for corner flags
243 /** Do not apply corner shape to top left corner. */
244 EWindowCornerNotTL=0x10000,
245 /** Do not apply corner shape to top right corner. */
246 EWindowCornerNotTR=0x20000,
247 /** Do not apply corner shape to bottom left corner. */
248 EWindowCornerNotBL=0x40000,
249 /** Do not apply corner shape to bottom right corner. */
250 EWindowCornerNotBR=0x80000,
253 /** Window backup type flags.
257 @see RWindowBase::EnableBackup() */
258 enum TWindowBackupType
260 /** Backup the area behind the current window only.
262 This is the default behaviour for the RWindowBase::EnableBackup() function. */
263 EWindowBackupAreaBehind=0x0001,
264 /** Backup the entire screen.
266 This is provided for windows that require the rest
267 of the screen to fade when they are displayed. When the rest of the screen
268 should become unfaded, the window server redraws the whole screen from the
270 EWindowBackupFullScreen=0x0002,
273 /** Types of standard events.
275 These are events that the window server passes to its clients, as opposed
276 to events that the base passes to the window server.
285 This can be sent, but should be ignored by clients. */
289 This is the event that is sent when a character has been received from the
292 If an EEventKey event is associated with an EEventKeyDown or EEventKeyUp
293 event (typically EEventKeyDown), the EEventKey event occurs after the
294 EEventKeyDown/EEventKeyUp event.
296 In practice, the only keys potentially likely to have their EEventKey event
297 generated on the up rather than the down are modifier keys. */
301 If an EEventKey event is associated with an EEventKeyUp event (which is
302 rarely the case), the EEventKey event occurs after the EEventKeyUp event. */
306 If an EEventKey event is associated with an EEventKeyDown event (which
307 is typically the case), the EEventKey event occurs after the EEventKeyDown event. */
309 /** Modifier changed event.
311 This is an event generated by the window server when
312 the state of one of the modifier keys changes.
313 It is not reported unless explicitly requested by a window.
315 @see RWindowTreeNode::EnableModifierChangedEvents(). */
316 EEventModifiersChanged,
319 This event is sent when the user presses or releases a pointer button (or
320 the equivalent action, depending on the type of pointing device), drags the
321 pointer, or uses the pointer to switch on the device. If the current input
322 type (see TXYInputType) is "mouse" or "relative mouse", i.e. it generates
323 pointer move events as well as drag events, then this event type is also
324 generated whenever the pointer is moved. */
326 /** Pointer enter event.
328 This occurs when the user moves the pointer into a window with a pointer button
329 pressed (or equivalent action depending on the type of pointing device). If
330 move events are being generated, this event also occurs when the user moves
331 the pointer into the window. */
333 /** Pointer exit event.
335 Occurs when the user moves the pointer out of a window with a pointer button
336 pressed (or equivalent action depending on the type of pointing device). If
337 move events are being generated, this event also occurs when the user moves
338 the pointer out of the window. */
340 /** Pointer move buffer ready event.
342 Occurs when the pointer move buffer is ready to be retrieved by the client. */
343 EEventPointerBufferReady,
344 /** Occurs as a duplicate of each pointer event if a window sets pointer capture
345 with the TCaptureFlagDragDrop flag set. */
347 /** Focus lost event.
349 Occurs when a window group loses keyboard focus. */
350 EEventFocusLost, //10
351 /** Focus gained event.
353 Occurs when a window group gains keyboard focus. */
357 This event type is not reported unless explicitly requested by a window.
359 @see RWindowTreeNode::EnableOnEvents(). */
363 Occurs when the window server enters password mode. It is sent to the group
364 window of the currently active password window.
366 This is the window server mode where the user is required to enter a password
367 before any further actions can be performed.
371 /** Window group changed event. This occurs whenever a window group is destroyed,
372 and whenever a window group's name changes
374 This event type is not reported unless explicitly requested by a window.
376 @see RWindowTreeNode::EnableGroupChangeEvents(). */
377 EEventWindowGroupsChanged,
380 Occurs when an error occurs. See TWsErrorMessage::TErrorCategory for the types
383 This event type is not reported unless explicitly requested by a window.
385 @see RWindowTreeNode::EnableErrorMessages(). */
386 EEventErrorMessage, //15
387 /** Message ready event.
389 Occurs when a session sends a message to this window group using RWsSession::SendMessageToWindowGroup(). */
391 EEventMarkInvalid, // For internal use only
394 This is issued when an off event is received by the window server from the
397 If for some reason the event can't be delivered, or there is no-one to deliver
398 it to, then a call to the base is made to power down the processor.
400 This event is only delivered if explicitly requested using RWsSession:RequestOffEvent(). */
402 /** Event issued to off-event requesting windows when the off key is pressed. */
404 /** Screen size mode change event.
406 This is issued when the screen size mode has changed, for instance when
407 the cover on a phone that supports screen flipping is opened or closed. */
408 EEventScreenDeviceChanged, //20
409 /** Event sent whenever the window group with focus changes.
411 Requested by RWindowTreeNode::EnableFocusChangeEvents(). */
412 EEventFocusGroupChanged,
413 /** Case opened event.
415 This event is sent to those windows that have requested EEventSwitchOn
416 events. Unlike with EEventSwitchOn events, the screen will not be switched
419 /** Case closed event.
421 This event is sent to those windows that have requested EEventSwitchOff
424 Unlike EEventSwitchOff events, which make a call to the base to power down
425 the processor if for some reason the event can't be delivered (or there is
426 no-one to deliver it to), failure to deliver case closed events has no repercussions. */
428 /** Window group list change event.
430 The window group list is a list of all window groups and their z-order. This
431 event indicates any change in the window group list: additions, removals and
434 Notification of this event is requested by calling RWindowTreeNode::EnableGroupListChangeEvents(). */
435 EEventWindowGroupListChanged,
436 /** The visibility of a window has changed
438 This is sent to windows when they change from visible to invisible, or visa versa, usually due
439 to another window obscuring them.
441 Notification of this event is requested by calling RWindowTreeNode::EnableVisibilityChangeEvents(). */
442 EEventWindowVisibilityChanged,
443 #ifdef SYMBIAN_PROCESS_MONITORING_AND_STARTUP
446 This is issued when an restart event is received by the window server from the
447 base. This event is also an off event, because it might power-cycle the device.
449 If for some reason the event can't be delivered, or there is no-one to deliver
450 it to, then a call to the base is made to power down the processor.
452 This event is only delivered if explicitly requested using RWsSession:RequestOffEvent(). */
455 //Codes for events only passed into Key Click DLL's
456 /** Repeating key event.
458 This is only sent to a key click plug-in DLL (if one is present) to indicate
459 a repeating key event.
463 EEventGroupWindowOpen,
464 EEventGroupWindowClose,
466 //Codes for events only passed into anim dlls
467 /** Direct screen access begin
468 This is only sent to anim dlls (if they register to be notified). It indicates that
469 the number of direct screen access sessions has increased from zero to one.*/
470 EEventDirectScreenAccessBegin=200,
471 /** Direct screen access end
472 This is only sent to anim dlls (if they register to be notified). It indicates that
473 the number of direct screen access sessions has decreased from one to zero.*/
474 EEventDirectScreenAccessEnd,
475 /** Event to signal the starting or stopping of the wserv heartbeat timer
476 This is only sent to anim dlls (if they register to be notified). */
477 EEventHeartbeatTimerStateChange,
479 //The range 900-999 is reserved for UI Framework events
480 /** 900-909 WSERV protects with PowerMgmt */
481 EEventPowerMgmt = 900,
482 EEventReserved = 910,
484 //Event codes from EEventUser upwards may be used for non-wserv events.
485 //No event codes below this should be defined except by the window server
487 /** User defined event.
489 The client can use this and all higher values to define their own
490 events. These events can be sent between windows of the same client or windows
491 of different clients.
493 @see RWs::SendEventToWindowGroup(). */
499 /** Window server hot keys.
503 @see RWsSession::SetHotKey() */
506 /** Enables logging of all messages to and from the window server.
508 Note that the required type of logging must have been specified in the wsini.ini
509 file (using the LOG keyword), and the appropriate logging DLL must be available.
511 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>E */
512 EHotKeyEnableLogging,
513 /** Always disables window server logging, if active. Does nothing otherwise.
515 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>D */
516 EHotKeyDisableLogging,
517 /** Dumps a list of all windows to the log. (If logging is disabled, it is temporarily
518 enabled in order to do this.)
520 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>W */
522 /** Kills the foreground application.
524 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>K */
526 /** Shuts down the window server.
528 Be cautious! This may mean resetting the machine to re-start the window server.
530 Default key mapping: release (not available), debug (\<Ctrl\>\<Alt\>\<Shift\>X). */
532 /** Dumps a list of cells allocated on the window server's heap to the log. (If
533 logging is disabled, it is temporarily enabled in order to do this.)
535 Note that logging requires that the type of logging has been set up in the
536 wsini.ini file, and that the appropriate logging DLL is available.
538 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\>H */
540 /** Increases the LCD contrast.
542 Default key mapping: EKeyIncContrast. Note that this value is from an enum
543 in e32keys.h. The contrast wraps around when it reaches the maximum. */
545 /** Decreases the LCD contrast.
547 Default key mapping: EKeyDecContrast. Note that this value is from an enum
548 in e32keys.h. The contrast wraps around when it reaches the minimum. */
550 /** Switches the machine off.
552 Default key mapping: EKeyOff. Note that this value is from an enum in e32keys.h. */
554 /** Switches the backlight on.
556 Default key mapping: EKeyBacklightOn. Note that this value is from an enum
559 /** Switches the backlight off.
561 Default key mapping: EKeyBacklightOff. Note that this value is from an enum
564 /** Toggles the backlight.
566 Default key mapping: EKeyBacklightToggle. Note that this value is from an
567 enum in e32keys.h. */
568 EHotKeyBacklightToggle,
569 /** Switches to screen size 0.
571 This, and the following 3 keys are used to switch screen sizes on real hardware,
572 for instance when the cover is closed on a phone that supports screen flipping. */
573 EHotKeyScreenDimension0,
574 /** Switches to screen size 1.
576 This might be generated when the cover is opened on a phone that supports screen
578 EHotKeyScreenDimension1,
579 /** Switches to screen size 2. */
580 EHotKeyScreenDimension2,
581 /** Switches to screen size 3. */
582 EHotKeyScreenDimension3,
583 /** Cycles the display though its possible sizes.
585 This is used only for debugging.
587 A device may have several screen sizes, each with a default orientation. For
588 example a phone that supports screen flipping will have different display
589 sizes when the cover is opened and closed.
591 Default key mapping: debug : \<Ctrl\>\<Alt\>\<Shift\> U. Release : none. */
592 EHotKeyCycleDisplaySize,
593 /** Cycles the screen orientation through the specified rotations for the particular
594 size mode you are in.
596 For example, phones that support screen flipping may
597 use this feature for changing between right and left handed use.
599 For rectangular display modes you can only specify 2 orientations, 180 degrees
600 apart. For square modes you can specify 4 rotations (90 degrees) or however
603 Specification of the list of rotations takes place in the WSINI.INI file.
605 Default key mapping: debug : \<Ctrl\>\<Alt\>\<Shift\> O. Release : none. */
606 EHotKeyCycleOrientation,
607 /** Increases the screen's brightness.
609 The brightness wraps around to the minimum
610 value after it has reached the maximum. */
611 EHotKeyIncBrightness,
612 /** Decreases the screen's brightness.
614 The brightness wraps around to the maximum value after it has reached the minimum. */
615 EHotKeyDecBrightness,
617 /** Cycle focus screen from one to another in multiple screen environment. Start
618 from current focused screen, switch to next the screen, and wraps around when it
619 reaches the last screen.
621 Default key mapping: \<Ctrl\>\<Alt\>\<Shift\> I. */
622 EHotKeyCycleFocusScreen,
624 /** Value for first hot key.
626 Used with EHotKeyLastKeyType to make it easy to write a for loop that steps
627 through all the different key values. */
628 EHotKeyFirstKeyType=EHotKeyEnableLogging, //Must always be set to the first one
629 /** Value for last hot key.
631 Used with EHotKeyFirstKeyType to make it easy to write a for loop that steps
632 through all the different key values. */
633 EHotKeyLastKeyType=EHotKeyCycleFocusScreen, //Must always be set to the last one
637 /** Password mode flags.
643 /** Releases ownership of password handling.
645 This allows another window to become the password window. A client will be
646 panicked with code 46 if it sets this mode when it is not the current password
649 /** No password handling is performed by this window, but no other window
650 can become the password window. */
652 /** Password mode is enabled only once a day.
654 When enabled, password mode requires the user to enter a password
655 before any further actions can be performed. */
657 /** Password mode is enabled every time the machine is switched on. */
659 /** Equivalent to setting the password mode to EPasswordAlways and triggering an
660 instant password check. */
661 EPasswordAlwaysTriggerNow,
662 /** Equivalent to setting the password mode to EPasswordOnceADay and triggering
663 an instant password check. */
664 EPasswordOnceADayTriggerNow,
667 /** Text cursor parameter information.
669 A text cursor is a rectangular area which can be set to flash. It is normally
670 only visible when the window group which owns it has the keyboard focus. This
671 structure is used to define the parameters of a text cursor, which can be
672 selected for use through the window group using RWindowGroup::SetTextCursor().
674 Custom (non-rectangular) text cursors are supported from v7.0s. They are added
675 to the window server using RWsSession::SetCustomTextCursor(), after which
676 they can be selected for use through the window group, in the same way as
677 standard rectangular cursors. They have a unique identifier, stored in the
678 iType member, which must be greater than ETypeLastBasic. Custom text cursors
679 are clipped to their iHeight and iWidth values. Their iColour member is not
685 // The different normal text cursors
686 // A Text cursor can either be a predefined one
687 // or a general sprite. Cursors between ETypeFirst
688 // and ETypeLastBasic are predefined ones (even though
689 // the ones above ETypeLast do not exist and are
691 /** Cursor type values.
693 The values between ETypeFirst and ETypeLastBasic are reserved for predefined
694 cursors. Custom text cursors must have a value greater than ETypeLastBasic.
696 The values not listed below are for internal use only. */
701 /** Standard filled rectangular cursor. */
703 /** Standard hollow rectangular cursor. */
704 ETypeHollowRectangle,
705 /** The first predefined cursor type.
707 Equivalent to ETypeRectangle. This can be used for iterating through the predefined
709 ETypeFirst=ETypeRectangle,
710 /** The last predefined cursor type.
712 Equivalent to ETypeHollowRectangle. This can be used for iterating through
713 the predefined cursor types. */
714 ETypeLast=ETypeHollowRectangle,
715 /** Reserved for future use.
717 All custom text cursors must have a type value greater than this. */
718 ETypeLastBasic = 1000,
720 /** Added for compatibility with previous releases. */
722 /** Cursor flash and clipping flags.
724 The flags not listed below are for internal use only. */
727 /** The text cursor should not flash. */
728 EFlagNoFlash = 0x00000001,
729 /** The bitmap of each sprite member is clipped left of its x-origin and right of
730 its x-origin plus iWidth.
732 Used for custom text cursors only. */
733 EFlagClipHorizontal = 0x00000002,
734 /** The bitmap of each sprite member is clipped vertically.
736 How it is clipped depends on the text cursor's vertical alignment, see the
737 TCustomTextCursorAlignment enum in class RWsSession.
739 Used for custom text cursors only. */
740 EFlagClipVertical = 0x00000004,
741 /** @internalComponent */
742 EUserFlags = 0x0000FFFF,
743 /** @internalComponent */
744 EFlagClipped = 0x00010000,
745 /** @internalComponent */
746 EPrivateFlags = 0xFFFF0000,
750 For possible values, see the ENamedCursors enum. */
752 /** The height of the text cursor.
754 This value is also used for clipping custom text cursors, if the EFlagClipVertical
757 /** The ascent of the text cursor (the distance between the origin and the top). */
759 /** The width of the text cursor.
761 Custom text cursors are clipped to this value, if the EFlagClipHorizontal
764 /** Cursor flash and clipping flags.
766 For possible values, see the EFlags enum. */
768 /** The colour of the text cursor.
770 If the cursor is flashing, this colour is XOR'd with the screen.
772 This value is not used for custom text cursors. */
778 These can be combined using a bit-wise OR operation.
782 @see RWsPointerCursor::Construct()
783 @see RWsSprite::Construct() */
786 /** Flash sprite on and off.
788 All flashing is done on the same timer, including the text cursor. */
790 /** With this flag set, the sprite is displayed over the window and all its children.
792 Without the flag, the sprite is only displayed over the window's visible area.
794 This is particularly useful when the sprite is owned by a window group, as
795 it means the sprite will be displayed over the whole screen.
799 By default a sprite is clipped to the visible region of the window that owns
802 Sprites with this flag set are displayed in front of sprites without this
804 ESpriteNoChildClip=0x2,
805 /** The sprite's appearance will not change when it is on a shadowed part of the
808 (Typically this is used for sprites attached to window groups so that
809 they are perceived to be floating above the windows). */
810 ESpriteNoShadows=0x4,
811 /** @internalComponent */
812 ESpriteNonSystemFlags=0x0000FFFF,
813 /** @internalComponent */
814 ESpriteSystemFlags= 0xFFFF0000,
815 /** @internalComponent */
816 ESpritePointer=0x10000,
817 /** @internalComponent */
819 /** @internalComponent */
820 ESpriteDisabled=0x40000,
821 /** @internalComponent */
822 ESpriteActive=0x80000,
828 This structure is used to define the parameters of a sprite member, which
829 can be added to a sprite or pointer cursor.
833 /** The bitmap to be displayed in the sprite or pointer cursor during the time
834 interval specified by iInterval.
836 If NULL, the sprite or pointer cursor will be invisible for the time specified
841 This defines which areas of iBitmap are drawn to the screen.
842 It enables the bitmap to have a non-rectangular shape on the screen. Areas
843 which are not drawn to, retain the appearance of the window underneath the
846 The bits in iBitmap are AND'ed with those in iMaskBitmap before being drawn
847 to the screen. In practice, the mask bitmap is normally white in those areas
848 drawn to by iBitmap, and black in all other areas.
852 This bitmap should be in the same mode as iBitmap, otherwise the masking
853 out operation becomes inefficient. */
854 CFbsBitmap *iMaskBitmap;
855 /** EFalse if the mask bitmap is not to be inverted (the default) or ETrue if it
856 is to be inverted. */
858 /** Specifies the drawing mode to use when drawing iBitmap if the mask is NULL. */
859 CGraphicsContext::TDrawMode iDrawMode;
860 /** Offset from the sprite's central position.
862 Specifies an offset between the origin of iBitmap and the sprite or pointer
863 cursor's origin. (The origin is the top left corner of the bitmap.) */
865 /** Time interval for which iBitmap is displayed.
867 Note that if only one sprite member is added to a sprite or pointer cursor,
868 it will be displayed continuously, regardless of the value of iInterval. */
869 TTimeIntervalMicroSeconds32 iInterval;
872 /** Event reporting control.
874 This enumeration defines flags which can be used to control how events are
879 @see RWindowTreeNode::EnableOnEvents()
880 @see RWindowTreeNode::EnableModifierChangedEvents()
881 @see RWindowTreeNode::EnableErrorMessages() */
884 /** Requested events are sent in all circumstances. */
886 /** Events are delivered only when the requesting window's window group has keyboard
888 EEventControlOnlyWithKeyboardFocus,
889 /** Events are delivered only when the requesting window or any of its children
890 are visible on the screen. */
891 EEventControlOnlyWhenVisible
894 /** Pointer event filter types.
896 These flags are used by RWindowBase::PointerFilter() to define which pointer
897 events are filtered out by the window server and not sent to the client session.
898 They also allow the window server to simulate a move event prior to each pen
903 @see RWindowBase::PointerFilter() */
907 /** Filters out both pointer enter and pointer exit events for this window. */
908 EPointerFilterEnterExit=0x1,
909 /** Filters out pointer-move events for this window. */
910 EPointerFilterMove=0x2,
911 /** Filters out pointer-drag events for this window. */
912 EPointerFilterDrag=0x4,
913 /** Simulates a pointer move event before each pen down event.
915 This makes the pen appear more like a mouse, with simulated movement between
916 two pointer events. You can only get these events while you are in pen mode. */
917 EPointerGenerateSimulatedMove=0x8,
918 //Combinations of the above
919 /** Filters move and drag-pointer events from the event stream and simulates the
920 move event before each pen down event.
922 This enum is useful when you want to get simulated move events. Use it as shown
923 below to turn on simulated moves:
926 win->PointerFilter(EPointerMoveEvents, EPointerGenerateSimulateMoves)
928 @see RWindowBase::PointerFilter() */
929 EPointerMoveEvents=EPointerFilterMove|EPointerGenerateSimulatedMove,
933 /** Pointer event details.
935 The function TWsEvent::Pointer() is used to get this structure for a pointer
941 /** Pointer event types.
943 Note that the user actions that cause these events will vary according to
944 the type of pointing device used. */
947 /** Button 1 or pen down. */
949 /** Button 1 or pen up. */
953 This is the middle button of a 3 button mouse. */
957 This is the middle button of a 3 button mouse. */
959 /** Button 3 down. */
965 These events are only received when button 1 is down. */
969 These events are only received when button 1 is up and the XY input mode is
972 /** Button repeat event. */
974 /** Switch on event caused by a screen tap. */
977 /** The type of pointer event. */
979 /** The state of the modifier keys, defined in TEventModifier. */
980 TUint iModifiers; // State of pointing device and associated buttons
981 /** Co-ordinates of the pointer event relative to the origin of the window it occurred
984 Positive co-ordinates indicate a position to the right of and down from
985 the window's origin, negative co-ordinates indicate a position to the left
988 /** Co-ordinates of the pointer event relative to the parent window of the window
991 Positive co-ordinates indicate a position to the right of and down from the window's
992 origin, negative co-ordinates indicate a position to the left and up. */
993 TPoint iParentPosition;
997 /** Key event details.
999 When processing a TKeyEvent, the TStdScanCode in iScanCode should usually
1000 be ignored in favour of the TKeyCode in iCode. Using iScanCode would bypass
1001 the keyboard mapping and any FEP that happens to be installed. The exceptions
1002 to this general rule are games where the positions of the keys are more important
1003 than their translations, and FEPs that are implementing keyboard maps themselves.
1004 In these cases, if the iCode is used rather than iScanCode to determine the
1005 key pressed, there will be two unfortunate consequences. Firstly, the low-level
1006 keyboard mapping might re-arrange the mapping that you are trying to impose.
1007 Secondly, you will subvert the CTRL+number method of entering Unicode literals.
1012 /** The character code generated for an EEventKey, or 0 for a down or up event.
1014 Key codes for special keys are defined in TKeyCode. */
1016 /** The scan code of the key that caused the event.
1018 Standard scan codes are defined in TStdScanCode. */
1020 /** State of modifier keys and pointing device. Modifier keys are defined in TEventModifier. */
1022 /** Count of auto repeats generated.
1024 0 means an event without repeats. 1 or more means "this many auto repeat events".
1025 It is normal to ignore this value and treat it as a single event. */
1029 struct TModifiersChangedEvent
1030 /** Details of changed modifier keys.
1034 @see TWsEvent::ModifiersChanged() */
1036 /** Contains a set bit for any modifier which has changed. Modifiers are defined
1037 in TEventModifier. */
1038 TUint iChangedModifiers;
1039 /** Current state of all modifiers, combined using a bitwise-OR. Modifiers are
1040 defined in TEventModifier. */
1044 struct TWsVisibilityChangedEvent
1045 /** Visibility changed events.
1047 These events are generated in response to a window being obscured, or being fully or partially
1048 revealed after being obscured.
1051 @see RWindowTreeNode::EnableVisibilityChangeEvents() */
1055 /** Some or all of the window is visible, either directly or through a transparent window.
1056 @deprecated Use EPartiallyVisible instead. */
1058 /** None of the window is visible, either directly or through a transparent window.
1059 @deprecated Use ENotVisible instead. */
1064 /** Some (or all) of the window is visible, either directly or through a transparent window. */
1065 EPartiallyVisible = 0x01,
1066 /** None of the window is visible, either directly or through a transparent window. */
1068 /** All of the window is directly visible. */
1069 EFullyVisible = 0x04,
1071 /** A combination of one or more visibility event flags. */
1075 struct TWsErrorMessage
1076 /** Error event details.
1080 @see RWindowTreeNode::EnableErrorMessages() */
1082 /** Error event types */
1085 /** An error that occurs while the window server is calculating a drawing region
1086 for a particular window.
1088 When the window server can't calculate a drawing region due to lack of memory
1089 it goes into a mode where it draws the whole of a window. Any window that
1090 is covering this window is also told to redraw. */
1092 /** An error occured while trying to turn the backlight on or off.
1094 This would usually only happen when the batteries are low. */
1096 /** An error occured while trying to enable logging. */
1098 /** An error that occured while trying to change the contrast. */
1101 /** The error category. */
1102 TErrorCategory iErrorCategory;
1103 /** The error code */
1107 struct TWsGraphicMessageHeaderEvent
1108 /** @internalComponent @released */
1114 class TWsRedrawEvent
1115 /** Window server redraw event.
1117 All redraw events generated by the window server are delivered to the client
1118 in an object of this type. The class provides a handle to the window which
1119 generated the redraw event, and the rectangle which should be redrawn.
1123 @see RWsSession::GetRedraw() */
1126 inline TUint Handle() const;
1127 inline TRect Rect() const;
1129 void SetHandle(TUint aHandle);
1130 void SetRect(TRect aRect);
1132 /** @internalComponent */
1134 /** @internalComponent */
1135 TRect iRect; // Rectangle to redraw
1138 class TWsPriorityKeyEvent
1139 /** Priority key events.
1141 These events are configured using RWindowGroup::AddPriorityKey(), and obtained
1142 by the client using the functions RWsSession::PriorityKeyReady() and RWsSession::GetPriorityKey().
1148 inline TKeyEvent *Key() const;
1149 inline TUint Handle() const;
1150 inline void SetHandle(TUint aHandle);
1152 /** @internalComponent */
1154 /** @internalComponent */
1155 TUint8 iEventData[sizeof(TKeyEvent)];
1159 /** Window server event.
1161 All events generated by the window server, except redraw events and priority
1162 key events, are delivered to the client in a TWsEvent. The client obtains
1163 the TWsEvent by calling RWsSession::GetEvent(). The type of data contained
1164 in the TWsEvent depends on the type of event. The client can inquire the event
1165 type using Type(), and then retrieve the appropriate type of data.
1171 /** Event data size. */
1174 /** The size of a TPointerEvent.
1176 This is the maximum number of bytes of data that can be returned by EventData().
1177 Note: this value is 24 bytes.*/
1178 EWsEventDataSize=sizeof(TPointerEvent)+8
1181 inline TPointerEvent* Pointer() const;
1182 inline TKeyEvent* Key() const;
1183 inline TModifiersChangedEvent* ModifiersChanged() const;
1184 inline TWsVisibilityChangedEvent* VisibilityChanged();
1185 inline const TWsVisibilityChangedEvent* VisibilityChanged() const;
1186 inline TWsErrorMessage* ErrorMessage() const;
1187 inline TUint8* EventData() const;
1188 inline TInt Type() const;
1189 inline TUint Handle() const;
1190 inline TTime Time() const;
1191 inline void SetType(TInt aType);
1192 inline void SetHandle(TUint aHandle);
1193 inline void SetTimeNow();
1194 inline TInt* Int() const;
1196 /** @internalComponent */
1198 /** @internalComponent */
1200 /** @internalComponent */
1202 /** @internalComponent */
1203 TUint8 iEventData[EWsEventDataSize];
1207 class RWsPointerCursor;
1209 /** Pointer cursor mode flags.
1211 These flags define the current cursor mode, and hence which sprite to use
1212 for the pointer cursor.
1216 @see RWsSession::SetPointerCursorMode()
1217 @see RWsSession::PointerCursorMode() */
1218 enum TPointerCursorMode
1220 /** Don't have a pointer cursor. */
1222 /** The default system pointer cursor is used whenever there is a pointer cursor. */
1223 EPointerCursorFixed,
1224 /** The default system pointer cursor is used unless the window the pointer cursor
1225 is above specifies one, in which case that cursor is used. */
1226 EPointerCursorNormal,
1227 /** There is no pointer cursor unless the pointer is above a window that has specified
1229 EPointerCursorWindow,
1230 /** First pointer cursor mode.
1232 This is used in test code for iterating though available modes. */
1233 EPointerCursorFirstMode=EPointerCursorNone,
1234 /** The final pointer cursor mode.
1236 This is used in test code for iterating though available modes. It will be
1237 updated if more modes are added. */
1238 EPointerCursorLastMode=EPointerCursorWindow,
1241 /** Flags which customise a long key press capture request made by a window group.
1243 These flags are passed to RWindowGroup::CaptureLongKey().
1245 Two things can be configured using this enum: the normal key event that is
1246 generated immediately, and the long key event that is generated after a short
1247 time interval. The normal key event can be sent immediately (on key down)
1248 to the application with keyboard focus, or, if the key is not held down long
1249 enough to generate a long key event, when the key is released. The long key
1250 event can be customised to generate a single key event only, or to auto repeat.
1254 @see RWindowGroup::CaptureLongKey() */
1255 enum TLongCaptureFlags
1257 /** If specified, the normal ("short") key event is sent immediately (on key down)
1258 to the application with keyboard focus. If not specified, the normal key event
1259 is sent when the key is released (if the key is not held down long enough
1260 to generate a long key event). */
1261 ELongCaptureShortEventImmediately=0x01,
1262 /** If specified, causes the long key press to automatically repeat. If not specified,
1263 the long key press will generate a single key event only. */
1264 ELongCaptureRepeatEvents=0x02,
1265 /** Equivalent to ELongCaptureShortEventImmediately being set and the other flags
1267 ELongCaptureNormal=ELongCaptureShortEventImmediately,
1268 /** Equivalent to the first two values being unset. */
1269 ELongCaptureWaitShort=0,
1274 class TReadDescriptorType;
1275 class TWriteDescriptorType;
1279 /** Identifies an abstract artwork
1281 This is a piece of artwork that might be owned and authored by another process.
1282 A client can draw a piece of artwork, but that doesn't confer the ability to
1283 access the pixel representation of that artwork directly.
1293 TWsGraphicId(TUninitialized): iFlags(0) {}
1294 IMPORT_C TWsGraphicId(TUid aUid);
1295 IMPORT_C TWsGraphicId(TInt aId);
1296 IMPORT_C TWsGraphicId(const TWsGraphicId& aCopy);
1297 IMPORT_C TUid Uid() const;
1298 IMPORT_C TBool IsUid() const;
1299 IMPORT_C void Set(TUid aUid);
1300 IMPORT_C TInt Id() const;
1301 IMPORT_C TBool IsId() const;
1302 IMPORT_C void Set(TInt aId);
1303 IMPORT_C TInt Compare(const TWsGraphicId& aOther) const;
1305 friend class CWsGraphic;
1308 TInt iWsGraphicIdSpare[2];
1311 class CWsGraphic: public CBase
1312 /** Client representation of a window-server-side piece of artwork owned by this Client
1319 IMPORT_C CWsGraphic();
1321 IMPORT_C ~CWsGraphic();
1323 // 2nd phase construction
1324 IMPORT_C void BaseConstructL(TUid aUid,TUid aType,const TDesC8& aData);
1325 IMPORT_C void BaseConstructL(TUid aType,const TDesC8& aData);
1326 IMPORT_C void BaseConstructL(const TWsGraphicId& aReplace,TUid aType,const TDesC8& aData);
1327 // sharing between clients
1328 IMPORT_C virtual TInt ShareGlobally();
1329 IMPORT_C virtual TInt Share(TSecureId aClientId);
1330 IMPORT_C virtual TInt UnShare(TSecureId aClientId);
1331 IMPORT_C virtual TInt UnShareGlobally();
1333 IMPORT_C const TWsGraphicId& Id() const;
1334 IMPORT_C TBool IsActive() const;
1335 IMPORT_C void Destroy();
1337 IMPORT_C void SendMessage(const TDesC8& aData) const;
1338 IMPORT_C TInt SendSynchronMessage(const TDesC8& aData) const;
1339 IMPORT_C TInt Flush() const;
1340 IMPORT_C void SetGraphicExtension(MWsObjectProvider* aExt);
1342 // events from wserv, to be implemented by derived classes
1344 Handles message from this graphic artwork peer on the server.
1345 @param aData Message from peer CWsGraphicDrawer.
1347 virtual void HandleMessage(const TDesC8& aData) = 0;
1350 Handles custom operation when this graphic artwork is replaced. When this method
1351 is invoked, the replaced peer CWsGraphicDrawer on the server has been destroyed.
1353 virtual void OnReplace() = 0;
1354 IMPORT_C virtual void OnClientClose();
1356 void BaseConstructL();
1357 IMPORT_C virtual TInt CWsGraphic_Reserved1();
1358 IMPORT_C virtual TInt CWsGraphic_Reserved2();
1359 IMPORT_C virtual TInt CWsGraphic_Reserved3();
1363 friend class CManager;
1365 friend class CPimpl;
1367 TInt iWsGraphicSpare[2];
1370 class MWsClientClass
1371 /** Base class for all classes whose objects are clients of the window server.
1378 MWsClientClass(RWsBuffer *aBuffer);
1379 inline TInt WsHandle() const;
1381 void Write(const TAny *aData, TInt aLength,const TAny *aData2, TInt aLength2,TUint aOpcode) const;
1382 void Write(const TAny *aBuf, TInt aBufLen,TUint aOpcode) const;
1383 void Write(TUint aOpcode) const;
1384 void WriteInt(TInt aInt, TUint aOpcode) const;
1385 void WriteRect(const TRect &aRect, TUint aOpcode) const;
1386 void WritePoint(const TPoint &aPoint, TUint aOpcode) const;
1387 void WriteSize(const TSize &aSize, TUint aOpcode) const;
1388 TInt WriteReply(TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
1389 TInt WriteReplyInt(TInt aInt, TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
1390 TInt WriteReply(const TAny *aBuf, TInt aBufLen,TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
1391 TInt WriteReply(const TAny *aBuf, TInt aBufLen,const TAny *aBuf2, TInt aBuflen2,TUint aOpcode,const TIpcArgs* aIpcArgs=NULL) const;
1392 TInt WriteReplyP(const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
1393 TInt WriteReplyIntP(TInt aInt, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
1394 TInt WriteReplyP(const TAny *aBuf, TInt aBufLen, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
1395 TInt WriteReplyP(const TAny *aBuf, TInt aBufLen,const TAny *aBuf2, TInt aBuflen2, const TWriteDescriptorType& aReplyPackage,TUint aOpcode) const;
1396 TInt WriteReplyByProvidingRemoteReadAccess(const TAny* aBuf, TInt aBufLen,const TReadDescriptorType& aRemoteReadBuffer,TUint aOpcode) const;
1397 void AddToBitmapArray(const TInt aBitmapHandle)const;
1398 void AsyncRequest(TRequestStatus& aStatus, TUint aOpcode) const;
1400 /** @internalComponent*/
1402 /** @internalComponent*/
1407 class RWindowTreeNode;
1408 class CWsScreenDevice;
1411 class RWsSpriteBase;
1412 class RDirectScreenAccess;
1416 class RWsSession : public MWsClientClass, public RSessionBase
1417 /** Window server session.
1419 The session between the client and the window server can be used to mediate
1420 asynchronous events, for client interface control and for system control.
1421 A description of each of these capabilities is given below.
1423 Mediating asynchronous events:
1425 Primarily, the session mediates asynchronous events to the user. Three event
1426 streams are available: the standard event stream which all applications must
1427 use; the redraw event stream which must be used by all applications except
1428 those which exclusively use backed-up windows; and the priority key event
1429 stream which may be used for abort keys and the like for specialist applications.
1431 All these events are mediated as standard asynchronous services. Typical window
1432 server client programs encapsulate each service they require in an active
1433 object whose RunL() identifies the event and calls the appropriate member
1434 function of a class associated with an application framework, or a window.
1436 Client interface control:
1438 The client's interface with the window server has several aspects, each of
1439 which is controlled through the window server session.
1441 Flushing defines how requests to the window server are handled.
1445 Many system-wide settings may be controlled through the window server session.
1446 Typically, these functions are only used by the system shell and its associated
1447 sessions/applications. They include: auto-repeat and double-click, querying
1448 all window groups in the system, setting the default shadow vector, setting
1449 the system pointer cursors, counting resources used by the window server
1450 (this is only useful for debugging checks), getting and setting the state of
1451 the modifier keys (for instance Shift and Ctrl), and setting the window server
1457 friend class RWsBuffer;
1458 friend class RWindowTreeNode;
1459 friend class CWsScreenDevice;
1460 friend class CWsBitmap;
1461 friend class RAnimDll;
1462 friend class RWsSpriteBase;
1463 friend class RDirectScreenAccess;
1464 friend class RSoundPlugIn;
1465 friend class CWsGraphic;
1467 /** Compute mode flags.
1469 When a window group takes focus or loses it, the window server can boost its
1470 client's thread or process priority to provide a better response to the user.
1471 How it alters the priority is determined by the current compute mode of the
1474 @see ComputeMode() */
1477 /** Client priority is permanently set to its current level. It is not altered
1478 or set by the windowing system if the focus changes.
1480 Thus if ComputeMode() is called with this flag when a client is in the foreground,
1481 it will subsequently have foreground priority even if it is in the background. */
1482 EPriorityControlDisabled,
1483 /** Client process's priority is always set to EPriorityBackground. */
1484 EPriorityControlComputeOn,
1485 /** Client process's priority is set to EPriorityForeground when the window group
1486 takes focus, and set to EPriorityBackground when it loses focus.
1488 This is the default behaviour. */
1489 EPriorityControlComputeOff
1491 enum {ESystemInfoArraySize=16};
1492 /** Window server logging commands passed to LogCommand().
1494 @see RWsSession::LogCommand() */
1495 enum TLoggingCommand
1497 /** Enables logging. */
1499 /** Disables logging. */
1501 /** Logs the current status of all the windows in the tree, even if logging is
1502 not currently enabled. */
1503 ELoggingStatusDump, //Window Tree Dump
1504 /** Logs information about the window server's heap size and usage, even if logging
1505 is not currently enabled. */
1509 struct TWindowGroupChainInfo
1511 /*Stores id and Parent id window group
1513 This is used to define chained window groups's id and it's parent id.
1514 An array of these structures is returned by some of the varients of the function WindowGroupList.
1522 /** @internalComponent */
1524 TInt iInfo[ESystemInfoArraySize];
1526 /** The vertical alignment of a custom text cursor sprite.
1528 One of these values must be set, see SetCustomTextCursor(). This value also
1529 determines which part of each sprite member bitmap is clipped when the cursor's
1530 TTextCursor::EFlagClipVertical flag is set. */
1531 enum TCustomTextCursorAlignment
1533 /** The y-origin of each sprite member bitmap is aligned with the top of the line. */
1534 ECustomTextCursorAlignTop,
1535 /** The y-origin of each sprite member bitmap is aligned with the baseline of the
1537 ECustomTextCursorAlignBaseline,
1538 /** The y-origin of each sprite member bitmap is aligned with the bottom of the
1540 ECustomTextCursorAlignBottom
1544 IMPORT_C RWsSession();
1545 IMPORT_C TInt Connect();
1546 IMPORT_C TInt Connect(RFs& aFileServer);
1547 IMPORT_C void Close();
1548 IMPORT_C TVersion Version();
1550 IMPORT_C TInt SetHotKey(THotKey aType, TUint aKeyCode, TUint aModifierMask, TUint aModifier);
1551 IMPORT_C TInt ClearHotKeys(THotKey aType);
1552 IMPORT_C TInt RestoreDefaultHotKey(THotKey aType);
1554 IMPORT_C void EventReady(TRequestStatus *aStat);
1555 IMPORT_C void EventReadyCancel();
1556 IMPORT_C void GetEvent(TWsEvent &aEvent);
1557 IMPORT_C void PurgePointerEvents();
1559 IMPORT_C void RedrawReady(TRequestStatus *aStat);
1560 IMPORT_C void RedrawReadyCancel();
1561 IMPORT_C void GetRedraw(TWsRedrawEvent &aEvent);
1563 IMPORT_C void PriorityKeyReady(TRequestStatus *aStat);
1564 IMPORT_C void PriorityKeyReadyCancel();
1565 IMPORT_C void GetPriorityKey(TWsPriorityKeyEvent &aEvent);
1567 IMPORT_C void Flush();
1568 IMPORT_C TBool SetAutoFlush(TBool aState);
1569 IMPORT_C TInt SetKeyboardRepeatRate(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
1570 IMPORT_C void GetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime);
1571 IMPORT_C void GetDoubleClickSettings(TTimeIntervalMicroSeconds32 &aInterval, TInt &aDistance);
1572 IMPORT_C TInt SetDoubleClick(const TTimeIntervalMicroSeconds32 &aInterval, TInt aDistance);
1574 IMPORT_C TInt NumWindowGroups() const;
1575 IMPORT_C TInt WindowGroupList(CArrayFixFlat<TInt> *aWindowList);
1576 IMPORT_C TInt WindowGroupList(RArray<TWindowGroupChainInfo>* aWindowList);
1577 IMPORT_C TInt NumWindowGroups(TInt aPriority) const;
1578 IMPORT_C TInt WindowGroupList(TInt aPriority, CArrayFixFlat<TInt> *aWindowList);
1579 IMPORT_C TInt WindowGroupList(TInt aPriority, RArray<TWindowGroupChainInfo>* aWindowList);
1580 IMPORT_C TInt GetFocusWindowGroup();
1581 IMPORT_C TInt GetDefaultOwningWindow();
1582 IMPORT_C TInt SetWindowGroupOrdinalPosition(TInt aIdentifier, TInt aPosition);
1583 IMPORT_C TInt GetWindowGroupClientThreadId(TInt aIdentifier, TThreadId &aThreadId);
1584 IMPORT_C TInt GetWindowGroupHandle(TInt aIdentifier);
1585 IMPORT_C TInt GetWindowGroupOrdinalPriority(TInt aIdentifier);
1586 IMPORT_C TInt SendEventToWindowGroup(TInt aIdentifier, const TWsEvent &aEvent);
1587 IMPORT_C TInt SendEventToAllWindowGroups(const TWsEvent &aEvent);
1588 IMPORT_C TInt SendEventToAllWindowGroups(TInt aPriority, const TWsEvent &aEvent);
1589 IMPORT_C TInt SendEventToOneWindowGroupsPerClient(const TWsEvent &aEvent);
1590 IMPORT_C TInt GetWindowGroupNameFromIdentifier(TInt aIdentifier, TDes &aWindowName);
1591 IMPORT_C TInt FindWindowGroupIdentifier(TInt aPreviousIdentifier,const TDesC& aMatch,TInt aOffset=0);
1592 IMPORT_C TInt FindWindowGroupIdentifier(TInt aPreviousIdentifier,TThreadId aThreadId);
1593 IMPORT_C TInt SendMessageToWindowGroup(TInt aIdentifier, TUid aUid, const TDesC8 &aParams);
1594 IMPORT_C TInt SendMessageToAllWindowGroups(TUid aUid, const TDesC8& aParams);
1595 IMPORT_C TInt SendMessageToAllWindowGroups(TInt aPriority, TUid aUid, const TDesC8& aParams);
1596 IMPORT_C TInt FetchMessage(TUid &aUid, TPtr8 &aParams, const TWsEvent& aMessageEvent);
1598 IMPORT_C void SetShadowVector(const TPoint &aVector);
1599 IMPORT_C TPoint ShadowVector() const;
1601 IMPORT_C void SetBackgroundColor(TRgb aColor);
1602 IMPORT_C TRgb GetBackgroundColor() const;
1604 IMPORT_C TInt RegisterSurface(TInt aScreenNumber, const TSurfaceId& aSurface); ///< @publishedPartner
1605 IMPORT_C void UnregisterSurface(TInt aScreenNumber, const TSurfaceId& aSurface); ///< @publishedPartner
1606 IMPORT_C TInt PreferredSurfaceConfigurationSize(); ///< @publishedPartner
1608 IMPORT_C TInt SetSystemPointerCursor(const RWsPointerCursor &aPointerCursor,TInt aCursorNumber);
1609 IMPORT_C void ClearSystemPointerCursor(TInt aCursorNumber);
1610 IMPORT_C TInt ClaimSystemPointerCursorList();
1611 IMPORT_C void FreeSystemPointerCursorList();
1613 IMPORT_C TInt SetCustomTextCursor(TInt aIdentifier, const TArray<TSpriteMember>& aSpriteMemberArray, TUint aSpriteFlags, TCustomTextCursorAlignment aAlignment);
1615 IMPORT_C TInt ResourceCount();
1616 IMPORT_C void PasswordEntered();
1617 IMPORT_C void ComputeMode(TComputeMode aMode);
1619 IMPORT_C TInt HeapCount() const;
1620 IMPORT_C TInt DebugInfo(TInt aFunction, TInt aParam=0) const;
1621 IMPORT_C TInt DebugInfo(TInt aFunction, TDes8& aReturnBuf, TInt aParam=0) const;
1622 IMPORT_C void HeapSetFail(TInt aTAllocFail,TInt aValue);
1623 IMPORT_C TInt SetModifierState(TEventModifier aModifier,TModifierState aState);
1624 IMPORT_C TInt GetModifierState() const;
1626 IMPORT_C TInt RequestOffEvents(TBool aOn,RWindowTreeNode *aWin=NULL);
1627 IMPORT_C TDisplayMode GetDefModeMaxNumColors(TInt& aColor,TInt& aGray) const;
1628 IMPORT_C TInt GetColorModeList(CArrayFixFlat<TInt> *aModeList) const;
1630 IMPORT_C void SetPointerCursorArea(const TRect& aArea);
1631 IMPORT_C void SetPointerCursorArea(TInt aScreenSizeMode,const TRect& aArea);
1632 IMPORT_C TRect PointerCursorArea() const;
1633 IMPORT_C TRect PointerCursorArea(TInt aScreenSizeMode) const;
1634 IMPORT_C void SetPointerCursorMode(TPointerCursorMode aMode);
1635 IMPORT_C TInt SetClientCursorMode(TPointerCursorMode aMode);
1636 IMPORT_C TPointerCursorMode PointerCursorMode() const;
1637 IMPORT_C void SetDefaultSystemPointerCursor(TInt aCursorNumber);
1638 IMPORT_C void ClearDefaultSystemPointerCursor();
1639 IMPORT_C TInt SetPointerCursorPosition(const TPoint& aPosition);
1640 IMPORT_C TPoint PointerCursorPosition() const;
1642 IMPORT_C void SetDefaultFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
1643 IMPORT_C void PrepareForSwitchOff();
1644 IMPORT_C void SetBufferSizeL(TInt aBufSize);
1645 IMPORT_C void SetMaxBufferSizeL(TInt aMaxBufSize);
1646 IMPORT_C TInt SetSystemFaded(TBool aFaded);
1647 IMPORT_C TInt SetSystemFaded(TBool aFaded,TUint8 aBlackMap,TUint8 aWhiteMap);
1649 // Functions for multiple screens
1650 IMPORT_C TInt SetFocusScreen(TInt aScreenNumber);
1651 IMPORT_C TInt GetFocusScreen();
1652 IMPORT_C void ClearAllRedrawStores();
1653 #if defined(__WINS__)
1654 // Function for WINS behaviour only
1656 IMPORT_C void SetRemoveKeyCode(TBool aRemove);
1657 IMPORT_C void SimulateXyInputType(TXYInputType aInputType); //Only for testing WSERV
1660 IMPORT_C void SimulateRawEvent(TRawEvent aEvent);
1661 IMPORT_C void SimulateKeyEvent(TKeyEvent aEvent);
1662 IMPORT_C void LogCommand(TLoggingCommand aCommand);
1663 IMPORT_C void LogMessage(const TLogMessageText &aMessage);
1665 // Functions for test code use only
1667 IMPORT_C void SystemInfo(TInt &aSystemInfoNumber, SSystemInfo &aSystemInfo);
1668 IMPORT_C void TestWrite(TInt aHandle,TInt aOpcode,const TAny *aData, TInt aLength);
1669 IMPORT_C void TestWriteReply(TInt aHandle,TInt aOpcode,const TAny *aData, TInt aLength);
1670 IMPORT_C void TestWriteReplyP(TInt aHandle,TInt aOpcode,const TAny *aData,TInt aLength,TDes8 *aReplyPackage);
1671 IMPORT_C TInt TestWriteReplyByProvidingRemoteReadAccess(TInt aHandle,TInt aOpcode,const TDesC8& aData,const TDesC8& aRemoteReadBuffer);
1672 IMPORT_C TInt TestWriteReplyByProvidingRemoteReadAccess(TInt aHandle,TInt aOpcode,const TDesC8& aData,const TDesC16& aRemoteReadBuffer);
1674 IMPORT_C TInt Finish();
1675 IMPORT_C void SyncMsgBuf();
1676 // functions not exported, used by CWsGraphic
1677 void GraphicMessageReady(TRequestStatus *aStat);
1678 void GetGraphicMessage(TDes8& aData);
1679 void GraphicMessageCancel();
1680 void GraphicAbortMessage(TInt aError);
1681 TInt GraphicFetchHeaderMessage();
1683 TInt doWindowGroupList(TInt aPriority, RArray<TWindowGroupChainInfo>* aWindowListCh, TInt aNumOpcode, TInt aListOpcode);
1684 TInt doWindowGroupList(TInt aPriority,CArrayFixFlat<TInt>* aWindowListId,TInt aNumOpcode,TInt aListOpcode);
1685 TInt doSetHotKey(TInt aOpcode, TInt aType, TUint aKeycode, TUint aModifierMask, TUint aModifiers);
1686 void doReadEvent(TRequestStatus *aStat, TInt aOpcode);
1690 TInt DoFlush(const TIpcArgs& aIpcArgs);
1691 TInt DoSyncMsgBuf(const TIpcArgs& aIpcArgs);
1692 void DirectAcessActivation(TBool aIsNowActive);
1698 /** @internalComponent */
1699 typedef TInt (*AnimCommand)(TPtr8 *aBufPtr,TAny *aPackage);
1702 class RWindowTreeNode : public MWsClientClass
1703 /** A handle to a node in the server-side window tree.
1705 This handle class is used as the base for both window groups and the windows
1706 within them; it is not intended for user derivation, and may not be directly
1707 constructed: use one of the standard derived classes instead.
1712 friend class RWindowGroup;
1713 friend class RWindowBase;
1714 friend class CWindowGc;
1715 friend class RAnimDll;
1716 friend class RWsSprite;
1718 /** Fade control flags.
1720 These flags define whether fading is applied to all child windows when SetFaded()
1721 is called on a window. */
1724 /** Include all child windows when fading/un-fading. */
1725 EFadeIncludeChildren=ETrue,
1726 /** Fade only the parent window.
1728 Note that a panic will occur if this value is used when SetFaded() is called
1729 on a window group. */
1730 EFadeWindowOnly=EFalse,
1734 RWindowTreeNode(RWsSession &aWs);
1736 IMPORT_C void Close();
1737 IMPORT_C void Destroy();
1738 IMPORT_C TUint32 ClientHandle() const;
1739 IMPORT_C TUint32 Parent() const;
1740 IMPORT_C TUint32 PrevSibling() const;
1741 IMPORT_C TUint32 NextSibling() const;
1742 IMPORT_C TUint32 Child() const;
1743 IMPORT_C TInt OrdinalPriority() const;
1744 IMPORT_C TInt OrdinalPosition() const;
1745 IMPORT_C TInt FullOrdinalPosition() const;
1746 IMPORT_C void SetOrdinalPosition(TInt aPos);
1747 IMPORT_C void SetOrdinalPosition(TInt aPos,TInt aOrdinalPriority);
1748 IMPORT_C TInt WindowGroupId();
1749 IMPORT_C TInt SetPointerCursor(TInt aCursorNumber);
1750 IMPORT_C void SetCustomPointerCursor(const RWsPointerCursor &aPointerCursor);
1751 IMPORT_C TInt EnableOnEvents(TEventControl aCircumstances=EEventControlOnlyWithKeyboardFocus);
1752 IMPORT_C void DisableOnEvents();
1753 IMPORT_C TInt EnableGroupChangeEvents();
1754 IMPORT_C void DisableGroupChangeEvents();
1755 IMPORT_C TInt EnableFocusChangeEvents();
1756 IMPORT_C void DisableFocusChangeEvents();
1757 IMPORT_C TInt EnableGroupListChangeEvents();
1758 IMPORT_C void DisableGroupListChangeEvents();
1759 IMPORT_C TInt EnableVisibilityChangeEvents();
1760 IMPORT_C void DisableVisibilityChangeEvents();
1761 IMPORT_C TInt EnableErrorMessages(TEventControl aCircumstances);
1762 IMPORT_C void DisableErrorMessages();
1763 IMPORT_C TInt EnableModifierChangedEvents(TUint aModifierMask, TEventControl aCircumstances);
1764 IMPORT_C void DisableModifierChangedEvents();
1765 IMPORT_C void SetNonFading(TBool aNonFading);
1766 IMPORT_C void SetFaded(TBool aFaded,TFadeControl aIncludeChildren);
1767 IMPORT_C void SetFaded(TBool aFaded,TFadeControl aIncludeChildren,TUint8 aBlackMap,TUint8 aWhiteMap);
1768 IMPORT_C void ClearPointerCursor();
1775 class TSurfaceConfiguration;
1777 class RWindowBase : public RWindowTreeNode
1778 /** Client-side handle to a server-side window.
1780 The server-side windows of handles derived from this class can be displayed
1781 on the device's screen, and associated with pointer events.
1783 This class is not for user derivation; however derived classes form part of
1784 the Window Server API.
1790 /** Capture behaviour flags.
1792 @see SetPointerCapture()
1793 @see EEventDragDrop */
1796 // Flags, these can be combined to customise pointer capture
1797 /** If set, capture is enabled, disabled otherwise. */
1798 TCaptureFlagEnabled=0x01,
1799 /** If set, drag-drop events are sent to the window in which the pointer was lifted.
1800 Drag-drop is a tap-drag-lift sequence. */
1801 TCaptureFlagDragDrop=0x02,
1802 /** Capture events from windows belonging to any group, not just the group of the
1803 window on which the flag was set */
1804 TCaptureFlagAllGroups=0x04,
1805 // States, made up of a set of flags
1806 /** Equivalent to disabling all the above flags. */
1808 /** Equivalent to TCaptureFlagEnabled. */
1809 TCaptureEnabled=TCaptureFlagEnabled,
1810 /** Equivalent to the OR of the first three flags. */
1811 TCaptureDragDrop=TCaptureFlagEnabled|TCaptureFlagDragDrop|TCaptureFlagAllGroups,
1815 RWindowBase(RWsSession &aWs);
1817 IMPORT_C void Activate();
1818 IMPORT_C void SetPosition(const TPoint &point);
1819 IMPORT_C TInt SetSizeErr(const TSize &size);
1820 IMPORT_C TInt SetExtentErr(const TPoint &point,const TSize &size);
1821 IMPORT_C TSize Size() const;
1822 IMPORT_C TPoint InquireOffset(const RWindowTreeNode &aWindow) const;
1823 IMPORT_C void PointerFilter(TUint32 aFilterMask, TUint32 aFilter);
1824 IMPORT_C void SetPointerGrab(TBool aState);
1825 IMPORT_C void ClaimPointerGrab(TBool aSendUpEvent=ETrue);
1826 IMPORT_C void SetPointerCapture(TInt aFlags);
1827 IMPORT_C void SetPointerCapturePriority(TInt aPriority);
1828 IMPORT_C TInt GetPointerCapturePriority() const;
1829 IMPORT_C void SetVisible(TBool aState);
1830 IMPORT_C void SetShadowHeight(TInt aHeight);
1831 IMPORT_C void SetShadowDisabled(TBool aState);
1832 IMPORT_C TPoint Position() const;
1833 IMPORT_C TPoint AbsPosition() const;
1834 IMPORT_C TInt SetCornerType(TCornerType aCornerType, TInt aCornerFlags=0);
1835 IMPORT_C TInt SetShape(const TRegion &aRegion);
1836 IMPORT_C TInt SetRequiredDisplayMode(TDisplayMode aMode);
1837 IMPORT_C TDisplayMode DisplayMode();
1838 IMPORT_C void EnableBackup(TUint aBackupType=EWindowBackupAreaBehind);
1839 IMPORT_C void RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 aTime,const TRect &aRect);
1840 IMPORT_C void CancelPointerRepeatEventRequest();
1841 IMPORT_C TInt AllocPointerMoveBuffer(TInt aMaxPoints, TUint aFlags);
1842 IMPORT_C void FreePointerMoveBuffer();
1843 IMPORT_C void EnablePointerMoveBuffer();
1844 IMPORT_C void DisablePointerMoveBuffer();
1845 IMPORT_C TInt RetrievePointerMoveBuffer(TDes8 &aBuf);
1846 IMPORT_C void DiscardPointerMoveBuffer();
1847 IMPORT_C TInt AddKeyRect(const TRect &aRect, TInt aScanCode, TBool aActivatedByPointerSwitchOn);
1848 IMPORT_C void RemoveAllKeyRects();
1849 IMPORT_C TInt PasswordWindow(TPasswordMode aPasswordMode);
1850 IMPORT_C void FadeBehind(TBool aFade);
1851 IMPORT_C TBool IsFaded();
1852 IMPORT_C TBool IsNonFading();
1853 IMPORT_C TInt MoveToGroup(TInt aIdentifier);
1854 IMPORT_C TInt SetBackgroundSurface(const TSurfaceId& aSurface); ///< @publishedPartner
1855 IMPORT_C TInt SetBackgroundSurface(const TSurfaceConfiguration& aConfiguration, TBool aTriggerRedraw); ///< @publishedPartner
1856 IMPORT_C void RemoveBackgroundSurface(TBool aTriggerRedraw); ///< @publishedPartner
1857 IMPORT_C TInt GetBackgroundSurface(TSurfaceConfiguration& aConfiguration); ///< @publishedPartner
1858 IMPORT_C TRgb KeyColor(); ///< @publishedPartner whilst prototype
1860 TInt construct(const RWindowTreeNode &parent,TUint32 aHandle, TInt aType, TDisplayMode aDisplayMode);
1864 class RBlankWindow : public RWindowBase
1867 A blank window may have its extent and colour changed, but nothing else may
1868 be drawn to it. Blank windows provide no functionality that is not provided
1869 by the RWindow class. However, they are useful when the application requires
1870 a window that cannot be drawn to, for example a container window.
1876 IMPORT_C RBlankWindow();
1877 IMPORT_C RBlankWindow(RWsSession &aWs);
1878 IMPORT_C TInt Construct(const RWindowTreeNode &parent, TUint32 aHandle);
1879 IMPORT_C void SetColor(TRgb aColor);
1880 IMPORT_C void SetColor();
1881 IMPORT_C void SetSize(const TSize &size);
1882 IMPORT_C void SetExtent(const TPoint &point,const TSize &size);
1886 class RDrawableWindow : public RWindowBase
1887 /** Handle to a drawable window.
1889 This class cannot be constructed directly.
1890 The two concrete derived classes, RWindow and RBackedUpWindow, allow
1891 drawing but use different protocols because RWindow relies on the client to
1892 redraw invalid areas.
1899 RDrawableWindow(RWsSession &aWs);
1901 IMPORT_C void Scroll(const TPoint &aOffset);
1902 IMPORT_C void Scroll(const TRect &aClipRect, const TPoint &aOffset);
1903 IMPORT_C void Scroll(const TPoint &aOffset, const TRect &aRect);
1904 IMPORT_C void Scroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect);
1905 IMPORT_C TRect GetDrawRect();
1907 void SetDrawRect(const TRect &aRect);
1909 void doScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect, TInt aOpcode);
1914 /** Transparency policies
1916 These policies are to control the behaviour of a transparent window.
1919 @see RWindow::SetTransparencyPolicy() */
1920 enum TWsTransparencyPolicy {
1921 /** Default behaviour. */
1922 ETransparencyDefault,
1923 /** Freeze the content of underneath the transparent window to prevent redraw everytime
1924 the overlying window changes. */
1925 ETransparencyFreezeUnder,
1928 class RWindow : public RDrawableWindow
1929 /** Handle to a standard window.
1931 An RWindow is a handle to a server-side window which can be displayed and
1932 drawn to, and whose redraws are performed by the application.
1939 IMPORT_C RWindow(RWsSession &aWs);
1940 IMPORT_C TInt Construct(const RWindowTreeNode &parent,TUint32 aHandle);
1941 IMPORT_C void BeginRedraw();
1942 IMPORT_C void BeginRedraw(const TRect &aRect);
1943 IMPORT_C void EndRedraw();
1944 IMPORT_C void Invalidate();
1945 IMPORT_C void Invalidate(const TRect &aRect);
1946 IMPORT_C void GetInvalidRegion(RRegion &aRegion);
1947 IMPORT_C void SetBackgroundColor(TRgb aColor);
1948 IMPORT_C void SetBackgroundColor();
1949 IMPORT_C void SetSize(const TSize &size);
1950 IMPORT_C void SetExtent(const TPoint &point,const TSize &size);
1951 IMPORT_C void HandleTransparencyUpdate();
1952 IMPORT_C TInt SetTransparencyFactor(const TRgb& aTransparencyFactor);
1953 IMPORT_C TInt SetTransparencyBitmap(const CFbsBitmap& aTransparencyBitmap);
1954 IMPORT_C TInt SetTransparencyWsBitmap(const CWsBitmap& aTransparencyBitmap);
1955 IMPORT_C void SetNonTransparent();
1956 IMPORT_C void EnableRedrawStore(TBool aEnabled);
1957 IMPORT_C TInt SetTransparencyAlphaChannel();
1958 IMPORT_C TInt SetTransparentRegion(const TRegion& aRegion);
1959 IMPORT_C TInt SetTransparencyPolicy(TWsTransparencyPolicy aPolicy);
1960 IMPORT_C TBool IsRedrawStoreEnabled();
1961 IMPORT_C void EnableOSB(TBool);
1962 IMPORT_C void ClearRedrawStore();
1966 class RBackedUpWindow : public RDrawableWindow
1967 /** Client-side handle to a drawable window with a backup bitmap.
1969 A backed-up window is associated with a backup bitmap which retains the contents
1970 of the window. When an area of the window is invalidated, the window server
1971 uses the bitmap directly to update the window without requiring an application
1972 redraw. The backup bitmap is owned by the font and bitmap server and resides
1973 on the font and bitmap server's shared heap, which is accessible to all client
1974 programs: functions are provided to allow the client application to access
1975 this bitmap directly and perform updates to the window under application control.
1981 IMPORT_C RBackedUpWindow();
1982 IMPORT_C RBackedUpWindow(RWsSession &aWs);
1983 IMPORT_C TInt Construct(const RWindowTreeNode &parent,TDisplayMode aDisplayMode, TUint32 aHandle);
1984 IMPORT_C TInt BitmapHandle();
1985 IMPORT_C void UpdateScreen();
1986 IMPORT_C void UpdateScreen(const TRegion &aRegion);
1987 IMPORT_C void UpdateBackupBitmap();
1988 IMPORT_C void MaintainBackup();
1992 class RWindowGroup : public RWindowTreeNode
1993 /** Client-side handle to a server-side window group.
1999 IMPORT_C RWindowGroup();
2000 IMPORT_C RWindowGroup(RWsSession &aWs);
2001 IMPORT_C TInt Construct(TUint32 aClientHandle);
2002 IMPORT_C TInt Construct(TUint32 aClientHandle,TBool aIsFocusable);
2003 IMPORT_C TInt ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle);
2004 IMPORT_C TInt ConstructChildApp(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable);
2005 IMPORT_C void AllowProcessToCreateChildWindowGroups(TUid aProcessSID);
2006 IMPORT_C void EnableReceiptOfFocus(TBool aState);
2007 IMPORT_C void AutoForeground(TBool aState);
2008 IMPORT_C void SetOrdinalPriorityAdjust(TInt aAdjust);
2009 IMPORT_C TInt SetOrdinalPositionErr(TInt aPos,TInt aOrdinalPriority);
2010 IMPORT_C TInt32 CaptureKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
2011 IMPORT_C TInt32 CaptureKey(TUint aKeycode, TUint aModifierMask, TUint aModifier, TInt aPriority);
2012 IMPORT_C void CancelCaptureKey(TInt32 aCaptureKey);
2013 IMPORT_C TInt32 CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifier);
2014 IMPORT_C TInt32 CaptureKeyUpAndDowns(TUint aScanCode, TUint aModifierMask, TUint aModifier, TInt aPriority);
2015 IMPORT_C void CancelCaptureKeyUpAndDowns(TInt32 aCaptureKey);
2016 IMPORT_C TInt32 CaptureLongKey(TUint aInputKeyCode,TUint aOutputKeyCode,TUint aModifierMask,TUint aModifier
2017 ,TInt aPriority,TUint aFlags);
2018 IMPORT_C TInt32 CaptureLongKey(TTimeIntervalMicroSeconds32 aRepeatTime,TUint aInputKeyCode,TUint aOutputKeyCode
2019 ,TUint aModifierMask,TUint aModifier,TInt aPriority,TUint aFlags);
2020 IMPORT_C void CancelCaptureLongKey(TInt32 aCaptureKey);
2021 IMPORT_C TInt AddPriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
2022 IMPORT_C void RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifier);
2023 IMPORT_C void SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor);
2024 IMPORT_C void SetTextCursor(RWindowBase &aWin, const TPoint &aPos, const TTextCursor &aCursor, const TRect &aClipRect);
2025 IMPORT_C void CancelTextCursor();
2026 IMPORT_C void SetOwningWindowGroup(TInt aIdentifier);
2027 IMPORT_C void DefaultOwningWindow();
2028 IMPORT_C TInt SetName(const TDesC &aName);
2029 IMPORT_C TInt Name(TDes &aWindowName) const;
2030 IMPORT_C TInt Identifier() const;
2031 IMPORT_C void DisableKeyClick(TBool aState);
2032 IMPORT_C TInt EnableScreenChangeEvents();
2033 IMPORT_C void DisableScreenChangeEvents();
2034 IMPORT_C void SimulatePointerEvent(TRawEvent aEvent);
2035 IMPORT_C TInt ClearChildGroup();
2036 IMPORT_C TInt SetChildGroup(TInt aId);
2038 TInt32 doCaptureKey(TUint aKey, TUint aModifierMask, TUint aModifiers, TInt aPriority, TInt aOpcode);
2039 void doCancelCaptureKey(TInt32 aCaptureKeyHandle, TInt aOpcode);
2040 TInt Construct(TInt aIdOfParentWindowGroup,TUint32 aClientHandle,TBool aIsFocusable);
2044 class CWsBitmap : public CFbsBitmap, public MWsClientClass
2045 /** Window server bitmap.
2047 This is a bitmap to which the window server already has a handle. Functions
2048 which take a window server bitmap are faster than equivalent functions which
2055 IMPORT_C CWsBitmap();
2056 IMPORT_C CWsBitmap(RWsSession &aWs);
2057 IMPORT_C ~CWsBitmap();
2058 IMPORT_C TInt Create(const TSize& aSizeInPixels,TDisplayMode aDispMode);
2059 IMPORT_C TInt Duplicate(TInt aHandle);
2060 IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded=ETrue);
2061 IMPORT_C void InternalizeL(RReadStream& aStream);
2062 IMPORT_C void Reset();
2064 TInt createWsBitmap(TInt aErr);
2067 class RWsGraphicMsgBuf;
2069 class TWsGraphicMsgFixedBase
2070 /** Base class for fixed-size messages to be attached to CWindowGc::DrawWsGraphic commands
2075 IMPORT_C TPtrC8 Pckg() const;
2076 IMPORT_C TUid TypeId() const;
2077 IMPORT_C TInt Size() const;
2079 IMPORT_C TWsGraphicMsgFixedBase(TUid aTypeId,TInt aSizeOfDerived);
2085 class RWsGraphicMsgBuf: private RBuf8
2086 /** Utility class for building data buffers to be attached to CWindowGc::DrawWsGraphic commands
2087 Useful when there is more than one piece of data to be attached to the draw command
2092 IMPORT_C RWsGraphicMsgBuf();
2094 using RBuf8::CleanupClosePushL;
2095 IMPORT_C TInt Append(TUid aTypeId,const TDesC8& aData);
2096 IMPORT_C TInt Append(TUid aTypeId,const TDesC16& aData);
2097 IMPORT_C TInt Append(TUid aTypeId,TInt aLen,TPtr8& aPtr);
2098 IMPORT_C TInt Append(const TWsGraphicMsgFixedBase& aMsg);
2099 IMPORT_C void Remove(TInt aIndex);
2100 IMPORT_C TInt Count() const;
2101 IMPORT_C TUid TypeId(TInt aIndex) const;
2102 IMPORT_C TPtrC8 Data(TInt aIndex) const;
2103 IMPORT_C TPtr8 Data(TInt aIndex);
2104 IMPORT_C void GetFixedMsg(TWsGraphicMsgFixedBase& aMsg,TInt aIndex) const;
2105 IMPORT_C const TDesC8& Pckg() const;
2107 TInt ExpandForAppend(TInt aDataLen);
2108 void WriteHeader(TUid aUid,TInt aLen);
2109 TInt IntAt(TInt aOfs) const;
2111 TInt iRMsgBufSpare[2];
2115 class CWindowGc : public CBitmapContext, public MWsClientClass
2116 /** Window graphics context.
2118 Most window graphics context drawing functions map to equivalent CFbsBitGc
2119 functions. They are implemented on the screen with any co-ordinates being
2120 relative to the top left corner of the window. However extra clipping is applied.
2121 The drawing will always be clipped to the visible part of the window. In addition
2122 it will be clipped to the non-invalid part if you are not doing a redraw and
2123 to the region being validated if you are doing a redraw.
2127 In general, server side functions which encounter conditions which would normally
2128 cause a leave, do not leave but instead return an error value indicating the
2129 leave condition. In this way the leave can be handled on the appropriate side
2130 of the client/server boundary. For example, a client can choose to wrap server
2131 calls with User::LeaveIfError(), which causes a leave with the specified
2134 The above advice is true of many functions in this class, and in its derived
2139 @see CGraphicsContext */
2141 friend class CWsScreenDevice;
2143 IMPORT_C CWindowGc(CWsScreenDevice *aDevice);
2144 IMPORT_C virtual ~CWindowGc();
2145 IMPORT_C virtual TInt Construct();
2146 IMPORT_C virtual void Activate(RDrawableWindow &aDevice);
2147 IMPORT_C virtual void Deactivate();
2148 //====================FROM CGraphicsContext.H===============================
2149 IMPORT_C virtual CGraphicsDevice* Device() const;
2150 IMPORT_C virtual void SetOrigin(const TPoint &aPoint=TPoint(0,0));
2151 IMPORT_C virtual void SetDrawMode(TDrawMode aDrawingMode);
2152 IMPORT_C virtual void SetClippingRect(const TRect& aRect);
2153 IMPORT_C virtual void CancelClippingRect();
2154 IMPORT_C virtual void Reset();
2156 IMPORT_C virtual void UseFont(const CFont *aFont);
2157 IMPORT_C virtual void DiscardFont();
2158 IMPORT_C virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
2159 IMPORT_C virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
2160 // Used to do justified text properly
2161 IMPORT_C virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps);
2162 // Used primarily to get accurate WYSIWYG
2163 IMPORT_C virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars);
2165 IMPORT_C virtual void SetPenColor(const TRgb &aColor);
2166 IMPORT_C virtual void SetPenStyle(TPenStyle aPenStyle);
2167 IMPORT_C virtual void SetPenSize(const TSize& aSize);
2169 IMPORT_C virtual void SetBrushColor(const TRgb &aColor);
2170 IMPORT_C virtual void SetBrushStyle(TBrushStyle aBrushStyle);
2171 IMPORT_C virtual void SetBrushOrigin(const TPoint &aOrigin);
2172 IMPORT_C virtual void UseBrushPattern(const CFbsBitmap *aDevice);
2173 IMPORT_C virtual void DiscardBrushPattern();
2175 // Move the internal position, as used by DrawLineTo & DrawLineBy, and set by MoveTo,
2176 // MoveBy, DrawLine, DrawLineTo, DrawLineBy and DrawPolyline
2177 IMPORT_C virtual void MoveTo(const TPoint &aPoint);
2178 IMPORT_C virtual void MoveBy(const TPoint &aPoint);
2179 IMPORT_C virtual void Plot(const TPoint &aPoint);
2181 // Line drawing subject to pen color, width and style and draw mode
2182 IMPORT_C virtual void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
2183 IMPORT_C virtual void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2);
2184 IMPORT_C virtual void DrawLineTo(const TPoint &aPoint);
2185 IMPORT_C virtual void DrawLineBy(const TPoint &aPoint);
2186 IMPORT_C virtual void DrawPolyLine(const CArrayFix<TPoint> *aPointList);
2187 IMPORT_C virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints);
2190 // Outlines subject to pen color, width and style and draw mode
2191 // (set pen to ENullPen for no outline)
2192 // Fill subject to brush style (color, hash or pattern) and origin and
2193 // drawing mode (set brush to ENullBrush for no fill)
2194 IMPORT_C virtual void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
2195 IMPORT_C virtual void DrawEllipse(const TRect &aRect);
2196 IMPORT_C virtual void DrawRect(const TRect &aRect);
2197 IMPORT_C virtual void DrawRoundRect(const TRect &aRect,const TSize &aEllipse);
2198 IMPORT_C virtual TInt DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule=EAlternate);
2199 IMPORT_C virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate);
2201 // Uses the bitmap's Twips size and does a "stretch" blit in general
2202 IMPORT_C virtual void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice);
2203 IMPORT_C virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice);
2204 IMPORT_C virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect);
2205 IMPORT_C virtual void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
2206 IMPORT_C virtual void DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask);
2208 // Text drawing subject to drawing mode
2209 // Subject to used font, pen color, drawing mode,
2210 // word and char justification
2211 IMPORT_C virtual void DrawText(const TDesC &aBuf,const TPoint &aPos);
2213 // Subject to same as above plus brush for background
2214 // (set brush to ENullBrush for no effect on background)
2215 IMPORT_C virtual void DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0);
2216 //================Extra functions from CBitmapContext==============
2217 IMPORT_C virtual void Clear();
2218 IMPORT_C virtual void Clear(const TRect &aRect);
2219 IMPORT_C virtual void CopyRect(const TPoint &anOffset,const TRect &aRect);
2220 IMPORT_C virtual void BitBlt(const TPoint &aPos, const CFbsBitmap *aBitmap);
2221 IMPORT_C virtual void BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource);
2222 IMPORT_C virtual void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
2223 IMPORT_C virtual void BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap);
2224 IMPORT_C virtual void BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource);
2225 IMPORT_C virtual void BitBltMasked(const TPoint& aPoint,const CWsBitmap *aBitmap,const TRect& aSourceRect,const CWsBitmap *aMaskBitmap,TBool aInvertMask);
2226 IMPORT_C virtual void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs=2,TBool aMapForwards=ETrue);
2228 IMPORT_C virtual void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
2229 IMPORT_C virtual void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
2230 //=================Extra functions specific to wserv GDI==============
2231 IMPORT_C virtual void SetDitherOrigin(const TPoint& aPoint);
2232 IMPORT_C virtual TInt SetClippingRegion(const TRegion &aRegion);
2233 IMPORT_C virtual void CancelClippingRegion();
2234 IMPORT_C virtual void SetOpaque(TBool aDrawOpaque=ETrue);
2235 //=================Functions also supplied by CFbsBitGc==============
2236 IMPORT_C virtual void SetFaded(TBool aFaded);
2237 IMPORT_C virtual void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
2238 IMPORT_C virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
2239 IMPORT_C virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
2242 IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
2246 IMPORT_C void Reserved_CGraphicsContext_2();
2248 IMPORT_C void Reserved_CBitmapContext_1();
2249 IMPORT_C void Reserved_CBitmapContext_2();
2250 IMPORT_C void Reserved_CBitmapContext_3();
2253 IMPORT_C virtual void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect);
2254 IMPORT_C virtual void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect,const TDesC8& aData);
2257 IMPORT_C virtual void Reserved_CWindowGc_3();
2258 IMPORT_C virtual void Reserved_CWindowGc_4();
2259 IMPORT_C virtual void Reserved_CWindowGc_5();
2261 ////=============================================================
2262 private: // Private code
2263 TRgb Color(TInt aOpcode)const;
2264 void SetJustification(TInt aExcessWidth,TInt aNumGaps, TInt aOpcode);
2265 void DrawArcOrPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd, TInt aOpcode);
2266 void doDrawPolyLine(const CArrayFix<TPoint> *aPointArray, const TPoint* aPointList,TInt aNumPoints);
2267 TInt doDrawPolygon(const CArrayFix<TPoint> *aPointArray,const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule);
2268 void WriteTextPos(TInt aOpcode,TInt aOpcodePtr,const TPoint &aPos,const TDesC &aBuf) const;
2269 void WriteTextCommand(TAny *aCmd, TInt aLen,const TDesC &aBuf,TInt aOpcode,TInt aOpcodePtr) const;
2270 void WriteTextCommand(TAny *aCmd, TInt aLen,const TDesC8 &aBuf,TInt aOpcode,TInt aOpcodePtr) const;
2271 void APIExGetUnderlineMetrics(TAny*& aOutput);
2272 TInt APIExSetShadowColor(TAny* aShadowColor);
2274 private: // Private data
2276 CWsScreenDevice *iDevice;
2280 class CWsScreenDevice : public CBitmapDevice, public MWsClientClass
2281 /** Software device screen.
2283 An object of this class can be used to enquire or set parameters of the software
2284 screen, and determine the physical limits of the device.
2286 CWsScreenDevice gives access to the list of screen modes. These are the combinations
2287 of screen rotation and screen size supported by the device. One of them is
2288 selected as the current screen mode. The possible screen modes are initialised
2293 @see CFbsScreenDevice */
2296 /** Whether or not to include sprites when comparing areas of the screen*/
2297 enum TSpriteInCompare
2299 /** This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
2300 const TRect &aRect2,TUint aFlags).
2301 When called with the value ERemoveSprite if there are any sprites visible in the areas of the screen being compared then these
2302 will not be included in the comparison.
2303 The function CWsScreenDevice::RectCompare(const TRect &aRect1,const TRect &aRect2) will not include
2304 sprites in the comparison.
2307 /** This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
2308 const TRect &aRect2,TUint aFlags).
2309 When called with the value EIncludeSprite if there are any sprites visible in the areas of the screen being compared then these
2310 will be included in the comparison.*/
2312 /** This enum can be specified as the 3rd parameter to CWsScreenDevice::RectCompare(const TRect &aRect1,
2313 const TRect &aRect2,TUint aFlags).
2314 When called with the value EIncludeTextCursor if there are any text cursors visible in the areas of the screen being compared then these
2315 will be included in the comparison.*/
2316 EIncludeTextCursor=2
2319 IMPORT_C CWsScreenDevice();
2320 IMPORT_C CWsScreenDevice(RWsSession &aWs);
2321 IMPORT_C ~CWsScreenDevice();
2322 IMPORT_C TInt Construct();
2323 IMPORT_C TInt Construct( TInt aDefaultScreenNumber ) ;
2324 //==== From CGraphicsDevice ====//
2325 IMPORT_C TDisplayMode DisplayMode() const;
2326 IMPORT_C TSize SizeInPixels() const;
2327 IMPORT_C TSize SizeInTwips() const;
2328 IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
2329 IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
2330 IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
2331 IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
2332 IMPORT_C TRect PointerRect() const;
2333 IMPORT_C TInt CreateContext(CGraphicsContext *&aGc);
2334 inline TInt CreateContext(CWindowGc*& aGc);
2335 IMPORT_C virtual TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec);
2336 IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec);
2337 IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont,const TFontSpec& aFontSpec,TInt aMaxHeight);
2338 IMPORT_C TInt NumTypefaces() const;
2339 IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const;
2340 IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;
2341 // ==== From CBitmapDevice ====//
2342 IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPixel) const;
2343 IMPORT_C void GetScanLine(TDes8& aScanLine,const TPoint& aStartPixel,TInt aPixelLength, TDisplayMode aDispMode) const;
2344 IMPORT_C TInt AddFile(const TDesC& aName,TInt& aId);
2345 IMPORT_C void RemoveFile(TInt aId=0);
2346 IMPORT_C virtual TInt GetNearestFontInPixels(CFont*& aFont,const TFontSpec& aFontSpec);
2347 IMPORT_C virtual TInt GetNearestFontToDesignHeightInPixels(CFont*& aFont,const TFontSpec& aFontSpec);
2348 IMPORT_C virtual TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont,const TFontSpec& aFontSpec,TInt aMaxHeight);
2349 IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;
2350 IMPORT_C void ReleaseFont(CFont* aFont);
2351 //===== From CFbsScreenDevice ====//
2352 IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
2353 IMPORT_C void SetPalette(CPalette* aPalette);
2354 IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
2355 //===== Extra functions ====//
2356 IMPORT_C TInt SetCustomPalette(const CPalette* aPalette);
2357 IMPORT_C TInt GetFontById(CFont*& aFont,TUid aUid,const TAlgStyle& aAlgStyle);
2358 IMPORT_C TBool RectCompare(const TRect &aRect1,const TRect &aRect2);
2359 IMPORT_C TBool RectCompare(const TRect& aRect1,const TRect &aRect2,TUint aFlags) const;
2360 IMPORT_C TInt CopyScreenToBitmap(const CFbsBitmap *aBitmap) const;
2361 IMPORT_C TInt CopyScreenToBitmap(const CFbsBitmap *aBitmap, const TRect &aRect) const;
2362 IMPORT_C TInt SetBackLight(TBool aBackLight);
2363 //===== Screen Rotation functions ====//
2364 IMPORT_C void SetScreenSizeAndRotation(const TPixelsTwipsAndRotation &aSizeAndRotation);
2365 IMPORT_C void GetDefaultScreenSizeAndRotation(TPixelsTwipsAndRotation &aSizeAndRotation) const;
2366 IMPORT_C void SetScreenSizeAndRotation(const TPixelsAndRotation &aSizeAndRotation);
2367 IMPORT_C void GetDefaultScreenSizeAndRotation(TPixelsAndRotation &aSizeAndRotation) const;
2368 IMPORT_C TScreenModeEnforcement ScreenModeEnforcement() const;
2369 IMPORT_C void SetScreenModeEnforcement(TScreenModeEnforcement aMode) const;
2370 IMPORT_C void GetScreenModeSizeAndRotation(TInt aMode, TPixelsTwipsAndRotation &aSizeAndRotation) const;
2371 IMPORT_C void GetScreenModeSizeAndRotation(TInt aMode, TPixelsAndRotation &aSizeAndRotation) const;
2372 IMPORT_C void SetCurrentRotations(TInt aMode, CFbsBitGc::TGraphicsOrientation aRotation) const;
2373 IMPORT_C TInt GetRotationsList(TInt aMode, CArrayFixFlat<TInt> *aRotationList) const;
2374 IMPORT_C TInt NumScreenModes() const;
2375 IMPORT_C void SetScreenMode(TInt aMode);
2376 IMPORT_C TInt CurrentScreenMode() const;
2377 IMPORT_C void SetAppScreenMode(TInt aMode);
2378 IMPORT_C TPoint GetDefaultScreenModeOrigin() const;
2379 IMPORT_C TPoint GetScreenModeOrigin(TInt aMode) const;
2380 IMPORT_C TSize GetCurrentScreenModeScale() const;
2381 IMPORT_C TSize GetScreenModeScale(TInt aMode) const;
2382 IMPORT_C TPoint GetCurrentScreenModeScaledOrigin() const;
2383 IMPORT_C TPoint GetScreenModeScaledOrigin(TInt aMode) const;
2384 IMPORT_C TInt GetScreenSizeModeList(RArray<TInt>* aModeList);
2385 IMPORT_C TDisplayMode GetScreenModeDisplayMode(const TInt &aMode) const;
2386 //===== Used for testing purpose only ====//
2387 IMPORT_C TSizeMode GetCurrentScreenModeAttributes() const;
2388 IMPORT_C void SetCurrentScreenModeAttributes(const TSizeMode &aModeAtt);
2389 IMPORT_C TInt GetScreenNumber() const;
2390 private: // Private data
2391 CFbsTypefaceStore* iTypefaceStore;
2392 TSize iPhysicalScreenSizeInTwips;
2393 TSize iDisplaySizeInPixels;
2394 friend class CWindowGc;
2398 class RWsSpriteBase : public MWsClientClass
2399 // Client side class base class for sprites and pointer cursors
2400 /** Sprite base class.
2402 Unless stated otherwise, references to sprites in the documentation for this class also
2403 apply to pointer cursors.
2408 @see RWsPointerCursor */
2411 IMPORT_C RWsSpriteBase();
2412 IMPORT_C RWsSpriteBase(RWsSession &aWs);
2414 IMPORT_C TInt Activate();
2415 IMPORT_C TInt AppendMember(const TSpriteMember &aMemberData);
2416 IMPORT_C void UpdateMember(TInt aIndex);
2417 IMPORT_C TInt UpdateMember(TInt aIndex, const TSpriteMember &aMemberData);
2418 IMPORT_C void Close();
2422 class RWsSprite : public RWsSpriteBase
2425 This class defines functions to create and initialise a sprite, and to set
2432 IMPORT_C RWsSprite();
2433 IMPORT_C RWsSprite(RWsSession &aWs);
2434 IMPORT_C TInt Construct(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aFlags);
2435 IMPORT_C void SetPosition(const TPoint &aPos);
2439 class RWsPointerCursor : public RWsSpriteBase
2442 The pointer cursor is created in a similar way to a sprite. After creating it,
2443 one or more sprite members containing the bitmaps to be displayed are added.
2445 After a pointer cursor has been created and activated, it does not become
2446 visible until the application calls RWindowTreeNode::SetPointerCursor() or
2447 RWindowTreeNode::SetCustomPointerCursor(). The pointer cursor's origin automatically
2448 tracks the position of the pointing device, and the origin forms the pointer
2449 cursor's "hot spot", i.e., the point whose co-ordinates are sent to the client
2450 if a pointer event occurs. If the pointer cursor's bitmap needs to extend
2451 to the left or upwards from the pointer position, its sprite member should
2452 be given a negative offset in TSpriteMember::iOffset.
2456 Pointer cursors are rarely used in pure pen architectures, but they are supported
2457 for mouse or tablet use.
2463 IMPORT_C RWsPointerCursor();
2464 IMPORT_C RWsPointerCursor(RWsSession &aWs);
2465 IMPORT_C TInt Construct(TInt aFlags);
2472 class RAnimDll : public MWsClientClass
2473 /** Client-side interface to the server-side animation DLL.
2475 This is the client side class matching the server side CAnimDLL class. It
2476 provides functions to create, load, close and destroy a server-side CAnimDll
2481 @see CreateCAnimDllL()
2485 IMPORT_C RAnimDll();
2486 IMPORT_C virtual ~RAnimDll();
2487 IMPORT_C RAnimDll(RWsSession &aWs);
2488 IMPORT_C TInt Load(const TDesC &aFileName);
2489 IMPORT_C void Destroy();
2490 IMPORT_C virtual void Close();
2492 TInt CommandReply(TInt aHandle, TInt aOpcode, const TIpcArgs* aIpcArgs=NULL);
2493 TInt CommandReply(TInt aHandle, TInt aOpcode, const TDesC8& aArgs, const TIpcArgs* aIpcArgs=NULL);
2494 void Command(TInt aHandle, TInt aOpcode, const TPtrC8 &aArgs);
2495 void Command(TInt aHandle, TInt aOpcode);
2496 void AsyncCommandReply(TRequestStatus& aStatus, TInt aOpcode, TIpcArgs& aIpcArgs);
2497 TInt CreateInstance(TInt32& aHandle, const MWsClientClass &aDevice, TInt aType, const TDesC8 &aArgs, TInt aOpcode, const TIpcArgs* aIpcArgs);
2498 void DestroyInstance(TInt aHandle);
2505 /** Client-side handle to a server-side animation class.
2507 This class should be sub-classed to provide a client side interface to the
2508 server side animation DLL. The server side animation DLL is derived from CAnim.
2514 IMPORT_C virtual ~RAnim();
2515 IMPORT_C virtual void Close();
2516 IMPORT_C void Destroy();
2519 IMPORT_C RAnim(RAnimDll &aDll);
2520 IMPORT_C TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams);
2521 IMPORT_C TInt Construct(const RWindowBase &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
2522 IMPORT_C TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams);
2523 IMPORT_C TInt Construct(const RWsSprite &aDevice, TInt aType, const TDesC8 &aParams, const TIpcArgs& aIpcArgs);
2524 IMPORT_C TInt CommandReply(TInt aOpcode);
2525 IMPORT_C TInt CommandReply(TInt aOpcode, const TPtrC8 &aArgs);
2526 IMPORT_C TInt CommandReply(TInt aOpcode, const TDesC8& aArgs, const TIpcArgs& aIpcArgs);
2527 IMPORT_C void Command(TInt aOpcode, const TPtrC8 &aArgs);
2528 IMPORT_C void Command(TInt aOpcode);
2529 IMPORT_C void AsyncCommandReply(TRequestStatus& aRequestStatus,TInt aOpcode, const TIpcArgs& aIpcArgs);
2537 class RDirectScreenAccess : public MWsClientClass
2538 /** The interface between an application that directly accesses the screen and
2541 Note that most applications that need to access the screen directly should
2542 use CDirectScreenAccess instead. RDirectScreenAccess only needs to be used
2543 directly by applications without access to an active scheduler.
2549 /** Provides the reason why direct screen access must terminate. This enum is used
2550 in the MAbortDirectScreenAccess::AbortNow() and MDirectScreenAccess::Restart()
2553 The first value (ETerminateCancel) indicates that direct screen access is
2554 being terminated by the application. The final three values indicate that
2555 direct screen access is being terminated by the window server. Note that
2556 for users of CDirectScreenAccess, the termination code is not important
2557 because these issues are dealt with by CDirectScreenAccess::StartL(). */
2558 enum TTerminationReasons
2560 /** The application has finished direct screen access. */
2562 /** A window is about to come in front of a part of the area that is being used
2563 for direct screen access. */
2565 /** The screen's color depth (as enumerated by TDisplayMode) is about to change. */
2566 ETerminateScreenMode,
2567 /** The current screen mode (the combination of screen rotation and screen size)
2568 is about to change. */
2571 /** The priority of the active object that responds to notification that direct
2572 screen access must stop. */
2575 /** A suggested value for the priority of the active object that responds to notification
2576 from the window server that direct screen access must stop. This is also the
2577 value used by CDirectScreenAccess for this purpose. */
2578 EPriorityVeryHigh=2000,
2581 IMPORT_C RDirectScreenAccess();
2582 IMPORT_C RDirectScreenAccess(RWsSession& aWs);
2583 IMPORT_C TInt Construct();
2584 IMPORT_C TInt Request(RRegion*& aRegion,TRequestStatus& aStatus,const RWindowBase& aWindow);
2585 IMPORT_C void Completed();
2586 IMPORT_C void Cancel();
2587 IMPORT_C void Close();
2590 CDsaMsgQueue* iMsgQueue;
2591 // To maintain BC we need the following
2593 TRequestStatus* iDummyRequest;
2597 class MAbortDirectScreenAccess
2598 /** The interface for terminating direct screen access.
2600 An object of a class which implements this interface should be passed to CDirectScreenAccess::NewL().
2604 @see MDirectScreenAccess */
2607 /** This function is called by the window server when direct screen access must
2608 stop (for example because a dialogue is moved in front of the area where direct
2609 screen access is taking place).
2611 In response to this, direct screen access must stop immediately. In simple cases,
2612 this will involve cancelling the active object that is driving the drawing to the
2615 No attempt to call a Window Server API function can be made from
2616 AbortNow(), because then a temporary deadlock will occur. This is because WSERV
2617 is waiting to receive the client's acknowledgment that it has aborted, and so will
2618 not be able to service the call. As soon as the restriction no longer applies,
2619 the function Restart() will be called.
2621 @param aReason The reason why direct screen access was terminated. */
2622 virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason)=0;
2626 class MDirectScreenAccess : public MAbortDirectScreenAccess
2627 /** The interface for restarting direct screen access.
2629 The Restart() function is called by the window server as soon as direct screen
2630 access can resume. It is called after the window server has called AbortNow().
2632 An object of the derived class is passed to CDirectScreenAccess::NewL().
2636 @see CDirectScreenAccess::NewL() */
2639 /** This function is called by the window server as soon as direct screen access
2642 This function should call CDirectScreenAccess::StartL() within a trap harness.
2643 If this leaves, e.g. through lack of memory, direct screen access cannot be
2644 restarted. StartL() re-calculates the clipping region, so that if direct screen
2645 access was aborted because another window appeared in front of it, that window
2646 will not be overwritten when direct screen access resumes.
2648 In this function, you can resume calls to Window Server Client Side API functions.
2650 @param aReason Provides the reason why direct screen access was terminated. */
2651 virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason)=0;
2655 class CDirectScreenAccess : public CActive
2656 /** An active object used to start direct screen access.
2658 Direct screen access is a way of drawing to the screen without using the window
2659 server. As this avoids client-server communication, it is much faster, and
2660 may be useful for games and video. Note that some interaction with the window
2661 server is needed in order to prevent the application from drawing over other
2664 The object's (private) RunL() function is called by the window server in order
2665 to abort direct screen access. This might occur when another window needs
2666 to be displayed in front or when the window with direct screen access is moved.
2667 The active object's priority is RDirectScreenAccess::EPriorityVeryHigh so
2668 that direct screen access will be aborted as quickly as possible.
2674 IMPORT_C static CDirectScreenAccess* NewL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWin,MDirectScreenAccess& aAbort);
2675 ~CDirectScreenAccess();
2676 IMPORT_C void StartL();
2677 inline CFbsBitGc* Gc();
2678 inline CFbsScreenDevice*& ScreenDevice();
2679 inline RRegion* DrawingRegion();
2683 EDirectCheckModeChange=0x1,
2684 EDirectCheckSizeModeChange=0x2,
2687 inline CDirectScreenAccess(RWsSession& aWs,CWsScreenDevice* aScreenDevice,RWindowBase& aWindow,MDirectScreenAccess& aAbort);
2688 void ConstructL(RWsSession& aWs);
2689 void CreateScreenObjectsL(TDisplayMode aCurrentMode);
2690 void UpdateSizeAndRotation(CFbsBitGc* aGc);
2691 static TInt Restart(TAny* aDirect);
2693 //Pure virtual functions from CActive
2698 CFbsScreenDevice* iScreenDevice;
2699 RRegion* iDrawingRegion;
2700 RWindowBase& iWindow;
2701 CWsScreenDevice* iWsScreenDevice;
2702 MDirectScreenAccess& iAbort;
2703 RDirectScreenAccess iDirectAccess;
2704 RDirectScreenAccess::TTerminationReasons iReason;
2713 class RSoundPlugIn : public MWsClientClass
2714 /** Client interface to the key or pointer click plug-in DLL.
2716 The plug-in DLL implements the CClickMaker class.
2723 /** A possible return value for CommandReply(). */
2726 /** The value returned by CommandReply() if no plug-in is loaded,
2727 or if the plug-in identified by the aUid parameter in Construct() is not loaded.
2728 Its value is set to KMinTInt so that it should not clash with any other expected
2729 return value from this function. */
2730 ESoundWrongPlugIn=KMinTInt
2733 IMPORT_C RSoundPlugIn();
2734 IMPORT_C RSoundPlugIn(RWsSession &aWs);
2735 IMPORT_C TInt Construct(TUid aUid=KNullUid);
2736 IMPORT_C void Close();
2737 IMPORT_C void Destroy();
2738 IMPORT_C TBool IsLoaded(TBool& aIsChangeable);
2739 IMPORT_C TInt Unload();
2740 IMPORT_C TInt Load(const TDesC &aFileName);
2741 IMPORT_C void SetKeyClick(TBool aEnabled);
2742 IMPORT_C void SetPenClick(TBool aEnabled);
2743 IMPORT_C TBool KeyClickEnabled();
2744 IMPORT_C TBool PenClickEnabled();
2745 IMPORT_C TInt CommandReply(TInt aOpcode, const TPtrC8 &aArgs);
2748 inline TInt MWsClientClass::WsHandle() const
2749 /** Gets the server side handle for the object.
2751 @return The server-side handle for the object. */
2752 {return(iWsHandle);}
2754 inline TInt CWsScreenDevice::CreateContext(CWindowGc *&aGc)
2755 /** Creates a graphics context for this device.
2757 This function always causes a flush of the window server buffer.
2759 @param aGc On successful return, contains a new graphics context referring
2760 to this screen device.
2761 @return KErrNone if successful, otherwise one of the system-wide error codes.
2762 @see CGraphicsDevice::CreateContext() */
2763 {return(CreateContext((CGraphicsContext *&)aGc));}
2765 inline TUint TWsRedrawEvent::Handle() const
2766 /** Gets the handle of the window which is the target of the redraw event.
2768 This is the handle that was passed to the window's Construct() function: typically
2769 it will be a pointer to the object owning the window, providing access to
2770 its member functions.
2772 @return The window's handle. */
2775 inline TRect TWsRedrawEvent::Rect() const
2776 /** Gets the rectangle to redraw.
2778 @return The rectangle that needs redrawing. Co-ordinates are relative to
2779 the window whose handle is given by Handle(). */
2782 inline TPointerEvent *TWsEvent::Pointer() const
2783 /** Gets the pointer event.
2785 This function can be used to get information about the pointer event if Type()
2786 returns an event of type EEventPointer. or EEventDragDrop.
2788 @return Structure containing pointer event data. */
2789 {return((TPointerEvent *)&iEventData);}
2791 inline TKeyEvent *TWsEvent::Key() const
2792 /** Gets the key event.
2794 This function can be used to get information about the key event if Type()
2795 returns an event of type EEventKey, EEventKeyUp or EEventKeyDown.
2797 @return Structure containing key event data */
2798 {return((TKeyEvent *)&iEventData);}
2800 inline TWsVisibilityChangedEvent* TWsEvent::VisibilityChanged()
2801 /** Gets information about the visibility changed event.
2803 This function can be used to get information about the visibility changed event
2804 if Type() returns an event of type EEventWindowVisibilityChanged.
2806 @return Structure containing visibility changed event data */
2807 { return reinterpret_cast<TWsVisibilityChangedEvent*>(iEventData); }
2809 inline const TWsVisibilityChangedEvent* TWsEvent::VisibilityChanged() const
2810 /** Gets information about the visibility changed event.
2812 This function can be used to get information about the visibility changed event
2813 if Type() returns an event of type EEventWindowVisibilityChanged.
2815 @return Structure containing visibility changed event data */
2816 { return reinterpret_cast<const TWsVisibilityChangedEvent*>(iEventData); }
2818 inline TModifiersChangedEvent *TWsEvent::ModifiersChanged() const
2819 /** Gets information about the modifier changed event.
2821 This function can be used to get information about the modifier changed event
2822 if Type() returns an event of type EEventModifiersChanged.
2824 @return Structure containing modifier changed event data */
2825 {return((TModifiersChangedEvent *)&iEventData);}
2827 inline TWsErrorMessage *TWsEvent::ErrorMessage() const
2828 /** Gets an error event.
2830 This function can be used to get information about the error event if Type()
2831 returns an event of type EEventErrorMessage.
2833 @return The error event. */
2834 {return((TWsErrorMessage *)&iEventData);}
2836 inline TUint8 *TWsEvent::EventData() const
2837 /** Gets information about the event.
2839 This function gives you direct access to the event data as a whole. The event
2840 can be a key or pointer event or it could be a new special event that only
2841 you and another application know about. You are limited to EWsEventDataSize
2842 bytes worth of data.
2844 @return A pointer to the event data. */
2845 {return((TUint8 *)&iEventData);}
2847 inline TInt TWsEvent::Type() const
2848 /** Gets the type of event that occurred.
2850 @return The event type. Event types are defined in TEventCode. */
2853 inline TUint TWsEvent::Handle() const
2854 /** Gets the window handle.
2856 This is the handle that was passed to the window's Construct() function: typically
2857 it will be a pointer to the client-side object owning the window, providing
2858 access to its member functions.
2860 @return The window handle. */
2863 inline TTime TWsEvent::Time() const
2864 /** Gets the time when the event occurred.
2866 @return The time when the event occurred. */
2869 inline void TWsEvent::SetType(TInt aType)
2870 /** Sets the event type.
2872 @param aType The event type. Event types are defined in TEventCode. */
2875 inline void TWsEvent::SetHandle(TUint aHandle)
2876 /** Sets the event handle.
2878 This is the client handle of the window that is being sent the event.
2880 @param aHandle The event handle. */
2883 inline void TWsEvent::SetTimeNow()
2884 /** Sets the event time to the current time. */
2885 {iTime.UniversalTime();}
2887 inline TInt *TWsEvent::Int() const
2888 /** Gets the event data as a TInt.*/
2889 { return (TInt*)&iEventData; }
2891 inline TUint TWsPriorityKeyEvent::Handle() const
2892 /** Gets the handle for the window group which added the priority key.
2894 This is the handle that was passed to the window group's Construct() function.
2895 Since most applications have only one window group, however, this function
2898 @return The window group handle. */
2901 inline TKeyEvent *TWsPriorityKeyEvent::Key() const
2902 /** Gets the priority key event.
2904 @return Structure containing priority key event data */
2905 {return((TKeyEvent *)&iEventData);}
2907 inline void TWsPriorityKeyEvent::SetHandle(TUint aHandle)
2908 /** Sets the window group event handle.
2910 This is the client handle of the window that is being sent the event.
2912 @param aHandle The event handle. */
2915 inline CDirectScreenAccess::CDirectScreenAccess(RWsSession& aWs,CWsScreenDevice* aScreenDevice,RWindowBase& aWindow,MDirectScreenAccess& aAbort)
2916 :CActive(RDirectScreenAccess::EPriorityVeryHigh), iWindow(aWindow), iAbort(aAbort), iDirectAccess(aWs)
2917 {iWsScreenDevice=aScreenDevice;}
2919 inline CFbsBitGc* CDirectScreenAccess::Gc()
2920 /** Gets the graphics context for drawing to the screen.
2922 This is set up by calling StartL(). Its origin is set so that you should use
2923 window coordinates to specify which part of the screen to draw to and its
2924 clipping region is set to the visible part of the window.
2926 Code built to run on the Emulator must call CFbsScreenDevice::Update() in
2927 order to see the results of drawing to this graphics context, but this may
2928 not be required on all target hardware.
2930 @return The graphics context for drawing to the screen. */
2933 inline CFbsScreenDevice*& CDirectScreenAccess::ScreenDevice()
2934 /** Gets the screen device to draw to.
2936 You should not use this screen device to create fonts because the object is
2937 deleted and recreated when direct screen access is aborted and restarted.
2938 Instead, create and use your own CFbsScreenDevice object to create fonts.
2940 @return The target screen device. */
2941 { return iScreenDevice; }
2943 inline RRegion* CDirectScreenAccess::DrawingRegion()
2944 /** Gets the clipping region to draw to.
2946 You must not draw outside of this region.
2948 The clipping region is calculated when StartL() is called, and is only updated
2949 if StartL() is called again.
2951 The region is specified in screen coordinates. This can be useful if you need
2952 to reapply the clipping region to the graphics context (CFbsBitGc::SetClippingRegion()).
2954 @return The clipping region to draw to. */
2955 { return iDrawingRegion; }
2957 inline TSizeMode::TSizeMode(TSize& aSize) :
2958 iOrigin(0, 0), iScreenSize(aSize)
2961 inline TInt TSizeMode::ScaledCord(TInt aOrigin,TInt aScale)
2962 {return (aOrigin+aScale-1)/aScale;}
2964 inline TPoint TSizeMode::ScaledOrigin()
2965 {return TPoint(ScaledCord(iOrigin.iX,iScreenScale.iWidth),ScaledCord(iOrigin.iY,iScreenScale.iHeight));}