mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 22:37:35 +00:00

This patch adds the Event base class, along with a MouseEvent subclass. We now dispatch MouseEvent objects for mousedown, mouseup and mousemove and these objects have the .offsetX and .offsetY properties. Both of those properties are hard-coded at the moment. This will be fixed in the next patch. :^)
36 lines
654 B
C++
36 lines
654 B
C++
#pragma once
|
|
|
|
#include <AK/RefCounted.h>
|
|
#include <AK/String.h>
|
|
#include <LibWeb/Bindings/Wrappable.h>
|
|
|
|
namespace Web {
|
|
|
|
class Event
|
|
: public RefCounted<Event>
|
|
, public Bindings::Wrappable {
|
|
public:
|
|
using WrapperType = Bindings::EventWrapper;
|
|
|
|
static NonnullRefPtr<Event> create(String event_name)
|
|
{
|
|
return adopt(*new Event(move(event_name)));
|
|
}
|
|
|
|
virtual ~Event() {}
|
|
|
|
const String& name() const { return m_event_name; }
|
|
|
|
virtual bool is_mouse_event() const { return false; }
|
|
|
|
protected:
|
|
Event(String event_name)
|
|
: m_event_name(move(event_name))
|
|
{
|
|
}
|
|
|
|
private:
|
|
String m_event_name;
|
|
};
|
|
|
|
}
|