williamr@4
|
1 |
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
2 |
// All rights reserved.
|
williamr@4
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
7 |
//
|
williamr@4
|
8 |
// Initial Contributors:
|
williamr@4
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@4
|
10 |
//
|
williamr@4
|
11 |
// Contributors:
|
williamr@4
|
12 |
//
|
williamr@4
|
13 |
// Description:
|
williamr@4
|
14 |
//
|
williamr@4
|
15 |
|
williamr@4
|
16 |
#ifndef ADVANCEDPOINTEREVENT_H
|
williamr@4
|
17 |
#define ADVANCEDPOINTEREVENT_H
|
williamr@4
|
18 |
|
williamr@4
|
19 |
/** Subclass of TPointerEvent created in order to maintain binary compatibility while
|
williamr@4
|
20 |
extending TPointerEvent with new data:
|
williamr@4
|
21 |
(1) pointer number of the pointer whose state change is described by the event,
|
williamr@4
|
22 |
(2) proximity of the pointer to the screen's surface,
|
williamr@4
|
23 |
(3) pressure applied by the pointer to the screen.
|
williamr@4
|
24 |
|
williamr@4
|
25 |
These new attributes will be present only on devices that support them, otherwise
|
williamr@4
|
26 |
they will be set to 0.
|
williamr@4
|
27 |
|
williamr@4
|
28 |
@see TPointerEvent
|
williamr@4
|
29 |
@see TPointerEvent::AdvancedPointerEvent()
|
williamr@4
|
30 |
@see TPointerEvent::IsAdvancedPointerEvent()
|
williamr@4
|
31 |
@see TWsEvent::Pointer()
|
williamr@4
|
32 |
@publishedAll
|
williamr@4
|
33 |
@released */
|
williamr@4
|
34 |
class TAdvancedPointerEvent : public TPointerEvent
|
williamr@4
|
35 |
{
|
williamr@4
|
36 |
public:
|
williamr@4
|
37 |
enum
|
williamr@4
|
38 |
{
|
williamr@4
|
39 |
/**
|
williamr@4
|
40 |
The value used by Symbian OS as the default pointer number for pointer-related
|
williamr@4
|
41 |
event objects which do not contain a pointer number member.
|
williamr@4
|
42 |
|
williamr@4
|
43 |
WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
|
williamr@4
|
44 |
*/
|
williamr@4
|
45 |
EDefaultPointerNumber = 0,
|
williamr@4
|
46 |
/**
|
williamr@4
|
47 |
Maximum number of pointers that WServ is able to support. On each particular platform,
|
williamr@4
|
48 |
the number of supported pointers must be less than or equal to this value.
|
williamr@4
|
49 |
|
williamr@4
|
50 |
WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
|
williamr@4
|
51 |
*/
|
williamr@4
|
52 |
EMaximumWServNumberOfPointers = 8
|
williamr@4
|
53 |
};
|
williamr@4
|
54 |
|
williamr@4
|
55 |
// Public API's for WServ Clients
|
williamr@4
|
56 |
inline TAdvancedPointerEvent();
|
williamr@4
|
57 |
inline TInt PointerNumber() const;
|
williamr@4
|
58 |
inline TInt Proximity() const;
|
williamr@4
|
59 |
inline TInt Pressure() const;
|
williamr@4
|
60 |
inline TInt ProximityAndPressure() const;
|
williamr@4
|
61 |
inline TPoint3D Position3D() const;
|
williamr@4
|
62 |
inline TPoint3D Pressure3D() const;
|
williamr@4
|
63 |
inline TPoint3D PositionAndPressure3D() const;
|
williamr@4
|
64 |
|
williamr@4
|
65 |
IMPORT_C TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent);
|
williamr@4
|
66 |
IMPORT_C TAdvancedPointerEvent& operator=(const TAdvancedPointerEvent& aPointerEvent);
|
williamr@4
|
67 |
|
williamr@4
|
68 |
private:
|
williamr@4
|
69 |
// The methods in this section are internalTechnology and intended for use by TWsEvent
|
williamr@4
|
70 |
// and TAdvancedPointerEventHelper (internal WSERV class).
|
williamr@4
|
71 |
friend class TWsEvent;
|
williamr@4
|
72 |
friend class TAdvancedPointerEventHelper;
|
williamr@4
|
73 |
|
williamr@4
|
74 |
enum
|
williamr@4
|
75 |
{
|
williamr@4
|
76 |
/**
|
williamr@4
|
77 |
Value used as return value from PointerNumber API when the object is a TPointerEvent
|
williamr@4
|
78 |
not a TAdvancedPointerEvent (as indicated by the iModifier flags).
|
williamr@4
|
79 |
*/
|
williamr@4
|
80 |
ENonAdvancedPointerPointerNumber = EDefaultPointerNumber,
|
williamr@4
|
81 |
};
|
williamr@4
|
82 |
enum
|
williamr@4
|
83 |
{
|
williamr@4
|
84 |
/**
|
williamr@4
|
85 |
Value used to distinguish between pressure and proximity Z values by Pressure or
|
williamr@4
|
86 |
Proximity Specific APIs.
|
williamr@4
|
87 |
*/
|
williamr@4
|
88 |
EPressureProximityCrossover = 0,
|
williamr@4
|
89 |
/**
|
williamr@4
|
90 |
Value used as return Z value from APIs when the object is a TPointerEvent
|
williamr@4
|
91 |
not a TAdvancedPointerEvent (as indicated by the iModifier flags).
|
williamr@4
|
92 |
*/
|
williamr@4
|
93 |
ENonAdvancedPointerZCoordinate = EPressureProximityCrossover,
|
williamr@4
|
94 |
};
|
williamr@4
|
95 |
|
williamr@4
|
96 |
// Private API's for external usage, via inlined accessors
|
williamr@4
|
97 |
IMPORT_C TInt DoGetPointerNumber() const;
|
williamr@4
|
98 |
IMPORT_C TInt DoGetProximity() const;
|
williamr@4
|
99 |
IMPORT_C TInt DoGetPressure() const;
|
williamr@4
|
100 |
IMPORT_C TInt DoGetProximityAndPressure() const;
|
williamr@4
|
101 |
|
williamr@4
|
102 |
// Private API's for internal WSERV usage. It is impossible to inline them into
|
williamr@4
|
103 |
// client's binaries, thus implementation may be changed in the future.
|
williamr@4
|
104 |
inline void Init();
|
williamr@4
|
105 |
inline void Init(const TPointerEvent::TType aType, const TUint aModifiers, const TPoint3D &aPoint3D, const TUint8 aPointerNumber);
|
williamr@4
|
106 |
inline void SetPointerNumber(TUint8 aPointerNumber);
|
williamr@4
|
107 |
inline void SetPointerZ(TInt aZ);
|
williamr@4
|
108 |
inline void Copy(const TAdvancedPointerEvent& aPointerEvent);
|
williamr@4
|
109 |
|
williamr@4
|
110 |
/** WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
|
williamr@4
|
111 |
union
|
williamr@4
|
112 |
{
|
williamr@4
|
113 |
struct {TInt iSpare1; TInt iSpare2;} ints; // 8 bytes to fill TWsEvent
|
williamr@4
|
114 |
struct {TInt32 iPosZ; TUint8 iPointerNumber;} multiPos3D;
|
williamr@4
|
115 |
} iData;
|
williamr@4
|
116 |
};
|
williamr@4
|
117 |
|
williamr@4
|
118 |
/** Default Constructor for TAdvancedPointerEvent
|
williamr@4
|
119 |
|
williamr@4
|
120 |
@publishedAll
|
williamr@4
|
121 |
@released
|
williamr@4
|
122 |
*/
|
williamr@4
|
123 |
inline TAdvancedPointerEvent::TAdvancedPointerEvent() {}
|
williamr@4
|
124 |
|
williamr@4
|
125 |
inline const TAdvancedPointerEvent* TPointerEvent::AdvancedPointerEvent() const
|
williamr@4
|
126 |
/** Casts this TPointerEvent to TAdvancedPointerEvent in order to provide access
|
williamr@4
|
127 |
to event's pointer number, pressure and proximity (these attributes are accessible
|
williamr@4
|
128 |
through appropriate getters of TAdvancedPointerEvent class).
|
williamr@4
|
129 |
|
williamr@4
|
130 |
If this is not an instance of TAdvancedPointerEvent, NULL will be returned.
|
williamr@4
|
131 |
Please note that TAdvancedPointerEvents are delivered only to windows for
|
williamr@4
|
132 |
which they have been enabled using RWindowBase::EnableAdvancedPointers() method.
|
williamr@4
|
133 |
|
williamr@4
|
134 |
@return A pointer to this object as TAdvancedPointerEvent or NULL if this is not
|
williamr@4
|
135 |
an instance of TAdvancedPointerEvent.
|
williamr@4
|
136 |
@see TPointerEvent::IsAdvancedPointerEvent()
|
williamr@4
|
137 |
@see RWindowBase::EnableAdvancedPointers()
|
williamr@4
|
138 |
@publishedAll
|
williamr@4
|
139 |
@released */
|
williamr@4
|
140 |
{
|
williamr@4
|
141 |
return (iModifiers&EModifierAdvancedPointerEvent ? static_cast<const TAdvancedPointerEvent*>(this) : NULL);
|
williamr@4
|
142 |
}
|
williamr@4
|
143 |
#endif /* ADVANCEDPOINTEREVENT_H */
|