]> git.saurik.com Git - iphone-api.git/blob - WebCore/Touch.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / Touch.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 Touch_h
10 #define Touch_h
11
12 #include <wtf/Platform.h>
13
14 #if ENABLE(TOUCH_EVENTS)
15
16 #include <wtf/RefCounted.h>
17 #include <wtf/PassRefPtr.h>
18 #include <wtf/RefPtr.h>
19 #include "EventTarget.h"
20 #include "DOMWindow.h"
21
22 namespace WebCore {
23
24 class DOMWindow;
25
26 class Touch : public RefCounted<Touch> {
27 public:
28 static PassRefPtr<Touch> create()
29 {
30 return adoptRef(new Touch());
31 }
32 static PassRefPtr<Touch> create(DOMWindow* view, EventTarget* target, unsigned identifier, int pageX, int pageY, int screenX, int screenY)
33 {
34 return adoptRef(new Touch(view, target, identifier, pageX, pageY, screenX, screenY));
35 }
36
37 EventTarget* target() const { return m_target.get(); }
38
39 bool updateLocation(int pageX, int pageY, int screenX, int screenY);
40
41 unsigned identifier() const { return m_identifier; }
42
43 int clientX() const { return m_clientX; }
44 int clientY() const { return m_clientY; }
45 int pageX() const { return m_pageX; }
46 int pageY() const { return m_pageY; }
47 int screenX() const { return m_screenX; }
48 int screenY() const { return m_screenY; }
49
50 private:
51 Touch() { }
52 Touch(DOMWindow* view, EventTarget* target, unsigned identifier, int pageX, int pageY, int screenX, int screenY);
53
54 DOMWindow* view() const { return m_view.get(); }
55
56 RefPtr<DOMWindow> m_view;
57 RefPtr<EventTarget> m_target;
58
59 unsigned m_identifier;
60 int m_clientX;
61 int m_clientY;
62 int m_pageX;
63 int m_pageY;
64 int m_screenX;
65 int m_screenY;
66 };
67
68 } // namespace WebCore
69
70 #endif // ENABLE(TOUCH_EVENTS)
71
72 #endif // Touch_h