1 // Copyright (c) 1995-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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\e32event.h
18 #ifndef __E32EVENT_H__
19 #define __E32EVENT_H__
21 #ifdef BTRACE_TRAWEVENT
22 #include <e32btrace.h>
29 const TInt KUndefinedDeviceNumber = -1;
35 Represents a raw hardware event as generated by hardware drivers of
36 a pointer device, a keyboard etc.
38 Raw hardware events are added to the kernel's event queue.
45 Defines the event type.
51 Represents an uninitialised event object.
56 A pointer device (e.g. a pen) has moved. Only changes in Cartesian coordinates are tracked.
61 A switch on event caused by a screen tap using a pointer device.
66 Represents a keyboard key down event.
71 Represents a keyboard key up event.
76 Represents a redraw event.
78 Typically generated in an emulator environment in response
79 to a host OS redraw event.
84 Represents a device switch on event.
97 Represents a modifier key being pressed.
102 Represents a button down event.
104 This is typically used to represent a pointing device
105 coming into contact with a touch sensitive screen.
110 Represents a button up event.
112 This is typically used to represent a pointing device
113 being lifted away from a touch sensitive screen.
118 Represents a button down event.
120 This is typically used to represent a pointing device
121 coming into contact with a touch sensitive screen.
126 Represents a button up event.
128 This is typically used to represent a pointing device
129 being lifted away from a touch sensitive screen.
134 Represents a button down event.
136 This is typically used to represent a pointing device
137 coming into contact with a touch sensitive screen.
142 Represents a button up event.
144 This is typically used to represent a pointing device
145 being lifted away from a touch sensitive screen.
150 Represents a device switch off event.
155 Represents a key being continually pressed event.
160 Represents a case open event.
162 The meaning of a case is hardware specific.
167 Represents a case close event.
169 The meaning of a case is hardware specific.
175 Represents a 3D pointer entering the detection volume event.
177 This is typically used to represent a pointing device
178 coming into detection range of a sensitive screen.
184 Represents a 3D pointer leaving the detection volume event.
186 This is typically used to represent a pointing device
187 leaving the detection range of a sensitive screen.
189 EPointer3DOutOfRange,
193 Represents a 3D pointer tilt changes only event.
195 This is typically sent by a 3D pointer driver when it detects
196 a change in the pointer's polar coordinates (Theta or Phi).
202 Represents a 3D pointer rotation only event.
204 This is typically sent by a 3D pointer driver when it detects
205 a rotation of the pointing device (along ist main axis).
211 Represents a general 3D pointer changes event.
213 This is typically sent by a 3D pointer driver when it detects
214 a change in the pointer's linear and/or polar coordinates and/or rotation.
216 EPointer3DTiltAndMove,
220 Reserved for a 3D pointing device button down event.
226 Reserved for a 3D pointing device button up event.
232 Reserved for a 3D pointing device button down event.
238 Reserved for a 3D pointing device button up event.
244 Reserved for a 3D pointing device button down event.
250 Reserved for a 3D pointing device button up event.
255 Represents a device restart event.
265 { *(TInt*)&iType=0; }
270 @return The event type.
272 inline TType Type() const
273 {return TType(iType);}
276 Gets the device number (eg. screen number)
278 @return The device number.
280 inline TInt DeviceNumber() const
281 {return TInt(iDeviceNumber-1);}
284 Sets the device number (eg. screen number)
286 @param aDeviceNumber The device number
288 inline void SetDeviceNumber(TInt aDeviceNumber)
289 {iDeviceNumber = TUint8(aDeviceNumber+1);}
291 IMPORT_C TPoint Pos() const;
292 IMPORT_C TInt ScanCode() const;
293 IMPORT_C TInt Modifiers() const;
294 IMPORT_C TInt Repeats() const;
297 Gets the Cartesian coordinates of the 3D pointer end that is closer to the screen.
299 @return The Cartesian coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
301 IMPORT_C TPoint3D Pos3D() const;
305 Gets the angular spherical polar coordinates of the 3D pointer end that is closer to the screen.
307 @return The angular spherical polar coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
310 IMPORT_C TAngle3D Tilt() const;
313 Gets the rotation angle of 3D pointing device.
315 Some 3D pointing devices support information regarding the angle formed between the physical and magnetical poles,
316 as obtaining when rotating the pen along its main axis.
318 @return The rotation angle of the 3D pointing device.
320 IMPORT_C TInt Rotation() const;
323 Gets the tick count value associated with the event.
325 Note that the interval between tick counts is
328 @return The tick count value
330 inline TUint Ticks() const
333 Gets the information on which end of the pointing device is closer to the screen
335 @return A Boolean indicating which end of the pointing device is closer to the screen.
337 inline TBool IsTip() const
338 {return TBool(iTip);}
341 Sets the information on which end of the pointing device is closer to the screen
343 @param aTip A Boolean indicating which end of the pointing device is closer to the screen.
345 inline void SetTip(TBool aTip)
346 {iTip = TUint8(aTip);
347 #ifdef BTRACE_TRAWEVENT
348 BTraceContext4(BTrace::ERawEvent, BTrace::ESetTipEvent,(TUint32)aTip);
352 IMPORT_C void Set(TType aType,TInt aScanCode);
353 IMPORT_C void Set(TType aType,TInt aX,TInt aY);
354 IMPORT_C void Set(TType aType);
356 IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ);
357 IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha);
359 IMPORT_C void SetTilt(TType aType,TInt aPhi,TInt aTheta);
360 IMPORT_C void SetRotation(TType aType,TInt aAlpha);
361 IMPORT_C void SetRepeat(TType aType,TInt aScanCode,TInt aRepeats);
364 @return the pointer number of the the event
366 inline TUint8 PointerNumber() const
368 return iPointerNumber;
373 The pointer number for the event is set
374 The pointer number should be more or equal 0 and should be less than HALData::EPointerMaxPointers,
375 otherwise WSERV would ignore the event,ie 0 <= aPointerNumber < HALData::EPointerMaxPointers
376 @param aPointerNumber
377 Error conditions: None.
379 inline void SetPointerNumber(const TUint8 aPointerNumber)
381 iPointerNumber=aPointerNumber;
382 #ifdef BTRACE_TRAWEVENT
383 BTraceContext4(BTrace::ERawEvent, BTrace::ESetPointerNumberEvent,(TUint32)aPointerNumber);
388 Initialises the event with the supplied information
389 @param aType The event type.
390 @param aX The X position.
391 @param aY The Y position.
392 @param aZ The Z position.
393 @param aPointerNumber The pointer number for the event
395 IMPORT_C void Set (TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber);
399 TUint8 iTip; /**< Indicates whether the tip or head of pointing device is closer to screen.*/
400 TUint8 iPointerNumber; //
401 TUint8 iDeviceNumber;
405 struct {TInt x;TInt y;} pos;
406 struct {TInt x;TInt y;TInt z;TInt phi;TInt theta;TInt alpha;} pos3D;
407 struct {TInt scanCode;TInt repeats;} key;
419 Encapsulates a hardware event object as a descriptor (package buffer) for
420 the purpose of data transfer.
422 class TRawEventBuf : public TPckgBuf<TRawEvent>
427 Gets the hardware event object from the package buffer.
429 @return The hardware event object.
431 inline TRawEvent &Event() const {return(*((TRawEvent *)&iBuf[0]));}
434 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
435 #include <e32event_private.h>