summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h
blob: a574da2b90ba81384fbdd0accf6f419416ddf9e4 (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
/*
 * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/DOM/Event.h>

namespace Web::WebGL {

struct WebGLContextEventInit final : public DOM::EventInit {
    String status_message { String::empty() };
};

class WebGLContextEvent final : public DOM::Event {
public:
    using WrapperType = Bindings::WebGLContextEventWrapper;

    static NonnullRefPtr<WebGLContextEvent> create(FlyString const& type, WebGLContextEventInit const& event_init)
    {
        return adopt_ref(*new WebGLContextEvent(type, event_init));
    }

    static NonnullRefPtr<WebGLContextEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init)
    {
        return adopt_ref(*new WebGLContextEvent(type, event_init));
    }

    virtual ~WebGLContextEvent() override = default;

    String const& status_message() const { return m_status_message; }

private:
    WebGLContextEvent(FlyString const& type, WebGLContextEventInit const& event_init)
        : DOM::Event(type, event_init)
        , m_status_message(event_init.status_message)
    {
    }

    String m_status_message { String::empty() };
};

}