]> git.saurik.com Git - iphone-api.git/blob - WebCore/TouchEvent.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / TouchEvent.h
1 /*
2 * Copyright (C) 2008, Apple Inc. All rights reserved.
3 *
4 * No license or rights are granted by Apple expressly or by implication,
5 * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
6 * secrets or other rights.
7 */
8
9 #ifndef TouchEvent_h
10 #define TouchEvent_h
11
12 #include <wtf/Platform.h>
13
14 #if ENABLE(TOUCH_EVENTS)
15
16 #include <wtf/RefPtr.h>
17 #include "MouseRelatedEvent.h"
18 #include "TouchList.h"
19
20 namespace WebCore {
21
22 class TouchEvent : public MouseRelatedEvent {
23 public:
24 static PassRefPtr<TouchEvent> create()
25 {
26 return adoptRef(new TouchEvent);
27 }
28 static PassRefPtr<TouchEvent> create(
29 const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
30 int screenX, int screenY, int pageX, int pageY,
31 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
32 TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
33 float scale, float rotation, bool isSimulated = false)
34 {
35 return adoptRef(new TouchEvent(type, canBubble, cancelable, view, detail,
36 screenX, screenY, pageX, pageY,
37 ctrlKey, altKey, shiftKey, metaKey,
38 touches, targetTouches, changedTouches,
39 scale, rotation, isSimulated));
40 }
41 virtual ~TouchEvent() {}
42
43 void initTouchEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
44 int screenX, int screenY, int clientX, int clientY,
45 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
46 TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
47 float scale, float rotation);
48
49 virtual bool isTouchEvent() const { return true; }
50
51 TouchList* touches() const { return m_touches.get(); }
52 TouchList* targetTouches() const { return m_targetTouches.get(); }
53 TouchList* changedTouches() const { return m_changedTouches.get(); }
54
55 float scale() const { return m_scale; }
56 float rotation() const { return m_rotation; }
57
58 private:
59 TouchEvent() { }
60 TouchEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
61 int screenX, int screenY, int pageX, int pageY,
62 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
63 TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
64 float scale, float rotation, bool isSimulated = false);
65
66 RefPtr<TouchList> m_touches;
67 RefPtr<TouchList> m_targetTouches;
68 RefPtr<TouchList> m_changedTouches;
69 float m_scale;
70 float m_rotation;
71 };
72
73 } // namespace WebCore
74
75 #endif // ENABLE(TOUCH_EVENTS)
76
77 #endif // TouchEvent_h