summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h
blob: 7fad45cc295f38aef66a7eb88bb494b0c404d03b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Forward.h>
#include <LibWeb/Forward.h>

#define ENUMERATE_GLOBAL_EVENT_HANDLERS(E)                    \
    E(onabort, HTML::EventNames::abort)                       \
    E(onauxclick, "auxclick")                                 \
    E(onblur, HTML::EventNames::blur)                         \
    E(oncancel, HTML::EventNames::cancel)                     \
    E(oncanplay, "canplay")                                   \
    E(oncanplaythrough, "canplaythrough")                     \
    E(onchange, HTML::EventNames::change)                     \
    E(onclick, UIEvents::EventNames::click)                   \
    E(onclose, HTML::EventNames::close)                       \
    E(oncontextmenu, HTML::EventNames::contextmenu)           \
    E(oncuechange, "cuechange")                               \
    E(ondblclick, "dblclick")                                 \
    E(ondrag, "drag")                                         \
    E(ondragend, "dragend")                                   \
    E(ondragenter, "dragenter")                               \
    E(ondragleave, "dragleave")                               \
    E(ondragover, "dragover")                                 \
    E(ondragstart, "dragstart")                               \
    E(ondrop, "drop")                                         \
    E(ondurationchange, "durationchange")                     \
    E(onemptied, "emptied")                                   \
    E(onended, "ended")                                       \
    E(onerror, HTML::EventNames::error)                       \
    E(onfocus, "focus")                                       \
    E(onformdata, "formdata")                                 \
    E(oninput, HTML::EventNames::input)                       \
    E(oninvalid, HTML::EventNames::invalid)                   \
    E(onkeydown, "keydown")                                   \
    E(onkeypress, "keypress")                                 \
    E(onkeyup, "keyup")                                       \
    E(onload, HTML::EventNames::load)                         \
    E(onloadeddata, "loadeddata")                             \
    E(onloadedmetadata, "loadedmetadata")                     \
    E(onloadstart, "loadstart")                               \
    E(onmousedown, UIEvents::EventNames::mousedown)           \
    E(onmouseenter, UIEvents::EventNames::mouseenter)         \
    E(onmouseleave, UIEvents::EventNames::mouseleave)         \
    E(onmousemove, UIEvents::EventNames::mousemove)           \
    E(onmouseout, UIEvents::EventNames::mouseout)             \
    E(onmouseover, UIEvents::EventNames::mouseover)           \
    E(onmouseup, UIEvents::EventNames::mouseup)               \
    E(onpause, "pause")                                       \
    E(onplay, "play")                                         \
    E(onplaying, "playing")                                   \
    E(onprogress, "progress")                                 \
    E(onratechange, "ratechange")                             \
    E(onreset, "reset")                                       \
    E(onresize, "resize")                                     \
    E(onscroll, "scroll")                                     \
    E(onsecuritypolicyviolation, "securitypolicyviolation")   \
    E(onseeked, "seeked")                                     \
    E(onseeking, "seeking")                                   \
    E(onselect, HTML::EventNames::select)                     \
    E(onslotchange, "slotchange")                             \
    E(onstalled, "stalled")                                   \
    E(onsubmit, HTML::EventNames::submit)                     \
    E(onsuspend, "suspend")                                   \
    E(ontimeupdate, "timeupdate")                             \
    E(ontoggle, "toggle")                                     \
    E(onvolumechange, "volumechange")                         \
    E(onwaiting, "waiting")                                   \
    E(onwebkitanimationend, "webkitanimationend")             \
    E(onwebkitanimationiteration, "webkitanimationiteration") \
    E(onwebkitanimationstart, "webkitanimationstart")         \
    E(onwebkittransitionend, "webkittransitionend")           \
    E(onwheel, "wheel")

namespace Web::HTML {

class GlobalEventHandlers {
public:
    virtual ~GlobalEventHandlers();

#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name)                  \
    void set_##attribute_name(Optional<Bindings::CallbackType>); \
    Bindings::CallbackType* attribute_name();
    ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE

protected:
    virtual DOM::EventTarget& global_event_handlers_to_event_target() = 0;
};

}