|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Definition of class that needs to be provided by a Key Click plugin |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __W32CLICK_H__ |
|
19 #define __W32CLICK_H__ |
|
20 |
|
21 #ifndef __E32STD_H__ |
|
22 #include <e32std.h> |
|
23 #endif |
|
24 #ifndef __E32BASE_H__ |
|
25 #include <e32base.h> |
|
26 #endif |
|
27 #ifndef __W32STD_H__ |
|
28 #include <w32std.h> |
|
29 #endif |
|
30 |
|
31 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
32 #include <graphics/pointereventdata.h> |
|
33 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
34 |
|
35 class CClickMaker: public CBase |
|
36 /** Key or pointer click plug-in provider interface. |
|
37 |
|
38 This class should be implemented by a plug-in DLL in order to produce a sound |
|
39 when a key is pressed, a key auto repeats or when the screen is tapped with |
|
40 a pointer. When any of these events occur, the window server informs the plug-in |
|
41 DLL, which can then make the sound. |
|
42 |
|
43 The details of the event are also passed to the plug-in so that the sound |
|
44 can be tailored to the precise event, for example clicking on different keys on the |
|
45 keypad or on different parts of the screen could make different sounds. |
|
46 |
|
47 The name of the initial plug-in to use can be specified in the wsini.ini configuration |
|
48 file using the KEYCLICKPLUGIN or KEYCLICKPLUGINFIXED keywords. When the operating |
|
49 system boots, wsini.ini is read for the name of this plug-in. If a plug-in |
|
50 name exists, the window server will try to load it. At a later time, any client |
|
51 of the window server can request a new plug-in to be loaded or the current |
|
52 one to be unloaded, using the RSoundPlugIn class. |
|
53 |
|
54 The plug-in is a polymorphic DLL which implements the CClickMaker interface. |
|
55 Its first UID is KDynamicLibraryUidValue and its second UID is 0x10004F63. |
|
56 Its first exported function should create an object of the CClickMaker sub-class |
|
57 and should have the following signature: |
|
58 |
|
59 EXPORT_C CClickMaker* CreateClickMakerL() |
|
60 |
|
61 @publishedAll |
|
62 @released |
|
63 @see RSoundPlugIn */ |
|
64 { |
|
65 public: |
|
66 /** This function is called by the window server whenever there is a key event, |
|
67 to generate the sound. |
|
68 |
|
69 It must be implemented by the key or pointer click plug-in. |
|
70 |
|
71 If the sound cannot be made, the function should continue without leaving. |
|
72 |
|
73 @param aType The type of key event: EEventKey, EEventKeyUp, EEventKeyDown |
|
74 or EEventKeyRepeat. |
|
75 @param aEvent The key event details. */ |
|
76 virtual void KeyEvent(TEventCode aType,const TKeyEvent& aEvent)=0; |
|
77 |
|
78 /** This function is called by the window server whenever there is a pointer event, |
|
79 to generate the sound. |
|
80 |
|
81 It must be implemented by the key or pointer click plug-in. |
|
82 |
|
83 If the sound cannot be made, the function should continue without leaving. |
|
84 |
|
85 The iParentPosition data member of aEvent is not the position of the pointer |
|
86 event relative to origin of the parent window. Instead it is the position |
|
87 on the screen. This is because the parent window has no meaning inside the |
|
88 plug-in as it does to the window server client and also knowledge |
|
89 of the screen position may be useful to the plug-in. |
|
90 |
|
91 On devices where these features are supported, aEvent will contain pointer number, |
|
92 proximity of the pointer to the screen and/or pressure applied by the pointer to the screen. |
|
93 In order to retrieve this information, implementation of this method should |
|
94 use TPointerEvent::AdvancedPointerEvent(). |
|
95 |
|
96 @param aEvent The pointer event details. |
|
97 @see TPointerEvent::AdvancedPointerEvent() */ |
|
98 virtual void PointerEvent(const TPointerEvent& aEvent)=0; |
|
99 |
|
100 /** This function is intended for future expansion of the interface, in case it |
|
101 needs to support sounds for other types of event. |
|
102 |
|
103 Currently it is called by the window server, with several values for aType. |
|
104 For each of these aParam will need to be cast to a different class type |
|
105 to get the data: |
|
106 EEventPointer: cast to TPointerEventData* |
|
107 EEventScreenDeviceChanged: TClickMakerData* |
|
108 EEventGroupWindowOpen: TGroupWindowOpenData* |
|
109 EEventGroupWindowClose: TInt (the identifier of the window group being closed) |
|
110 EEventWindowClose: TWindowCloseData* |
|
111 |
|
112 @param aType One of the above listed values, in future may be used with other values. |
|
113 @param aParam See above. */ |
|
114 virtual void OtherEvent(TInt aType,TAny* aParam=NULL)=0; |
|
115 |
|
116 /** This function may be implemented by the key or pointer click plug-in to enable |
|
117 the plug-in to communicate with the window server client. |
|
118 |
|
119 If this is not required, the implementation may simply return zero. |
|
120 |
|
121 It is called by RSoundPlugIn::CommandReply() which returns the value returned |
|
122 by this function. |
|
123 |
|
124 The return value can be generated either by returning it from the function |
|
125 or by leaving with the value. In either case, the client will get back the |
|
126 value concerned. |
|
127 |
|
128 @param aOpcode Opcode understood by both the window server client and the |
|
129 plug-in DLL. |
|
130 @param aArgs Arguments packaged by the window server client. |
|
131 @return A value passed back to the client. This may be KErrNone or another |
|
132 of the system-wide error codes. */ |
|
133 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs)=0; |
|
134 }; |
|
135 |
|
136 struct TClickMakerData |
|
137 /** |
|
138 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the |
|
139 aType value is EEventScreenDeviceChanged. |
|
140 |
|
141 @publishedAll |
|
142 @released |
|
143 */ |
|
144 { |
|
145 TInt screenDeviceMode; |
|
146 }; |
|
147 |
|
148 class TGroupWindowOpenData |
|
149 /** |
|
150 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the |
|
151 aType value is EEventGroupWindowOpen. |
|
152 |
|
153 @publishedAll |
|
154 @released |
|
155 */ |
|
156 { |
|
157 public: |
|
158 /** |
|
159 The Window Group Identifier of the window being created. |
|
160 */ |
|
161 TInt iIdentifier; |
|
162 /** |
|
163 A number unique to the client creating the window group - allows the Plug-in to tell |
|
164 different clients apart. |
|
165 */ |
|
166 TUint iClient; |
|
167 /** |
|
168 The number of Window Groups currently owned by that client (not including the one being created). |
|
169 */ |
|
170 TInt iNumClientWindowGroups; |
|
171 }; |
|
172 |
|
173 class TWindowCloseData |
|
174 /** |
|
175 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the aType value |
|
176 is EEventWindowClose. |
|
177 |
|
178 @publishedAll |
|
179 @released |
|
180 */ |
|
181 { |
|
182 public: |
|
183 /** |
|
184 The client handle of the window being closed. |
|
185 */ |
|
186 TUint32 iClientHandle; |
|
187 /** |
|
188 The Window Group Identifier of the window group that is a parent (or grandparent etc.) |
|
189 of the window being closed, or 0 if the window has been orphaned. |
|
190 */ |
|
191 TInt iWindowGroupId; |
|
192 }; |
|
193 |
|
194 #endif |