2020-04-06 11:09:01 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-06 11:09:01 +02:00
|
|
|
*/
|
|
|
|
|
|
2020-03-21 18:17:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-11-21 18:32:39 +00:00
|
|
|
#include <AK/TypeCasts.h>
|
2020-07-28 19:38:25 +02:00
|
|
|
#include <LibWeb/UIEvents/UIEvent.h>
|
2020-03-21 18:17:18 +01:00
|
|
|
|
2020-07-28 17:21:23 +02:00
|
|
|
namespace Web::UIEvents {
|
2020-03-21 18:17:18 +01:00
|
|
|
|
2020-07-28 19:38:25 +02:00
|
|
|
class MouseEvent final : public UIEvents::UIEvent {
|
2020-03-21 18:17:18 +01:00
|
|
|
public:
|
|
|
|
|
using WrapperType = Bindings::MouseEventWrapper;
|
|
|
|
|
|
2021-04-15 20:50:02 +03:00
|
|
|
static NonnullRefPtr<MouseEvent> create(const FlyString& event_name, i32 offset_x, i32 offset_y, i32 client_x, i32 client_y)
|
2020-03-21 18:17:18 +01:00
|
|
|
{
|
2021-04-15 20:50:02 +03:00
|
|
|
return adopt(*new MouseEvent(event_name, offset_x, offset_y, client_x, client_y));
|
2020-03-21 18:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
2020-11-21 18:32:39 +00:00
|
|
|
virtual ~MouseEvent() override;
|
2020-03-21 18:17:18 +01:00
|
|
|
|
|
|
|
|
i32 offset_x() const { return m_offset_x; }
|
|
|
|
|
i32 offset_y() const { return m_offset_y; }
|
2021-04-15 20:50:02 +03:00
|
|
|
i32 client_x() const { return m_client_x; }
|
|
|
|
|
i32 client_y() const { return m_client_y; }
|
2020-03-21 18:17:18 +01:00
|
|
|
|
|
|
|
|
protected:
|
2021-04-15 20:50:02 +03:00
|
|
|
MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y, i32 client_x, i32 client_y);
|
2020-03-21 18:17:18 +01:00
|
|
|
|
|
|
|
|
private:
|
2020-11-21 18:32:39 +00:00
|
|
|
void set_event_characteristics();
|
|
|
|
|
|
2020-03-21 18:17:18 +01:00
|
|
|
i32 m_offset_x { 0 };
|
|
|
|
|
i32 m_offset_y { 0 };
|
2021-04-15 20:50:02 +03:00
|
|
|
i32 m_client_x { 0 };
|
|
|
|
|
i32 m_client_y { 0 };
|
2020-03-21 18:17:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|