1/*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2013 Apple Inc. All rights reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24#pragma once
25
26#include "Event.h"
27#include "UIEventInit.h"
28#include "WindowProxy.h"
29
30namespace WebCore {
31
32// FIXME: Remove this when no one is depending on it anymore.
33typedef WindowProxy AbstractView;
34
35class UIEvent : public Event {
36public:
37 static Ref<UIEvent> create(const AtomString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, RefPtr<WindowProxy>&& view, int detail)
38 {
39 return adoptRef(*new UIEvent(type, canBubble, isCancelable, isComposed, WTFMove(view), detail));
40 }
41 static Ref<UIEvent> createForBindings()
42 {
43 return adoptRef(*new UIEvent);
44 }
45 static Ref<UIEvent> create(const AtomString& type, const UIEventInit& initializer)
46 {
47 return adoptRef(*new UIEvent(type, initializer));
48 }
49 virtual ~UIEvent();
50
51 WEBCORE_EXPORT void initUIEvent(const AtomString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail);
52
53 WindowProxy* view() const { return m_view.get(); }
54 int detail() const { return m_detail; }
55
56 EventInterface eventInterface() const override;
57
58 virtual int layerX();
59 virtual int layerY();
60
61 virtual int pageX() const;
62 virtual int pageY() const;
63
64 virtual int which() const;
65
66protected:
67 UIEvent();
68
69 UIEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail);
70 UIEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, IsTrusted = IsTrusted::Yes);
71 UIEvent(const AtomString&, const UIEventInit&);
72
73private:
74 bool isUIEvent() const final;
75
76 RefPtr<WindowProxy> m_view;
77 int m_detail;
78};
79
80} // namespace WebCore
81
82SPECIALIZE_TYPE_TRAITS_EVENT(UIEvent)
83