williamr@2: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // e32\include\e32event.h williamr@2: // williamr@2: // williamr@2: williamr@2: #ifndef __E32EVENT_H__ williamr@2: #define __E32EVENT_H__ williamr@2: #include williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KUndefinedDeviceNumber = -1; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Represents a raw hardware event as generated by hardware drivers of williamr@2: a pointer device, a keyboard etc. williamr@2: williamr@2: Raw hardware events are added to the kernel's event queue. williamr@2: */ williamr@2: class TRawEvent williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: Defines the event type. williamr@2: */ williamr@2: enum TType williamr@2: { williamr@2: williamr@2: /** williamr@2: Represents an uninitialised event object. williamr@2: */ williamr@2: ENone, williamr@2: williamr@2: /** williamr@2: A pointer device (e.g. a pen) has moved. Only changes in Cartesian coordinates are tracked. williamr@2: */ williamr@2: EPointerMove, williamr@2: williamr@2: /** williamr@2: A switch on event caused by a screen tap using a pointer device. williamr@2: */ williamr@2: EPointerSwitchOn, williamr@2: williamr@2: /** williamr@2: Represents a keyboard key down event. williamr@2: */ williamr@2: EKeyDown, williamr@2: williamr@2: /** williamr@2: Represents a keyboard key up event. williamr@2: */ williamr@2: EKeyUp, williamr@2: williamr@2: /** williamr@2: Represents a redraw event. williamr@2: williamr@2: Typically generated in an emulator environment in response williamr@2: to a host OS redraw event. williamr@2: */ williamr@2: ERedraw, williamr@2: williamr@2: /** williamr@2: Represents a device switch on event. williamr@2: */ williamr@2: ESwitchOn, williamr@2: williamr@2: /** williamr@2: */ williamr@2: EActive, williamr@2: williamr@2: /** williamr@2: */ williamr@2: EInactive, williamr@2: williamr@2: /** williamr@2: Represents a modifier key being pressed. williamr@2: */ williamr@2: EUpdateModifiers, williamr@2: williamr@2: /** williamr@2: Represents a button down event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: coming into contact with a touch sensitive screen. williamr@2: */ williamr@2: EButton1Down, williamr@2: williamr@2: /** williamr@2: Represents a button up event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: being lifted away from a touch sensitive screen. williamr@2: */ williamr@2: EButton1Up, williamr@2: williamr@2: /** williamr@2: Represents a button down event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: coming into contact with a touch sensitive screen. williamr@2: */ williamr@2: EButton2Down, williamr@2: williamr@2: /** williamr@2: Represents a button up event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: being lifted away from a touch sensitive screen. williamr@2: */ williamr@2: EButton2Up, williamr@2: williamr@2: /** williamr@2: Represents a button down event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: coming into contact with a touch sensitive screen. williamr@2: */ williamr@2: EButton3Down, williamr@2: williamr@2: /** williamr@2: Represents a button up event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: being lifted away from a touch sensitive screen. williamr@2: */ williamr@2: EButton3Up, williamr@2: williamr@2: /** williamr@2: Represents a device switch off event. williamr@2: */ williamr@2: ESwitchOff, williamr@2: williamr@2: /** williamr@2: Represents a key being continually pressed event. williamr@2: */ williamr@2: EKeyRepeat, williamr@2: williamr@2: /** williamr@2: Represents a case open event. williamr@2: williamr@2: The meaning of a case is hardware specific. williamr@2: */ williamr@2: ECaseOpen, williamr@2: williamr@2: /** williamr@2: Represents a case close event. williamr@2: williamr@2: The meaning of a case is hardware specific. williamr@2: */ williamr@2: ECaseClose, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Represents a 3D pointer entering the detection volume event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: coming into detection range of a sensitive screen. williamr@2: */ williamr@2: EPointer3DInRange, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Represents a 3D pointer leaving the detection volume event. williamr@2: williamr@2: This is typically used to represent a pointing device williamr@2: leaving the detection range of a sensitive screen. williamr@2: */ williamr@2: EPointer3DOutOfRange, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Represents a 3D pointer tilt changes only event. williamr@2: williamr@2: This is typically sent by a 3D pointer driver when it detects williamr@2: a change in the pointer's polar coordinates (Theta or Phi). williamr@2: */ williamr@2: EPointer3DTilt, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Represents a 3D pointer rotation only event. williamr@2: williamr@2: This is typically sent by a 3D pointer driver when it detects williamr@2: a rotation of the pointing device (along ist main axis). williamr@2: */ williamr@2: EPointer3DRotation, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Represents a general 3D pointer changes event. williamr@2: williamr@2: This is typically sent by a 3D pointer driver when it detects williamr@2: a change in the pointer's linear and/or polar coordinates and/or rotation. williamr@2: */ williamr@2: EPointer3DTiltAndMove, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button down event. williamr@2: */ williamr@2: EButton4Down, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button up event. williamr@2: */ williamr@2: EButton4Up, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button down event. williamr@2: */ williamr@2: EButton5Down, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button up event. williamr@2: */ williamr@2: EButton5Up, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button down event. williamr@2: */ williamr@2: EButton6Down, williamr@2: williamr@2: /** williamr@2: @prototype williamr@2: Reserved for a 3D pointing device button up event. williamr@2: */ williamr@2: EButton6Up, williamr@2: williamr@2: /** williamr@2: Represents a device restart event. williamr@2: */ williamr@2: ERestartSystem williamr@2: }; williamr@2: public: williamr@2: williamr@2: /** williamr@2: Default constructor williamr@2: */ williamr@2: inline TRawEvent() williamr@2: { *(TInt*)&iType=0; } williamr@2: williamr@2: /** williamr@2: Gets the event type williamr@2: williamr@2: @return The event type. williamr@2: */ williamr@2: inline TType Type() const williamr@2: {return TType(iType);} williamr@2: williamr@2: /** williamr@2: Gets the device number (eg. screen number) williamr@2: williamr@2: @return The device number. williamr@2: */ williamr@2: inline TInt DeviceNumber() const williamr@2: {return TInt(iDeviceNumber-1);} williamr@2: williamr@2: /** williamr@2: Sets the device number (eg. screen number) williamr@2: williamr@2: @param aDeviceNumber The device number williamr@2: */ williamr@2: inline void SetDeviceNumber(TInt aDeviceNumber) williamr@2: {iDeviceNumber = TUint8(aDeviceNumber+1);} williamr@2: williamr@2: IMPORT_C TPoint Pos() const; williamr@2: IMPORT_C TInt ScanCode() const; williamr@2: IMPORT_C TInt Modifiers() const; williamr@2: williamr@2: /** williamr@2: Gets the Cartesian coordinates of the 3D pointer end that is closer to the screen. williamr@2: williamr@2: @return The Cartesian coordinates of the point defined by the end of the 3D pointing device that is closer to the screen. williamr@2: */ williamr@2: IMPORT_C TPoint3D Pos3D() const; williamr@2: williamr@2: williamr@2: /** williamr@2: Gets the angular spherical polar coordinates of the 3D pointer end that is closer to the screen. williamr@2: williamr@2: @return The angular spherical polar coordinates of the point defined by the end of the 3D pointing device that is closer to the screen. williamr@2: @see TAngle3D williamr@2: */ williamr@2: IMPORT_C TAngle3D Tilt() const; williamr@2: williamr@2: /** williamr@2: Gets the rotation angle of 3D pointing device. williamr@2: williamr@2: Some 3D pointing devices support information regarding the angle formed between the physical and magnetical poles, williamr@2: as obtaining when rotating the pen along its main axis. williamr@2: williamr@2: @return The rotation angle of the 3D pointing device. williamr@2: */ williamr@2: IMPORT_C TInt Rotation() const; williamr@2: williamr@2: /** williamr@2: Gets the tick count value associated with the event. williamr@2: williamr@2: Note that the interval between tick counts is williamr@2: hardware dependent. williamr@2: williamr@2: @return The tick count value williamr@2: */ williamr@2: inline TUint Ticks() const williamr@2: {return iTicks;} williamr@2: /** williamr@2: Gets the information on which end of the pointing device is closer to the screen williamr@2: williamr@2: @return A Boolean indicating which end of the pointing device is closer to the screen. williamr@2: */ williamr@2: inline TBool IsTip() const williamr@2: {return TBool(iTip);} williamr@2: williamr@2: /** williamr@2: Sets the information on which end of the pointing device is closer to the screen williamr@2: williamr@2: @param aTip A Boolean indicating which end of the pointing device is closer to the screen. williamr@2: */ williamr@2: inline void SetTip(TBool aTip) williamr@2: {iTip = TUint8(aTip);} williamr@2: williamr@2: IMPORT_C void Set(TType aType,TInt aScanCode); williamr@2: IMPORT_C void Set(TType aType,TInt aX,TInt aY); williamr@2: IMPORT_C void Set(TType aType); williamr@2: williamr@2: IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ); williamr@2: IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha); williamr@2: williamr@2: IMPORT_C void SetTilt(TType aType,TInt aPhi,TInt aTheta); williamr@2: IMPORT_C void SetRotation(TType aType,TInt aAlpha); williamr@2: williamr@2: protected: williamr@2: TUint8 iType; williamr@2: TUint8 iTip; /**< Indicates whether the tip or head of pointing device is closer to screen.*/ williamr@2: TUint8 iSpare2; williamr@2: TUint8 iDeviceNumber; williamr@2: TUint iTicks; williamr@2: union williamr@2: { williamr@2: struct {TInt x;TInt y;} pos; williamr@2: struct {TInt x;TInt y;TInt z;TInt phi;TInt theta;TInt alpha;} pos3D; williamr@2: TInt scanCode; williamr@2: TInt modifiers; williamr@2: } iU; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Encapsulates a hardware event object as a descriptor (package buffer) for williamr@2: the purpose of data transfer. williamr@2: */ williamr@2: class TRawEventBuf : public TPckgBuf williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: Gets the hardware event object from the package buffer. williamr@2: williamr@2: @return The hardware event object. williamr@2: */ williamr@2: inline TRawEvent &Event() const {return(*((TRawEvent *)&iBuf[0]));} williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedPartner williamr@2: @released williamr@2: williamr@2: Encapsulates information about a device's display screen. williamr@2: */ williamr@2: class TScreenInfoV01 williamr@2: { williamr@2: public: williamr@2: TBool iWindowHandleValid; /**< Indicates whether the window handle is valid.*/ williamr@2: TAny *iWindowHandle; /**< The window handle.*/ williamr@2: TBool iScreenAddressValid;/**< Indicates whether the screen address is valid.*/ williamr@2: TAny *iScreenAddress; /**< The linear address of the screen.*/ williamr@2: TSize iScreenSize; /**< The size of the screen.*/ williamr@2: }; williamr@2: // williamr@2: #endif