1 // Copyright (c) 2001-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 // Definition of class that needs to be provided by a Key Click plugin
18 #ifndef __W32CLICK_H__
19 #define __W32CLICK_H__
32 class CClickMaker: public CBase
33 /** Key or pointer click plug-in provider interface.
35 This class should be implemented by a plug-in DLL in order to produce a sound
36 when a key is pressed, a key auto repeats or when the screen is tapped with
37 a pointer. When any of these events occur, the window server informs the plug-in
38 DLL, which can then make the sound.
40 The details of the event are also passed to the plug-in so that the sound
41 can be tailored to the precise event, for example clicking on different keys on the
42 keypad or on different parts of the screen could make different sounds.
44 The name of the initial plug-in to use can be specified in the wsini.ini configuration
45 file using the KEYCLICKPLUGIN or KEYCLICKPLUGINFIXED keywords. When the operating
46 system boots, wsini.ini is read for the name of this plug-in. If a plug-in
47 name exists, the window server will try to load it. At a later time, any client
48 of the window server can request a new plug-in to be loaded or the current
49 one to be unloaded, using the RSoundPlugIn class.
51 The plug-in is a polymorphic DLL which implements the CClickMaker interface.
52 Its first UID is KDynamicLibraryUidValue and its second UID is 0x10004F63.
53 Its first exported function should create an object of the CClickMaker sub-class
54 and should have the following signature:
56 EXPORT_C CClickMaker* CreateClickMakerL()
63 /** This function is called by the window server whenever there is a key event,
64 to generate the sound.
66 It must be implemented by the key or pointer click plug-in.
68 If the sound cannot be made, the function should continue without leaving.
70 @param aType The type of key event: EEventKey, EEventKeyUp, EEventKeyDown
72 @param aEvent The key event details. */
73 virtual void KeyEvent(TEventCode aType,const TKeyEvent& aEvent)=0;
75 /** This function is called by the window server whenever there is a pointer event,
76 to generate the sound.
78 It must be implemented by the key or pointer click plug-in.
80 If the sound cannot be made, the function should continue without leaving.
82 The iParentPosition data member of aEvent is not the position of the pointer
83 event relative to origin of the parent window. Instead it is the position
84 on the screen. This is because the parent window has no meaning inside the
85 plug-in as it does to the window server client and also knowledge
86 of the screen position may be useful to the plug-in.
88 @param aEvent The pointer event details. */
89 virtual void PointerEvent(const TPointerEvent& aEvent)=0;
91 /** This function is intended for future expansion of the interface, in case it
92 needs to support sounds for other types of event.
94 Currently it is called by the window server, with several values for aType.
95 For each of these aParam will need to be cast to a different class type
97 EEventPointer: cast to TPointerEventData*
98 EEventScreenDeviceChanged: TClickMakerData*
99 EEventGroupWindowOpen: TGroupWindowOpenData*
100 EEventGroupWindowClose: TInt (the identifier of the window group being closed)
101 EEventWindowClose: TWindowCloseData*
103 @param aType One of the above listed values, in future may be used with other values.
104 @param aParam See above. */
105 virtual void OtherEvent(TInt aType,TAny* aParam=NULL)=0;
107 /** This function may be implemented by the key or pointer click plug-in to enable
108 the plug-in to communicate with the window server client.
110 If this is not required, the implementation may simply return zero.
112 It is called by RSoundPlugIn::CommandReply() which returns the value returned
115 The return value can be generated either by returning it from the function
116 or by leaving with the value. In either case, the client will get back the
119 @param aOpcode Opcode understood by both the window server client and the
121 @param aArgs Arguments packaged by the window server client.
122 @return A value passed back to the client. This may be KErrNone or another
123 of the system-wide error codes. */
124 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs)=0;
127 struct TClickMakerData
129 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the
130 aType value is EEventScreenDeviceChanged.
136 TInt screenDeviceMode;
139 class TPointerEventData
141 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the
142 aType value is EEventPointer.
143 This includes information about the window the pointer event will be sent to.
144 This is the normally the window being clicked on by the user, but pointer capturing
145 and grabbing may affect this.
154 A list of locations that WSERV receives events from
157 /** The source is not specified. */
159 /** The event came from the kernel. */
161 /** The event came from a client API. */
163 /** The event came from an Anim DLL. */
168 The version number of the data passed with EEventPointer, current always 0.
172 The screen position of pointer event.
176 The full pointer event data previously passed to the CClickMaker::PointerEvent function,
177 except that the iParentPosition will be the actual parent position, when previously passed
178 to the plug-in this value was the screen position.
180 TPointerEvent iPointerEvent;
182 The client handle of the window or zero if the window is not a client window.
184 TUint32 iClientHandle;
186 The current top left of the window on the screen.
188 TPoint iWindowOrigin;
190 The Window Group Identifier of the window group that is a parent (or grand parent etc.)
191 of the window the event is sent to or zero if the window is not a client window.
195 The source that WSERV recieves the event from,
196 currently set to EUnspecified as this is for future expansion.
201 class TGroupWindowOpenData
203 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the
204 aType value is EEventGroupWindowOpen.
212 The Window Group Identifier of the window being created.
216 A number unique to the client creating the window group - allows the Plug-in to tell
217 different clients apart.
221 The number of Window Groups currently owned by that client (not including the one being created).
223 TInt iNumClientWindowGroups;
226 class TWindowCloseData
228 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the aType value
229 is EEventWindowClose.
237 The client handle of the window being closed.
239 TUint32 iClientHandle;
241 The Window Group Identifier of the window group that is a parent (or grandparent etc.)
242 of the window being closed, or 0 if the window has been orphaned.