epoc32/include/pointerevent.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/pointerevent.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,216 @@
     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 POINTEREVENT_H
    1.20 +#define POINTEREVENT_H
    1.21 +
    1.22 +class TAdvancedPointerEvent;
    1.23 +
    1.24 +/** Pointer event details.
    1.25 +
    1.26 +The function TWsEvent::Pointer() is used to get this structure for a pointer
    1.27 +event.
    1.28 +
    1.29 +@publishedAll
    1.30 +@released */
    1.31 +struct TPointerEvent
    1.32 +	{
    1.33 +	/** Pointer event types.
    1.34 +	
    1.35 +	Note that the user actions that cause these events will vary according to
    1.36 +	the type of pointing device used. */
    1.37 +	enum TType
    1.38 +		{
    1.39 +		/** Button 1 or pen down. */
    1.40 +		EButton1Down,
    1.41 +		/** Button 1 or pen up. */
    1.42 +		EButton1Up,
    1.43 +		/** Button 2 down.
    1.44 +
    1.45 +		This is the middle button of a 3 button mouse. */
    1.46 +		EButton2Down,
    1.47 +		/** Button 2 up.
    1.48 +
    1.49 +		This is the middle button of a 3 button mouse. */
    1.50 +		EButton2Up,
    1.51 +		/** Button 3 down. */
    1.52 +		EButton3Down,
    1.53 +		/** Button 3 up. */
    1.54 +		EButton3Up,
    1.55 +		/** Drag event.
    1.56 +
    1.57 +		These events are only received when button 1 is down. */
    1.58 +		EDrag,
    1.59 +		/** Move event.
    1.60 +
    1.61 +		These events are only received when button 1 is up and the XY input mode is
    1.62 +		not pen. */
    1.63 +		EMove,
    1.64 +		/** Button repeat event. */
    1.65 +		EButtonRepeat,
    1.66 +		/** Switch on event caused by a screen tap. */
    1.67 +		ESwitchOn,
    1.68 +		/** Out Of Range event caused by 3D pointer leaving the detection volume.
    1.69 +		It implies that the pointer cannot be tracked any more by device's sensors
    1.70 +		and that from now the pointer number of this pointer may be used for identifying
    1.71 +		another physical pointer (for example another finger).
    1.72 +		As EOutOfRange event is generated when pointer's position is unknown,
    1.73 +		it contains last known coordinates of the pointer and is delivered to the
    1.74 +		window based on these coordinates.
    1.75 +		@see TAdvancedPointerEvent::PointerNumber()
    1.76 + 		@publishedAll
    1.77 + 		@released */
    1.78 +		EOutOfRange,
    1.79 +		/**	Caused by a 3D pointer getting close to the screen. 
    1.80 +		It is fired when a pointer's Z coordinate crosses the threshold for EEnterCloseProximity 
    1.81 +		from the OutOfRange state or from the Up/OutOfCloseProximity state.
    1.82 +		Please refer to the system documentation for an explanation of pointer states.  
    1.83 +		@see RWsSession::SetCloseProximityThresholds
    1.84 +		@see RWsSession::GetEnterCloseProximityThreshold 
    1.85 + 		@publishedAll
    1.86 + 		@released */
    1.87 +		EEnterCloseProximity,
    1.88 +		/**	Caused by a 3D pointer moving away from the screen. 
    1.89 +		It is generally fired when a pointer's Z coordinate crosses the threshold for EExitCloseProximity 
    1.90 +		from the Up/InCloseProximity state.
    1.91 +		Please refer to the system documentation for an explanation of pointer states.  
    1.92 +		@see RWsSession::SetCloseProximityThresholds
    1.93 +		@see RWsSession::GetExitCloseProximityThreshold 
    1.94 + 		@publishedAll
    1.95 + 		@released */
    1.96 +		EExitCloseProximity,
    1.97 +		/**	Caused by a 3D pointer pressing the screen. 
    1.98 +		It is generally fired when a pointer's Z coordinate crosses the threshold for EEnterHighPressure 
    1.99 +		from the Down/OutOfHighPressure state.
   1.100 +		Please refer to the system documentation for an explanation of pointer states.  
   1.101 +		@see RWsSession::SetHighPressureThresholds
   1.102 +		@see RWsSession::GetEnterHighPressureThreshold 
   1.103 + 		@publishedAll
   1.104 + 		@released */
   1.105 +		EEnterHighPressure,
   1.106 +		/**	Caused by s 3D pointer pressing the screen with reducing force. 
   1.107 +		It is fired when a pointer's Z coordinate crosses the threshold for EExitHighPressure 
   1.108 +		from the Down/InHighPressure state.
   1.109 +		Please refer to the system documentation for an explanation of pointer states.  
   1.110 +		@see RWsSession::SetHighPressureThresholds
   1.111 +		@see RWsSession::GetExitHighPressureThreshold 
   1.112 + 		@publishedAll
   1.113 + 		@released */
   1.114 +		EExitHighPressure,
   1.115 +		/** WSERV will never generate TPointerEvent with this type.
   1.116 +		    
   1.117 +		    WARNING: Enum for internal use ONLY.  Compatibility is not guaranteed in future releases. */
   1.118 +		ENullType = -1
   1.119 +		};
   1.120 +
   1.121 +	inline TPointerEvent();
   1.122 +	inline TPointerEvent(const TPointerEvent& aPointerEvent);
   1.123 +	inline TPointerEvent(TType aType, TUint aModifiers, const TPoint &aPosition, const TPoint &aParentPosition);	
   1.124 +	inline TPointerEvent& operator=(const TPointerEvent& aPointerEvent);
   1.125 +	
   1.126 +	inline void Copy(const TPointerEvent& aPointerEvent);
   1.127 +	inline TBool IsAdvancedPointerEvent() const;
   1.128 +	inline const TAdvancedPointerEvent* AdvancedPointerEvent() const;
   1.129 +	/** The type of pointer event. */
   1.130 +	TType iType;
   1.131 +	/** The state of the modifier keys, defined in TEventModifier. */
   1.132 +	TUint iModifiers;	// State of pointing device and associated buttons
   1.133 +	/** Co-ordinates of the pointer event relative to the origin of the window it occurred
   1.134 +	in.
   1.135 +
   1.136 +	Positive co-ordinates indicate a position to the right of and down from
   1.137 +	the window's origin, negative co-ordinates indicate a position to the left
   1.138 +	and up. */
   1.139 +	TPoint iPosition;
   1.140 +	/** Co-ordinates of the pointer event relative to the parent window of the window
   1.141 +	it occurred in.
   1.142 +
   1.143 +	Positive co-ordinates indicate a position to the right of and down from the window's
   1.144 +	origin, negative co-ordinates indicate a position to the left and up. */
   1.145 +	TPoint iParentPosition;
   1.146 +	};
   1.147 +
   1.148 +inline TBool TPointerEvent::IsAdvancedPointerEvent() const
   1.149 +/** Check if this pointer event is an instance of TAdvancedPointerEvent
   1.150 +    containing pointer number, proximity and pressure.
   1.151 +    
   1.152 +    @return ETrue if this pointer event is an instance of TAdvancedPointerEvent;
   1.153 +            EFalse otherwise.
   1.154 +    @see TPointerEvent::AdvancedPointerEvent()
   1.155 +    @see RWindowBase::EnableAdvancedPointers()
   1.156 + 	@publishedAll
   1.157 + 	@released */
   1.158 +	{
   1.159 +	return ((iModifiers&EModifierAdvancedPointerEvent)!=0);
   1.160 +	}
   1.161 +
   1.162 +/** Default Constructor
   1.163 +
   1.164 + 	@publishedAll
   1.165 + 	@released */
   1.166 +inline TPointerEvent::TPointerEvent() {}
   1.167 +
   1.168 +/** Copy Constructor
   1.169 +
   1.170 +	@param aPointerEvent the pointer event to copy
   1.171 +
   1.172 + 	@publishedAll
   1.173 + 	@released */
   1.174 +inline TPointerEvent::TPointerEvent(const TPointerEvent& aPointerEvent) // Copy Constructor
   1.175 +	{
   1.176 +	Copy(aPointerEvent);
   1.177 +	}
   1.178 +
   1.179 +/* TPointerEvent Constructor
   1.180 +
   1.181 +	@param aType The pointer event type
   1.182 +	@param aModifiers The event modifiers
   1.183 +	@param aPosition The pointer position
   1.184 +	@param aParentPosition The pointer position relative to the parent window
   1.185 +*/
   1.186 +inline TPointerEvent::TPointerEvent(TType aType, TUint aModifiers, const TPoint &aPosition, const TPoint &aParentPosition)
   1.187 +: iType(aType), iModifiers(aModifiers), iPosition(aPosition), iParentPosition(aParentPosition)  
   1.188 +	{}
   1.189 +
   1.190 +/** Operator= override
   1.191 +
   1.192 +	@param aPointerEvent the pointer event to copy
   1.193 +
   1.194 + 	@publishedAll
   1.195 + 	@released */
   1.196 +inline TPointerEvent& TPointerEvent::operator=(const TPointerEvent& aPointerEvent) // Operator = overload
   1.197 +	{
   1.198 +	if(this != &aPointerEvent)
   1.199 +		{
   1.200 +		Copy(aPointerEvent);
   1.201 +		}
   1.202 +	return *this;
   1.203 +	}
   1.204 +
   1.205 +/** Copies from a TPointerEvent object
   1.206 +
   1.207 +	@param aPointerEvent the pointer event to copy
   1.208 +
   1.209 + 	@publishedAll
   1.210 + 	@released */
   1.211 +inline void TPointerEvent::Copy(const TPointerEvent& aPointerEvent)
   1.212 +	{
   1.213 +	iType=aPointerEvent.iType;
   1.214 +	iModifiers=(aPointerEvent.iModifiers&~EModifierAdvancedPointerEvent); // Clear the advanced pointer flag
   1.215 +	iPosition=aPointerEvent.iPosition;
   1.216 +	iParentPosition=aPointerEvent.iParentPosition;
   1.217 +	}
   1.218 +
   1.219 +#endif /* POINTEREVENT_H */