First public contribution.
1 // Copyright (c) 1995-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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\us_evnt.cpp
24 Gets the mouse or digitiser X-Y position.
28 EXPORT_C TPoint TRawEvent::Pos() const
31 __ASSERT_DEBUG(iType==EPointerMove ||
32 iType==EPointerSwitchOn ||
33 iType==EButton1Down ||
35 iType==EButton2Down ||
37 iType==EButton3Down ||
39 ,Panic(ETEventNotMoveType));
40 return(TPoint(iU.pos.x,iU.pos.y));
44 Gets the 3D pointing device Cartesian coordinates.
48 EXPORT_C TPoint3D TRawEvent::Pos3D() const
51 __ASSERT_DEBUG(iType==EPointerMove ||
52 iType==EPointer3DTiltAndMove ||
53 iType==EPointerSwitchOn ||
54 iType==EButton1Down ||
56 iType==EButton2Down ||
58 iType==EButton3Down ||
60 ,Panic(ETEventNotMoveType));
68 /** Gets the 3D pointing device polar coordinates and rotation.
70 @return The polar coordinates and rotation.
72 EXPORT_C TAngle3D TRawEvent::Tilt() const
74 __ASSERT_DEBUG(iType==EPointer3DTilt ||
75 iType==EPointer3DTiltAndMove
76 ,Panic(ETEventNotMoveType));
79 p.iTheta=iU.pos3D.theta;
83 /** Gets the rotation angle of 3D pointing device.
85 @return The rotation angle of the 3D pointing device.
87 EXPORT_C TInt TRawEvent::Rotation() const
89 __ASSERT_DEBUG(iType==EPointer3DRotation ||
90 iType==EPointer3DTiltAndMove
91 ,Panic(ETEventNotMoveType));
92 return (iU.pos3D.alpha);
100 EXPORT_C TInt TRawEvent::ScanCode() const
103 __ASSERT_DEBUG(iType==EKeyDown || iType==EKeyUp || iType==EKeyRepeat,Panic(ETEventNotKeyType));
104 return(iU.key.scanCode);
111 Gets the repeat count.
113 @return The repeat count.
115 EXPORT_C TInt TRawEvent::Repeats() const
117 __ASSERT_DEBUG(iType==EKeyRepeat,Panic(ETEventNotKeyRepeatType));
118 return(iU.key.repeats);
127 @return The modifiers.
129 @panic EUSER 34 If the event does not represent a modifier key being pressed,
130 i.e. if the event type is not TRawEvent::EUpdateModifiers
132 @see TRawEvent::EUpdateModifiers
134 EXPORT_C TInt TRawEvent::Modifiers() const
137 __ASSERT_DEBUG(iType==EUpdateModifiers,Panic(ETEventNotUpdateModifiersType));
138 return(iU.modifiers);
145 Sets the event up as a scancode event.
147 @param aType The event type.
148 @param aScanCode The scancode.
150 EXPORT_C void TRawEvent::Set(TType aType,TInt aScanCode)
154 iU.key.scanCode=aScanCode;
156 BTraceContext8(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aScanCode);
157 iTicks=User::TickCount();
162 Sets the event up as a repeating scancode event.
164 @param aType The event type.
165 @param aScanCode The scancode.
166 @param aRepeats The repeat count.
168 EXPORT_C void TRawEvent::SetRepeat(TType aType,TInt aScanCode,TInt aRepeats)
172 iU.key.scanCode=aScanCode;
173 iU.key.repeats=aRepeats;
174 BTraceContext12(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aScanCode, (TUint32)aRepeats);
175 iTicks=User::TickCount();
180 Sets the event up as a mouse/pen event.
182 @param aType The event type.
183 @param aX The X position.
184 @param aY The Y position.
186 EXPORT_C void TRawEvent::Set(TType aType,TInt aX,TInt aY)
192 BTraceContext12(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aX,(TUint32)aY);
193 iTicks=User::TickCount();
198 Sets the event up as a 3D pointer linear move event.
200 @param aType The event type.
201 @param aX The X position.
202 @param aY The Y position.
203 @param aZ The Z position (defaults to 0 on 2D detection devices) .
205 EXPORT_C void TRawEvent::Set(TType aType,TInt aX,TInt aY,TInt aZ)
212 //Form the Trace Data
213 TUint32 traceData[2];
216 BTraceContextN(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aX,traceData, sizeof(traceData));
217 iTicks=User::TickCount();
222 Sets up an event without specific parameters.
224 @param aType The event type.
226 EXPORT_C void TRawEvent::Set(TType aType)
230 BTraceContext4(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType);
231 iTicks=User::TickCount();
235 Sets the event up as a 3D pointer linear move and tilt and rotation change event.
237 @param aType The event type.
238 @param aX The X position (or TPhi polar coordinate).
239 @param aY The Y position (or Theta polar coordinate).
240 @param aZ The Z position (or rotation).
241 @param aPhi The Phi polar coordinate.
242 @param aTheta The Theta polar coordinate.
243 @param aAlpha The rotation angle.
245 EXPORT_C void TRawEvent::Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha)
253 iU.pos3D.theta=aTheta;
254 iU.pos3D.alpha=aAlpha;
255 //Form the Trace Data
256 TUint32 traceData[5];
260 traceData[3] =aTheta;
261 traceData[4] =aAlpha;
262 BTraceContextN(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aX,traceData, sizeof(traceData));
263 iTicks=User::TickCount();
267 Sets the event up as 3D pointer tilt change event.
269 @param aType The event type.
270 @param aPhi The Phi coordinate.
271 @param aTheta The Theta coordinate.
273 EXPORT_C void TRawEvent::SetTilt(TType aType,TInt aPhi,TInt aTheta)
278 iU.pos3D.theta=aTheta;
279 BTraceContext12(BTrace::ERawEvent, BTrace::ESetTiltEvent,(TUint32)aType, (TUint32)aPhi,(TUint32)aTheta);
280 iTicks=User::TickCount();
284 Sets the event up as 3D pointer rotation event.
286 @param aType The event type.
287 @param aAlpha The rotation angle.
289 EXPORT_C void TRawEvent::SetRotation(TType aType,TInt aAlpha)
293 iU.pos3D.alpha=aAlpha;
294 BTraceContext8(BTrace::ERawEvent, BTrace::ESetRotationtEvent,(TUint32)aType, (TUint32)aAlpha);
295 iTicks=User::TickCount();
300 Sets the event up as a 3D pointer linear move event with pointer number
301 @param aType The event type.
302 @param aX The X position.
303 @param aY The Y position.
304 @param aZ The Z position .
305 @param aPointerNumber The pointer number for the event
308 EXPORT_C void TRawEvent::Set (TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber)
315 iPointerNumber=aPointerNumber;
316 //Form the Trace Data
317 TUint32 traceData[3];
320 traceData[2] =aPointerNumber;
321 BTraceContextN(BTrace::ERawEvent, BTrace::ESetEvent ,(TUint32)aType, (TUint32)aX,traceData, sizeof(traceData));
322 iTicks=User::TickCount();