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 "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 // e32\include\e32event.h
18 #ifndef __E32EVENT_H__
19 #define __E32EVENT_H__
26 const TInt KUndefinedDeviceNumber = -1;
32 Represents a raw hardware event as generated by hardware drivers of
33 a pointer device, a keyboard etc.
35 Raw hardware events are added to the kernel's event queue.
42 Defines the event type.
48 Represents an uninitialised event object.
53 A pointer device (e.g. a pen) has moved. Only changes in Cartesian coordinates are tracked.
58 A switch on event caused by a screen tap using a pointer device.
63 Represents a keyboard key down event.
68 Represents a keyboard key up event.
73 Represents a redraw event.
75 Typically generated in an emulator environment in response
76 to a host OS redraw event.
81 Represents a device switch on event.
94 Represents a modifier key being pressed.
99 Represents a button down event.
101 This is typically used to represent a pointing device
102 coming into contact with a touch sensitive screen.
107 Represents a button up event.
109 This is typically used to represent a pointing device
110 being lifted away from a touch sensitive screen.
115 Represents a button down event.
117 This is typically used to represent a pointing device
118 coming into contact with a touch sensitive screen.
123 Represents a button up event.
125 This is typically used to represent a pointing device
126 being lifted away from a touch sensitive screen.
131 Represents a button down event.
133 This is typically used to represent a pointing device
134 coming into contact with a touch sensitive screen.
139 Represents a button up event.
141 This is typically used to represent a pointing device
142 being lifted away from a touch sensitive screen.
147 Represents a device switch off event.
152 Represents a key being continually pressed event.
157 Represents a case open event.
159 The meaning of a case is hardware specific.
164 Represents a case close event.
166 The meaning of a case is hardware specific.
172 Represents a 3D pointer entering the detection volume event.
174 This is typically used to represent a pointing device
175 coming into detection range of a sensitive screen.
181 Represents a 3D pointer leaving the detection volume event.
183 This is typically used to represent a pointing device
184 leaving the detection range of a sensitive screen.
186 EPointer3DOutOfRange,
190 Represents a 3D pointer tilt changes only event.
192 This is typically sent by a 3D pointer driver when it detects
193 a change in the pointer's polar coordinates (Theta or Phi).
199 Represents a 3D pointer rotation only event.
201 This is typically sent by a 3D pointer driver when it detects
202 a rotation of the pointing device (along ist main axis).
208 Represents a general 3D pointer changes event.
210 This is typically sent by a 3D pointer driver when it detects
211 a change in the pointer's linear and/or polar coordinates and/or rotation.
213 EPointer3DTiltAndMove,
217 Reserved for a 3D pointing device button down event.
223 Reserved for a 3D pointing device button up event.
229 Reserved for a 3D pointing device button down event.
235 Reserved for a 3D pointing device button up event.
241 Reserved for a 3D pointing device button down event.
247 Reserved for a 3D pointing device button up event.
252 Represents a device restart event.
262 { *(TInt*)&iType=0; }
267 @return The event type.
269 inline TType Type() const
270 {return TType(iType);}
273 Gets the device number (eg. screen number)
275 @return The device number.
277 inline TInt DeviceNumber() const
278 {return TInt(iDeviceNumber-1);}
281 Sets the device number (eg. screen number)
283 @param aDeviceNumber The device number
285 inline void SetDeviceNumber(TInt aDeviceNumber)
286 {iDeviceNumber = TUint8(aDeviceNumber+1);}
288 IMPORT_C TPoint Pos() const;
289 IMPORT_C TInt ScanCode() const;
290 IMPORT_C TInt Modifiers() const;
293 Gets the Cartesian coordinates of the 3D pointer end that is closer to the screen.
295 @return The Cartesian coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
297 IMPORT_C TPoint3D Pos3D() const;
301 Gets the angular spherical polar coordinates of the 3D pointer end that is closer to the screen.
303 @return The angular spherical polar coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
306 IMPORT_C TAngle3D Tilt() const;
309 Gets the rotation angle of 3D pointing device.
311 Some 3D pointing devices support information regarding the angle formed between the physical and magnetical poles,
312 as obtaining when rotating the pen along its main axis.
314 @return The rotation angle of the 3D pointing device.
316 IMPORT_C TInt Rotation() const;
319 Gets the tick count value associated with the event.
321 Note that the interval between tick counts is
324 @return The tick count value
326 inline TUint Ticks() const
329 Gets the information on which end of the pointing device is closer to the screen
331 @return A Boolean indicating which end of the pointing device is closer to the screen.
333 inline TBool IsTip() const
334 {return TBool(iTip);}
337 Sets the information on which end of the pointing device is closer to the screen
339 @param aTip A Boolean indicating which end of the pointing device is closer to the screen.
341 inline void SetTip(TBool aTip)
342 {iTip = TUint8(aTip);}
344 IMPORT_C void Set(TType aType,TInt aScanCode);
345 IMPORT_C void Set(TType aType,TInt aX,TInt aY);
346 IMPORT_C void Set(TType aType);
348 IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ);
349 IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha);
351 IMPORT_C void SetTilt(TType aType,TInt aPhi,TInt aTheta);
352 IMPORT_C void SetRotation(TType aType,TInt aAlpha);
356 TUint8 iTip; /**< Indicates whether the tip or head of pointing device is closer to screen.*/
358 TUint8 iDeviceNumber;
362 struct {TInt x;TInt y;} pos;
363 struct {TInt x;TInt y;TInt z;TInt phi;TInt theta;TInt alpha;} pos3D;
376 Encapsulates a hardware event object as a descriptor (package buffer) for
377 the purpose of data transfer.
379 class TRawEventBuf : public TPckgBuf<TRawEvent>
384 Gets the hardware event object from the package buffer.
386 @return The hardware event object.
388 inline TRawEvent &Event() const {return(*((TRawEvent *)&iBuf[0]));}
398 Encapsulates information about a device's display screen.
403 TBool iWindowHandleValid; /**< Indicates whether the window handle is valid.*/
404 TAny *iWindowHandle; /**< The window handle.*/
405 TBool iScreenAddressValid;/**< Indicates whether the screen address is valid.*/
406 TAny *iScreenAddress; /**< The linear address of the screen.*/
407 TSize iScreenSize; /**< The size of the screen.*/