1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/advancedpointerevent.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,143 @@
1.4 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef ADVANCEDPOINTEREVENT_H
1.20 +#define ADVANCEDPOINTEREVENT_H
1.21 +
1.22 +/** Subclass of TPointerEvent created in order to maintain binary compatibility while
1.23 +extending TPointerEvent with new data:
1.24 +(1) pointer number of the pointer whose state change is described by the event,
1.25 +(2) proximity of the pointer to the screen's surface,
1.26 +(3) pressure applied by the pointer to the screen.
1.27 +
1.28 +These new attributes will be present only on devices that support them, otherwise
1.29 +they will be set to 0.
1.30 +
1.31 +@see TPointerEvent
1.32 +@see TPointerEvent::AdvancedPointerEvent()
1.33 +@see TPointerEvent::IsAdvancedPointerEvent()
1.34 +@see TWsEvent::Pointer()
1.35 +@publishedAll
1.36 +@released */
1.37 +class TAdvancedPointerEvent : public TPointerEvent
1.38 + {
1.39 +public:
1.40 + enum
1.41 + {
1.42 + /**
1.43 + The value used by Symbian OS as the default pointer number for pointer-related
1.44 + event objects which do not contain a pointer number member.
1.45 +
1.46 + WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
1.47 + */
1.48 + EDefaultPointerNumber = 0,
1.49 + /**
1.50 + Maximum number of pointers that WServ is able to support. On each particular platform,
1.51 + the number of supported pointers must be less than or equal to this value.
1.52 +
1.53 + WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.
1.54 + */
1.55 + EMaximumWServNumberOfPointers = 8
1.56 + };
1.57 +
1.58 + // Public API's for WServ Clients
1.59 + inline TAdvancedPointerEvent();
1.60 + inline TInt PointerNumber() const;
1.61 + inline TInt Proximity() const;
1.62 + inline TInt Pressure() const;
1.63 + inline TInt ProximityAndPressure() const;
1.64 + inline TPoint3D Position3D() const;
1.65 + inline TPoint3D Pressure3D() const;
1.66 + inline TPoint3D PositionAndPressure3D() const;
1.67 +
1.68 + IMPORT_C TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent);
1.69 + IMPORT_C TAdvancedPointerEvent& operator=(const TAdvancedPointerEvent& aPointerEvent);
1.70 +
1.71 +private:
1.72 + // The methods in this section are internalTechnology and intended for use by TWsEvent
1.73 + // and TAdvancedPointerEventHelper (internal WSERV class).
1.74 + friend class TWsEvent;
1.75 + friend class TAdvancedPointerEventHelper;
1.76 +
1.77 + enum
1.78 + {
1.79 + /**
1.80 + Value used as return value from PointerNumber API when the object is a TPointerEvent
1.81 + not a TAdvancedPointerEvent (as indicated by the iModifier flags).
1.82 + */
1.83 + ENonAdvancedPointerPointerNumber = EDefaultPointerNumber,
1.84 + };
1.85 + enum
1.86 + {
1.87 + /**
1.88 + Value used to distinguish between pressure and proximity Z values by Pressure or
1.89 + Proximity Specific APIs.
1.90 + */
1.91 + EPressureProximityCrossover = 0,
1.92 + /**
1.93 + Value used as return Z value from APIs when the object is a TPointerEvent
1.94 + not a TAdvancedPointerEvent (as indicated by the iModifier flags).
1.95 + */
1.96 + ENonAdvancedPointerZCoordinate = EPressureProximityCrossover,
1.97 + };
1.98 +
1.99 + // Private API's for external usage, via inlined accessors
1.100 + IMPORT_C TInt DoGetPointerNumber() const;
1.101 + IMPORT_C TInt DoGetProximity() const;
1.102 + IMPORT_C TInt DoGetPressure() const;
1.103 + IMPORT_C TInt DoGetProximityAndPressure() const;
1.104 +
1.105 + // Private API's for internal WSERV usage. It is impossible to inline them into
1.106 + // client's binaries, thus implementation may be changed in the future.
1.107 + inline void Init();
1.108 + inline void Init(const TPointerEvent::TType aType, const TUint aModifiers, const TPoint3D &aPoint3D, const TUint8 aPointerNumber);
1.109 + inline void SetPointerNumber(TUint8 aPointerNumber);
1.110 + inline void SetPointerZ(TInt aZ);
1.111 + inline void Copy(const TAdvancedPointerEvent& aPointerEvent);
1.112 +
1.113 + /** WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
1.114 + union
1.115 + {
1.116 + struct {TInt iSpare1; TInt iSpare2;} ints; // 8 bytes to fill TWsEvent
1.117 + struct {TInt32 iPosZ; TUint8 iPointerNumber;} multiPos3D;
1.118 + } iData;
1.119 + };
1.120 +
1.121 +/** Default Constructor for TAdvancedPointerEvent
1.122 +
1.123 +@publishedAll
1.124 +@released
1.125 +*/
1.126 +inline TAdvancedPointerEvent::TAdvancedPointerEvent() {}
1.127 +
1.128 +inline const TAdvancedPointerEvent* TPointerEvent::AdvancedPointerEvent() const
1.129 +/** Casts this TPointerEvent to TAdvancedPointerEvent in order to provide access
1.130 + to event's pointer number, pressure and proximity (these attributes are accessible
1.131 + through appropriate getters of TAdvancedPointerEvent class).
1.132 +
1.133 + If this is not an instance of TAdvancedPointerEvent, NULL will be returned.
1.134 + Please note that TAdvancedPointerEvents are delivered only to windows for
1.135 + which they have been enabled using RWindowBase::EnableAdvancedPointers() method.
1.136 +
1.137 + @return A pointer to this object as TAdvancedPointerEvent or NULL if this is not
1.138 + an instance of TAdvancedPointerEvent.
1.139 + @see TPointerEvent::IsAdvancedPointerEvent()
1.140 + @see RWindowBase::EnableAdvancedPointers()
1.141 + @publishedAll
1.142 + @released */
1.143 + {
1.144 + return (iModifiers&EModifierAdvancedPointerEvent ? static_cast<const TAdvancedPointerEvent*>(this) : NULL);
1.145 + }
1.146 +#endif /* ADVANCEDPOINTEREVENT_H */