epoc32/include/pointerevent.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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 POINTEREVENT_H
williamr@4
    17
#define POINTEREVENT_H
williamr@4
    18
williamr@4
    19
class TAdvancedPointerEvent;
williamr@4
    20
williamr@4
    21
/** Pointer event details.
williamr@4
    22
williamr@4
    23
The function TWsEvent::Pointer() is used to get this structure for a pointer
williamr@4
    24
event.
williamr@4
    25
williamr@4
    26
@publishedAll
williamr@4
    27
@released */
williamr@4
    28
struct TPointerEvent
williamr@4
    29
	{
williamr@4
    30
	/** Pointer event types.
williamr@4
    31
	
williamr@4
    32
	Note that the user actions that cause these events will vary according to
williamr@4
    33
	the type of pointing device used. */
williamr@4
    34
	enum TType
williamr@4
    35
		{
williamr@4
    36
		/** Button 1 or pen down. */
williamr@4
    37
		EButton1Down,
williamr@4
    38
		/** Button 1 or pen up. */
williamr@4
    39
		EButton1Up,
williamr@4
    40
		/** Button 2 down.
williamr@4
    41
williamr@4
    42
		This is the middle button of a 3 button mouse. */
williamr@4
    43
		EButton2Down,
williamr@4
    44
		/** Button 2 up.
williamr@4
    45
williamr@4
    46
		This is the middle button of a 3 button mouse. */
williamr@4
    47
		EButton2Up,
williamr@4
    48
		/** Button 3 down. */
williamr@4
    49
		EButton3Down,
williamr@4
    50
		/** Button 3 up. */
williamr@4
    51
		EButton3Up,
williamr@4
    52
		/** Drag event.
williamr@4
    53
williamr@4
    54
		These events are only received when button 1 is down. */
williamr@4
    55
		EDrag,
williamr@4
    56
		/** Move event.
williamr@4
    57
williamr@4
    58
		These events are only received when button 1 is up and the XY input mode is
williamr@4
    59
		not pen. */
williamr@4
    60
		EMove,
williamr@4
    61
		/** Button repeat event. */
williamr@4
    62
		EButtonRepeat,
williamr@4
    63
		/** Switch on event caused by a screen tap. */
williamr@4
    64
		ESwitchOn,
williamr@4
    65
		/** Out Of Range event caused by 3D pointer leaving the detection volume.
williamr@4
    66
		It implies that the pointer cannot be tracked any more by device's sensors
williamr@4
    67
		and that from now the pointer number of this pointer may be used for identifying
williamr@4
    68
		another physical pointer (for example another finger).
williamr@4
    69
		As EOutOfRange event is generated when pointer's position is unknown,
williamr@4
    70
		it contains last known coordinates of the pointer and is delivered to the
williamr@4
    71
		window based on these coordinates.
williamr@4
    72
		@see TAdvancedPointerEvent::PointerNumber()
williamr@4
    73
 		@publishedAll
williamr@4
    74
 		@released */
williamr@4
    75
		EOutOfRange,
williamr@4
    76
		/**	Caused by a 3D pointer getting close to the screen. 
williamr@4
    77
		It is fired when a pointer's Z coordinate crosses the threshold for EEnterCloseProximity 
williamr@4
    78
		from the OutOfRange state or from the Up/OutOfCloseProximity state.
williamr@4
    79
		Please refer to the system documentation for an explanation of pointer states.  
williamr@4
    80
		@see RWsSession::SetCloseProximityThresholds
williamr@4
    81
		@see RWsSession::GetEnterCloseProximityThreshold 
williamr@4
    82
 		@publishedAll
williamr@4
    83
 		@released */
williamr@4
    84
		EEnterCloseProximity,
williamr@4
    85
		/**	Caused by a 3D pointer moving away from the screen. 
williamr@4
    86
		It is generally fired when a pointer's Z coordinate crosses the threshold for EExitCloseProximity 
williamr@4
    87
		from the Up/InCloseProximity state.
williamr@4
    88
		Please refer to the system documentation for an explanation of pointer states.  
williamr@4
    89
		@see RWsSession::SetCloseProximityThresholds
williamr@4
    90
		@see RWsSession::GetExitCloseProximityThreshold 
williamr@4
    91
 		@publishedAll
williamr@4
    92
 		@released */
williamr@4
    93
		EExitCloseProximity,
williamr@4
    94
		/**	Caused by a 3D pointer pressing the screen. 
williamr@4
    95
		It is generally fired when a pointer's Z coordinate crosses the threshold for EEnterHighPressure 
williamr@4
    96
		from the Down/OutOfHighPressure state.
williamr@4
    97
		Please refer to the system documentation for an explanation of pointer states.  
williamr@4
    98
		@see RWsSession::SetHighPressureThresholds
williamr@4
    99
		@see RWsSession::GetEnterHighPressureThreshold 
williamr@4
   100
 		@publishedAll
williamr@4
   101
 		@released */
williamr@4
   102
		EEnterHighPressure,
williamr@4
   103
		/**	Caused by s 3D pointer pressing the screen with reducing force. 
williamr@4
   104
		It is fired when a pointer's Z coordinate crosses the threshold for EExitHighPressure 
williamr@4
   105
		from the Down/InHighPressure state.
williamr@4
   106
		Please refer to the system documentation for an explanation of pointer states.  
williamr@4
   107
		@see RWsSession::SetHighPressureThresholds
williamr@4
   108
		@see RWsSession::GetExitHighPressureThreshold 
williamr@4
   109
 		@publishedAll
williamr@4
   110
 		@released */
williamr@4
   111
		EExitHighPressure,
williamr@4
   112
		/** WSERV will never generate TPointerEvent with this type.
williamr@4
   113
		    
williamr@4
   114
		    WARNING: Enum for internal use ONLY.  Compatibility is not guaranteed in future releases. */
williamr@4
   115
		ENullType = -1
williamr@4
   116
		};
williamr@4
   117
williamr@4
   118
	inline TPointerEvent();
williamr@4
   119
	inline TPointerEvent(const TPointerEvent& aPointerEvent);
williamr@4
   120
	inline TPointerEvent(TType aType, TUint aModifiers, const TPoint &aPosition, const TPoint &aParentPosition);	
williamr@4
   121
	inline TPointerEvent& operator=(const TPointerEvent& aPointerEvent);
williamr@4
   122
	
williamr@4
   123
	inline void Copy(const TPointerEvent& aPointerEvent);
williamr@4
   124
	inline TBool IsAdvancedPointerEvent() const;
williamr@4
   125
	inline const TAdvancedPointerEvent* AdvancedPointerEvent() const;
williamr@4
   126
	/** The type of pointer event. */
williamr@4
   127
	TType iType;
williamr@4
   128
	/** The state of the modifier keys, defined in TEventModifier. */
williamr@4
   129
	TUint iModifiers;	// State of pointing device and associated buttons
williamr@4
   130
	/** Co-ordinates of the pointer event relative to the origin of the window it occurred
williamr@4
   131
	in.
williamr@4
   132
williamr@4
   133
	Positive co-ordinates indicate a position to the right of and down from
williamr@4
   134
	the window's origin, negative co-ordinates indicate a position to the left
williamr@4
   135
	and up. */
williamr@4
   136
	TPoint iPosition;
williamr@4
   137
	/** Co-ordinates of the pointer event relative to the parent window of the window
williamr@4
   138
	it occurred in.
williamr@4
   139
williamr@4
   140
	Positive co-ordinates indicate a position to the right of and down from the window's
williamr@4
   141
	origin, negative co-ordinates indicate a position to the left and up. */
williamr@4
   142
	TPoint iParentPosition;
williamr@4
   143
	};
williamr@4
   144
williamr@4
   145
inline TBool TPointerEvent::IsAdvancedPointerEvent() const
williamr@4
   146
/** Check if this pointer event is an instance of TAdvancedPointerEvent
williamr@4
   147
    containing pointer number, proximity and pressure.
williamr@4
   148
    
williamr@4
   149
    @return ETrue if this pointer event is an instance of TAdvancedPointerEvent;
williamr@4
   150
            EFalse otherwise.
williamr@4
   151
    @see TPointerEvent::AdvancedPointerEvent()
williamr@4
   152
    @see RWindowBase::EnableAdvancedPointers()
williamr@4
   153
 	@publishedAll
williamr@4
   154
 	@released */
williamr@4
   155
	{
williamr@4
   156
	return ((iModifiers&EModifierAdvancedPointerEvent)!=0);
williamr@4
   157
	}
williamr@4
   158
williamr@4
   159
/** Default Constructor
williamr@4
   160
williamr@4
   161
 	@publishedAll
williamr@4
   162
 	@released */
williamr@4
   163
inline TPointerEvent::TPointerEvent() {}
williamr@4
   164
williamr@4
   165
/** Copy Constructor
williamr@4
   166
williamr@4
   167
	@param aPointerEvent the pointer event to copy
williamr@4
   168
williamr@4
   169
 	@publishedAll
williamr@4
   170
 	@released */
williamr@4
   171
inline TPointerEvent::TPointerEvent(const TPointerEvent& aPointerEvent) // Copy Constructor
williamr@4
   172
	{
williamr@4
   173
	Copy(aPointerEvent);
williamr@4
   174
	}
williamr@4
   175
williamr@4
   176
/* TPointerEvent Constructor
williamr@4
   177
williamr@4
   178
	@param aType The pointer event type
williamr@4
   179
	@param aModifiers The event modifiers
williamr@4
   180
	@param aPosition The pointer position
williamr@4
   181
	@param aParentPosition The pointer position relative to the parent window
williamr@4
   182
*/
williamr@4
   183
inline TPointerEvent::TPointerEvent(TType aType, TUint aModifiers, const TPoint &aPosition, const TPoint &aParentPosition)
williamr@4
   184
: iType(aType), iModifiers(aModifiers), iPosition(aPosition), iParentPosition(aParentPosition)  
williamr@4
   185
	{}
williamr@4
   186
williamr@4
   187
/** Operator= override
williamr@4
   188
williamr@4
   189
	@param aPointerEvent the pointer event to copy
williamr@4
   190
williamr@4
   191
 	@publishedAll
williamr@4
   192
 	@released */
williamr@4
   193
inline TPointerEvent& TPointerEvent::operator=(const TPointerEvent& aPointerEvent) // Operator = overload
williamr@4
   194
	{
williamr@4
   195
	if(this != &aPointerEvent)
williamr@4
   196
		{
williamr@4
   197
		Copy(aPointerEvent);
williamr@4
   198
		}
williamr@4
   199
	return *this;
williamr@4
   200
	}
williamr@4
   201
williamr@4
   202
/** Copies from a TPointerEvent object
williamr@4
   203
williamr@4
   204
	@param aPointerEvent the pointer event to copy
williamr@4
   205
williamr@4
   206
 	@publishedAll
williamr@4
   207
 	@released */
williamr@4
   208
inline void TPointerEvent::Copy(const TPointerEvent& aPointerEvent)
williamr@4
   209
	{
williamr@4
   210
	iType=aPointerEvent.iType;
williamr@4
   211
	iModifiers=(aPointerEvent.iModifiers&~EModifierAdvancedPointerEvent); // Clear the advanced pointer flag
williamr@4
   212
	iPosition=aPointerEvent.iPosition;
williamr@4
   213
	iParentPosition=aPointerEvent.iParentPosition;
williamr@4
   214
	}
williamr@4
   215
williamr@4
   216
#endif /* POINTEREVENT_H */