os/graphics/windowing/windowserver/nga/CLIENT/advancedpointerevent.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// TAdvancedPointerEvent encapsulates additional information to that contained in TPointerEvent.
sl@0
    15
// For multi-touch, pressure and proximity.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include "W32STD.H"
sl@0
    20
sl@0
    21
sl@0
    22
EXPORT_C TInt TAdvancedPointerEvent::DoGetPointerNumber() const
sl@0
    23
/** Gets the pointer number for the event
sl@0
    24
  
sl@0
    25
  @return TInt. The pointer number for the event
sl@0
    26
  @internalTechnology */
sl@0
    27
	{
sl@0
    28
	return iData.multiPos3D.iPointerNumber;
sl@0
    29
	}
sl@0
    30
sl@0
    31
EXPORT_C TInt TAdvancedPointerEvent::DoGetProximity() const
sl@0
    32
/** Gets the pointer event proximity
sl@0
    33
  
sl@0
    34
  @return TInt.  The pointer event proximity
sl@0
    35
  @internalTechnology */
sl@0
    36
	{
sl@0
    37
	return Min(iData.multiPos3D.iPosZ,EPressureProximityCrossover);
sl@0
    38
	}
sl@0
    39
sl@0
    40
EXPORT_C TInt TAdvancedPointerEvent::DoGetPressure() const
sl@0
    41
/** Gets the pointer event pressure
sl@0
    42
  
sl@0
    43
  @return TInt.  The pointer event pressure
sl@0
    44
  @internalTechnology */
sl@0
    45
	{
sl@0
    46
	return Max(iData.multiPos3D.iPosZ,EPressureProximityCrossover);
sl@0
    47
	}
sl@0
    48
sl@0
    49
EXPORT_C TInt TAdvancedPointerEvent::DoGetProximityAndPressure() const
sl@0
    50
/** Gets the pointer event combined proximity and pressure.
sl@0
    51
  
sl@0
    52
  Negative values are proximity, positive values are pressure.
sl@0
    53
  
sl@0
    54
  @return TInt.  The pointer event combined proximity and pressure
sl@0
    55
  @internalTechnology */
sl@0
    56
	{
sl@0
    57
	return iData.multiPos3D.iPosZ;
sl@0
    58
	}
sl@0
    59
sl@0
    60
EXPORT_C TAdvancedPointerEvent::TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent)
sl@0
    61
/** Copy Constructor for TAdvancedPointerEvent
sl@0
    62
  
sl@0
    63
  @param  const TAdvancedPointerEvent& aPointerEvent.  The event to copy.
sl@0
    64
  @internalTechnology */
sl@0
    65
	{
sl@0
    66
	Copy(aPointerEvent);
sl@0
    67
	}
sl@0
    68
sl@0
    69
EXPORT_C TAdvancedPointerEvent& TAdvancedPointerEvent::operator=(const TAdvancedPointerEvent& aPointerEvent) // Operator = overload
sl@0
    70
/** Operator= overload for TAdvancedPointerEvent
sl@0
    71
  
sl@0
    72
  @param  const TAdvancedPointerEvent& aPointerEvent.  The event to copy.
sl@0
    73
  @internalTechnology */
sl@0
    74
	{
sl@0
    75
	if(this != &aPointerEvent)
sl@0
    76
		{
sl@0
    77
		Copy(aPointerEvent);
sl@0
    78
		}
sl@0
    79
	return *this;
sl@0
    80
	}
sl@0
    81
sl@0
    82
EXPORT_C void TWsEvent::InitAdvancedPointerEvent(TPointerEvent::TType aType, TUint aModifiers, const TPoint3D &aPoint3D, TUint8 aPointerNumber)
sl@0
    83
/** Initializes TAdvancedPointerEvent contained in this TWsEvent.
sl@0
    84
 @param aType type of TAdvancedPointerEvent
sl@0
    85
 @param aModifiers the state of the modifier keys at the time when the event occured, 
sl@0
    86
                   defined in TEventModifier
sl@0
    87
 @param aPoint3D x and y coordinates of the pointer plus z coordinate representing proximity of the pointer
sl@0
    88
                 combined with its pressure, as returned by TAdvancedPointerEvent::PositionAndPressure3D()
sl@0
    89
 @param aPointerNumber pointer number of the pointer whose state change is described by this event
sl@0
    90
 @see TWsEvent::Pointer()
sl@0
    91
 @see TAdvancedPointerEvent::PositionAndPressure3D()
sl@0
    92
 @see TAdvancedPointerEvent::PointerNumber()
sl@0
    93
 @publishedPartner To become publishedAll with WSERV NGA APIs
sl@0
    94
 @prototype To become released with WSERV NGA APIs */
sl@0
    95
	{
sl@0
    96
	Pointer()->Init(aType, aModifiers, aPoint3D, aPointerNumber);
sl@0
    97
	}
sl@0
    98
sl@0
    99
EXPORT_C void TWsEvent::SetPointerNumber(TUint8 aPointerNumber)
sl@0
   100
/** Changes pointer number of TAdvancedPointerEvent contained in this TWsEvent.
sl@0
   101
 @param aPointerNumber new pointer number to set in TAdvancedPointerEvent contained in this
sl@0
   102
                       TWsEvent
sl@0
   103
 @see TWsEvent::Pointer()
sl@0
   104
 @see TAdvancedPointerEvent::PointerNumber()
sl@0
   105
 @publishedPartner To become publishedAll with WSERV NGA APIs
sl@0
   106
 @prototype To become released with WSERV NGA APIs */
sl@0
   107
	{
sl@0
   108
	Pointer()->SetPointerNumber(aPointerNumber);
sl@0
   109
	}
sl@0
   110
sl@0
   111
EXPORT_C void TWsEvent::SetPointerZ(TInt aZ)
sl@0
   112
/** Changes pressure and proximity of TAdvancedPointerEvent contained in this TWsEvent.
sl@0
   113
 @param aZ new pressure and proximity to set, combined the same way as returned
sl@0
   114
           by TAdvancedPointerEvent::ProximityAndPressure()
sl@0
   115
 @see TWsEvent::Pointer()
sl@0
   116
 @see TAdvancedPointerEvent::ProximityAndPressure()
sl@0
   117
 @publishedPartner To become publishedAll with WSERV NGA APIs
sl@0
   118
 @prototype To become released with WSERV NGA APIs */
sl@0
   119
	{
sl@0
   120
	Pointer()->SetPointerZ(aZ);
sl@0
   121
	}