1 // Copyright (c) 1994-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef ADVANCEDPOINTEREVENT_H
17 #define ADVANCEDPOINTEREVENT_H
19 /** Subclass of TPointerEvent created in order to maintain binary compatibility while
20 extending TPointerEvent with new data:
21 (1) pointer number of the pointer whose state change is described by the event,
22 (2) proximity of the pointer to the screen's surface,
23 (3) pressure applied by the pointer to the screen.
25 These new attributes will be present only on devices that support them, otherwise
26 they will be set to 0.
29 @see TPointerEvent::AdvancedPointerEvent()
30 @see TPointerEvent::IsAdvancedPointerEvent()
31 @see TWsEvent::Pointer()
34 class TAdvancedPointerEvent : public TPointerEvent
40 The value used by Symbian OS as the default pointer number for pointer-related
41 event objects which do not contain a pointer number member.
43 WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
45 EDefaultPointerNumber = 0,
47 Maximum number of pointers that WServ is able to support. On each particular platform,
48 the number of supported pointers must be less than or equal to this value.
50 WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
52 EMaximumWServNumberOfPointers = 8
55 // Public API's for WServ Clients
56 inline TAdvancedPointerEvent();
57 inline TInt PointerNumber() const;
58 inline TInt Proximity() const;
59 inline TInt Pressure() const;
60 inline TInt ProximityAndPressure() const;
61 inline TPoint3D Position3D() const;
62 inline TPoint3D Pressure3D() const;
63 inline TPoint3D PositionAndPressure3D() const;
65 IMPORT_C TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent);
66 IMPORT_C TAdvancedPointerEvent& operator=(const TAdvancedPointerEvent& aPointerEvent);
69 // The methods in this section are internalTechnology and intended for use by TWsEvent
70 // and TAdvancedPointerEventHelper (internal WSERV class).
71 friend class TWsEvent;
72 friend class TAdvancedPointerEventHelper;
77 Value used as return value from PointerNumber API when the object is a TPointerEvent
78 not a TAdvancedPointerEvent (as indicated by the iModifier flags).
80 ENonAdvancedPointerPointerNumber = EDefaultPointerNumber,
85 Value used to distinguish between pressure and proximity Z values by Pressure or
86 Proximity Specific APIs.
88 EPressureProximityCrossover = 0,
90 Value used as return Z value from APIs when the object is a TPointerEvent
91 not a TAdvancedPointerEvent (as indicated by the iModifier flags).
93 ENonAdvancedPointerZCoordinate = EPressureProximityCrossover,
96 // Private API's for external usage, via inlined accessors
97 IMPORT_C TInt DoGetPointerNumber() const;
98 IMPORT_C TInt DoGetProximity() const;
99 IMPORT_C TInt DoGetPressure() const;
100 IMPORT_C TInt DoGetProximityAndPressure() const;
102 // Private API's for internal WSERV usage. It is impossible to inline them into
103 // client's binaries, thus implementation may be changed in the future.
105 inline void Init(const TPointerEvent::TType aType, const TUint aModifiers, const TPoint3D &aPoint3D, const TUint8 aPointerNumber);
106 inline void SetPointerNumber(TUint8 aPointerNumber);
107 inline void SetPointerZ(TInt aZ);
108 inline void Copy(const TAdvancedPointerEvent& aPointerEvent);
110 /** WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
113 struct {TInt iSpare1; TInt iSpare2;} ints; // 8 bytes to fill TWsEvent
114 struct {TInt32 iPosZ; TUint8 iPointerNumber;} multiPos3D;
118 /** Default Constructor for TAdvancedPointerEvent
123 inline TAdvancedPointerEvent::TAdvancedPointerEvent() {}
125 inline const TAdvancedPointerEvent* TPointerEvent::AdvancedPointerEvent() const
126 /** Casts this TPointerEvent to TAdvancedPointerEvent in order to provide access
127 to event's pointer number, pressure and proximity (these attributes are accessible
128 through appropriate getters of TAdvancedPointerEvent class).
130 If this is not an instance of TAdvancedPointerEvent, NULL will be returned.
131 Please note that TAdvancedPointerEvents are delivered only to windows for
132 which they have been enabled using RWindowBase::EnableAdvancedPointers() method.
134 @return A pointer to this object as TAdvancedPointerEvent or NULL if this is not
135 an instance of TAdvancedPointerEvent.
136 @see TPointerEvent::IsAdvancedPointerEvent()
137 @see RWindowBase::EnableAdvancedPointers()
141 return (iModifiers&EModifierAdvancedPointerEvent ? static_cast<const TAdvancedPointerEvent*>(this) : NULL);
143 #endif /* ADVANCEDPOINTEREVENT_H */