2024-08-20 18:26:55 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Ptr.h>
|
2024-08-20 18:26:55 -04:00
|
|
|
#include <LibWeb/DOM/Event.h>
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
#include <LibWeb/HTML/DataTransfer.h>
|
|
|
|
|
|
|
|
namespace Web::Clipboard {
|
|
|
|
|
|
|
|
struct ClipboardEventInit : public DOM::EventInit {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<HTML::DataTransfer> clipboard_data;
|
2024-08-20 18:26:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// https://w3c.github.io/clipboard-apis/#clipboardevent
|
|
|
|
class ClipboardEvent : public DOM::Event {
|
|
|
|
WEB_PLATFORM_OBJECT(ClipboardEvent, DOM::Event);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(ClipboardEvent);
|
2024-08-20 18:26:55 -04:00
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<ClipboardEvent> construct_impl(JS::Realm&, FlyString const& event_name, ClipboardEventInit const& event_init);
|
2024-08-20 18:26:55 -04:00
|
|
|
|
|
|
|
virtual ~ClipboardEvent() override;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<HTML::DataTransfer> clipboard_data() { return m_clipboard_data; }
|
2024-08-20 18:26:55 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
ClipboardEvent(JS::Realm&, FlyString const& event_name, ClipboardEventInit const& event_init);
|
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<HTML::DataTransfer> m_clipboard_data;
|
2024-08-20 18:26:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|