1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/nga/CLIENT/advancedpointerevent.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,121 @@
1.4 +// Copyright (c) 2008-2010 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 +// TAdvancedPointerEvent encapsulates additional information to that contained in TPointerEvent.
1.18 +// For multi-touch, pressure and proximity.
1.19 +//
1.20 +//
1.21 +
1.22 +#include "W32STD.H"
1.23 +
1.24 +
1.25 +EXPORT_C TInt TAdvancedPointerEvent::DoGetPointerNumber() const
1.26 +/** Gets the pointer number for the event
1.27 +
1.28 + @return TInt. The pointer number for the event
1.29 + @internalTechnology */
1.30 + {
1.31 + return iData.multiPos3D.iPointerNumber;
1.32 + }
1.33 +
1.34 +EXPORT_C TInt TAdvancedPointerEvent::DoGetProximity() const
1.35 +/** Gets the pointer event proximity
1.36 +
1.37 + @return TInt. The pointer event proximity
1.38 + @internalTechnology */
1.39 + {
1.40 + return Min(iData.multiPos3D.iPosZ,EPressureProximityCrossover);
1.41 + }
1.42 +
1.43 +EXPORT_C TInt TAdvancedPointerEvent::DoGetPressure() const
1.44 +/** Gets the pointer event pressure
1.45 +
1.46 + @return TInt. The pointer event pressure
1.47 + @internalTechnology */
1.48 + {
1.49 + return Max(iData.multiPos3D.iPosZ,EPressureProximityCrossover);
1.50 + }
1.51 +
1.52 +EXPORT_C TInt TAdvancedPointerEvent::DoGetProximityAndPressure() const
1.53 +/** Gets the pointer event combined proximity and pressure.
1.54 +
1.55 + Negative values are proximity, positive values are pressure.
1.56 +
1.57 + @return TInt. The pointer event combined proximity and pressure
1.58 + @internalTechnology */
1.59 + {
1.60 + return iData.multiPos3D.iPosZ;
1.61 + }
1.62 +
1.63 +EXPORT_C TAdvancedPointerEvent::TAdvancedPointerEvent(const TAdvancedPointerEvent& aPointerEvent)
1.64 +/** Copy Constructor for TAdvancedPointerEvent
1.65 +
1.66 + @param const TAdvancedPointerEvent& aPointerEvent. The event to copy.
1.67 + @internalTechnology */
1.68 + {
1.69 + Copy(aPointerEvent);
1.70 + }
1.71 +
1.72 +EXPORT_C TAdvancedPointerEvent& TAdvancedPointerEvent::operator=(const TAdvancedPointerEvent& aPointerEvent) // Operator = overload
1.73 +/** Operator= overload for TAdvancedPointerEvent
1.74 +
1.75 + @param const TAdvancedPointerEvent& aPointerEvent. The event to copy.
1.76 + @internalTechnology */
1.77 + {
1.78 + if(this != &aPointerEvent)
1.79 + {
1.80 + Copy(aPointerEvent);
1.81 + }
1.82 + return *this;
1.83 + }
1.84 +
1.85 +EXPORT_C void TWsEvent::InitAdvancedPointerEvent(TPointerEvent::TType aType, TUint aModifiers, const TPoint3D &aPoint3D, TUint8 aPointerNumber)
1.86 +/** Initializes TAdvancedPointerEvent contained in this TWsEvent.
1.87 + @param aType type of TAdvancedPointerEvent
1.88 + @param aModifiers the state of the modifier keys at the time when the event occured,
1.89 + defined in TEventModifier
1.90 + @param aPoint3D x and y coordinates of the pointer plus z coordinate representing proximity of the pointer
1.91 + combined with its pressure, as returned by TAdvancedPointerEvent::PositionAndPressure3D()
1.92 + @param aPointerNumber pointer number of the pointer whose state change is described by this event
1.93 + @see TWsEvent::Pointer()
1.94 + @see TAdvancedPointerEvent::PositionAndPressure3D()
1.95 + @see TAdvancedPointerEvent::PointerNumber()
1.96 + @publishedPartner To become publishedAll with WSERV NGA APIs
1.97 + @prototype To become released with WSERV NGA APIs */
1.98 + {
1.99 + Pointer()->Init(aType, aModifiers, aPoint3D, aPointerNumber);
1.100 + }
1.101 +
1.102 +EXPORT_C void TWsEvent::SetPointerNumber(TUint8 aPointerNumber)
1.103 +/** Changes pointer number of TAdvancedPointerEvent contained in this TWsEvent.
1.104 + @param aPointerNumber new pointer number to set in TAdvancedPointerEvent contained in this
1.105 + TWsEvent
1.106 + @see TWsEvent::Pointer()
1.107 + @see TAdvancedPointerEvent::PointerNumber()
1.108 + @publishedPartner To become publishedAll with WSERV NGA APIs
1.109 + @prototype To become released with WSERV NGA APIs */
1.110 + {
1.111 + Pointer()->SetPointerNumber(aPointerNumber);
1.112 + }
1.113 +
1.114 +EXPORT_C void TWsEvent::SetPointerZ(TInt aZ)
1.115 +/** Changes pressure and proximity of TAdvancedPointerEvent contained in this TWsEvent.
1.116 + @param aZ new pressure and proximity to set, combined the same way as returned
1.117 + by TAdvancedPointerEvent::ProximityAndPressure()
1.118 + @see TWsEvent::Pointer()
1.119 + @see TAdvancedPointerEvent::ProximityAndPressure()
1.120 + @publishedPartner To become publishedAll with WSERV NGA APIs
1.121 + @prototype To become released with WSERV NGA APIs */
1.122 + {
1.123 + Pointer()->SetPointerZ(aZ);
1.124 + }