williamr@4: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // williamr@4: williamr@4: #ifndef ADVANCEDPOINTEREVENT_H williamr@4: #define ADVANCEDPOINTEREVENT_H williamr@4: williamr@4: /** Subclass of TPointerEvent created in order to maintain binary compatibility while williamr@4: extending TPointerEvent with new data: williamr@4: (1) pointer number of the pointer whose state change is described by the event, williamr@4: (2) proximity of the pointer to the screen's surface, williamr@4: (3) pressure applied by the pointer to the screen. williamr@4: williamr@4: These new attributes will be present only on devices that support them, otherwise williamr@4: they will be set to 0. williamr@4: williamr@4: @see TPointerEvent williamr@4: @see TPointerEvent::AdvancedPointerEvent() williamr@4: @see TPointerEvent::IsAdvancedPointerEvent() williamr@4: @see TWsEvent::Pointer() williamr@4: @publishedAll williamr@4: @released */ williamr@4: class TAdvancedPointerEvent : public TPointerEvent williamr@4: { williamr@4: public: williamr@4: enum williamr@4: { williamr@4: /** williamr@4: The value used by Symbian OS as the default pointer number for pointer-related williamr@4: event objects which do not contain a pointer number member. williamr@4: williamr@4: WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases. williamr@4: */ williamr@4: EDefaultPointerNumber = 0, williamr@4: /** williamr@4: Maximum number of pointers that WServ is able to support. On each particular platform, williamr@4: the number of supported pointers must be less than or equal to this value. williamr@4: williamr@4: WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases. williamr@4: */ williamr@4: EMaximumWServNumberOfPointers = 8 williamr@4: }; williamr@4: williamr@4: // Public API's for WServ Clients williamr@4: inline TAdvancedPointerEvent(); williamr@4: inline TInt PointerNumber() const; williamr@4: inline TInt Proximity() const; williamr@4: inline TInt Pressure() const; williamr@4: inline TInt ProximityAndPressure() const; williamr@4: inline TPoint3D Position3D() const; williamr@4: inline TPoint3D Pressure3D() const; williamr@4: inline TPoint3D PositionAndPressure3D() const; williamr@4: williamr@4: IMPORT_C TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent); williamr@4: IMPORT_C TAdvancedPointerEvent& operator=(const TAdvancedPointerEvent& aPointerEvent); williamr@4: williamr@4: private: williamr@4: // The methods in this section are internalTechnology and intended for use by TWsEvent williamr@4: // and TAdvancedPointerEventHelper (internal WSERV class). williamr@4: friend class TWsEvent; williamr@4: friend class TAdvancedPointerEventHelper; williamr@4: williamr@4: enum williamr@4: { williamr@4: /** williamr@4: Value used as return value from PointerNumber API when the object is a TPointerEvent williamr@4: not a TAdvancedPointerEvent (as indicated by the iModifier flags). williamr@4: */ williamr@4: ENonAdvancedPointerPointerNumber = EDefaultPointerNumber, williamr@4: }; williamr@4: enum williamr@4: { williamr@4: /** williamr@4: Value used to distinguish between pressure and proximity Z values by Pressure or williamr@4: Proximity Specific APIs. williamr@4: */ williamr@4: EPressureProximityCrossover = 0, williamr@4: /** williamr@4: Value used as return Z value from APIs when the object is a TPointerEvent williamr@4: not a TAdvancedPointerEvent (as indicated by the iModifier flags). williamr@4: */ williamr@4: ENonAdvancedPointerZCoordinate = EPressureProximityCrossover, williamr@4: }; williamr@4: williamr@4: // Private API's for external usage, via inlined accessors williamr@4: IMPORT_C TInt DoGetPointerNumber() const; williamr@4: IMPORT_C TInt DoGetProximity() const; williamr@4: IMPORT_C TInt DoGetPressure() const; williamr@4: IMPORT_C TInt DoGetProximityAndPressure() const; williamr@4: williamr@4: // Private API's for internal WSERV usage. It is impossible to inline them into williamr@4: // client's binaries, thus implementation may be changed in the future. williamr@4: inline void Init(); williamr@4: inline void Init(const TPointerEvent::TType aType, const TUint aModifiers, const TPoint3D &aPoint3D, const TUint8 aPointerNumber); williamr@4: inline void SetPointerNumber(TUint8 aPointerNumber); williamr@4: inline void SetPointerZ(TInt aZ); williamr@4: inline void Copy(const TAdvancedPointerEvent& aPointerEvent); williamr@4: williamr@4: /** 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: union williamr@4: { williamr@4: struct {TInt iSpare1; TInt iSpare2;} ints; // 8 bytes to fill TWsEvent williamr@4: struct {TInt32 iPosZ; TUint8 iPointerNumber;} multiPos3D; williamr@4: } iData; williamr@4: }; williamr@4: williamr@4: /** Default Constructor for TAdvancedPointerEvent williamr@4: williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: inline TAdvancedPointerEvent::TAdvancedPointerEvent() {} williamr@4: williamr@4: inline const TAdvancedPointerEvent* TPointerEvent::AdvancedPointerEvent() const williamr@4: /** Casts this TPointerEvent to TAdvancedPointerEvent in order to provide access williamr@4: to event's pointer number, pressure and proximity (these attributes are accessible williamr@4: through appropriate getters of TAdvancedPointerEvent class). williamr@4: williamr@4: If this is not an instance of TAdvancedPointerEvent, NULL will be returned. williamr@4: Please note that TAdvancedPointerEvents are delivered only to windows for williamr@4: which they have been enabled using RWindowBase::EnableAdvancedPointers() method. williamr@4: williamr@4: @return A pointer to this object as TAdvancedPointerEvent or NULL if this is not williamr@4: an instance of TAdvancedPointerEvent. williamr@4: @see TPointerEvent::IsAdvancedPointerEvent() williamr@4: @see RWindowBase::EnableAdvancedPointers() williamr@4: @publishedAll williamr@4: @released */ williamr@4: { williamr@4: return (iModifiers&EModifierAdvancedPointerEvent ? static_cast(this) : NULL); williamr@4: } williamr@4: #endif /* ADVANCEDPOINTEREVENT_H */