windowing/windowserver/inc/advancedpointerevent.h
changeset 0 5d03bc08d59c
child 41 de3d5b6102ac
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef ADVANCEDPOINTEREVENT_H
       
    17 #define ADVANCEDPOINTEREVENT_H
       
    18 
       
    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.
       
    24 
       
    25 These new attributes will be present only on devices that support them, otherwise
       
    26 they will be set to 0.
       
    27 
       
    28 @see TPointerEvent
       
    29 @see TPointerEvent::AdvancedPointerEvent()
       
    30 @see TPointerEvent::IsAdvancedPointerEvent()
       
    31 @see TWsEvent::Pointer()
       
    32 @publishedAll
       
    33 @released */
       
    34 class TAdvancedPointerEvent : public TPointerEvent
       
    35 	{
       
    36 public:
       
    37 	enum
       
    38 		{
       
    39 		/**
       
    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.
       
    42 		
       
    43 		WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.		
       
    44 		*/
       
    45 		EDefaultPointerNumber = 0,
       
    46 		/**
       
    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.
       
    49 		
       
    50 		WARNING: Enum for internal use ONLY. Compatibility is not guaranteed in future releases.		
       
    51 		*/
       
    52 		EMaximumWServNumberOfPointers = 8
       
    53 		};
       
    54 	
       
    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;
       
    64 
       
    65 	IMPORT_C TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent);
       
    66 	IMPORT_C TAdvancedPointerEvent& operator=(const TAdvancedPointerEvent& aPointerEvent);	
       
    67 	
       
    68 private:
       
    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;
       
    73 	
       
    74 	enum
       
    75 		{
       
    76 		/**
       
    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). 
       
    79 		 */
       
    80 		ENonAdvancedPointerPointerNumber = EDefaultPointerNumber,
       
    81 		};
       
    82 	enum
       
    83 		{
       
    84 		/**
       
    85 		Value used to distinguish between pressure and proximity Z values by Pressure or
       
    86 		Proximity Specific APIs. 
       
    87 		 */			
       
    88 		EPressureProximityCrossover = 0,
       
    89 		/**
       
    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). 
       
    92 		 */		
       
    93 		ENonAdvancedPointerZCoordinate = EPressureProximityCrossover,
       
    94 		};
       
    95 	
       
    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;
       
   101 	
       
   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.
       
   104 	inline void Init();
       
   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);		
       
   109 		
       
   110 	/** WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
       
   111 	union
       
   112 		{
       
   113 		struct {TInt iSpare1; TInt iSpare2;} ints; // 8 bytes to fill TWsEvent
       
   114 		struct {TInt32 iPosZ; TUint8 iPointerNumber;} multiPos3D;
       
   115 		} iData;
       
   116 	};
       
   117 
       
   118 /** Default Constructor for TAdvancedPointerEvent
       
   119 
       
   120 @publishedAll
       
   121 @released
       
   122 */
       
   123 inline TAdvancedPointerEvent::TAdvancedPointerEvent() {}
       
   124 
       
   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).
       
   129 	
       
   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.
       
   133 
       
   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()
       
   138 	@publishedAll
       
   139 	@released */
       
   140 	{
       
   141 	return (iModifiers&EModifierAdvancedPointerEvent ? static_cast<const TAdvancedPointerEvent*>(this) : NULL);	
       
   142 	}
       
   143 #endif /* ADVANCEDPOINTEREVENT_H */