#pragma once #include #include "Point.hpp" #include "Box.hpp" namespace Raven { enum class EventType { NoneEvent, MouseButton, MouseMove, WidgetRepaintRequested, FocusUpdate, ActivationUpdate, WidgetRelayoutRequestedEvent }; class Event { private: bool m_accepted { false }; public: Event() {} virtual EventType get_type() { return EventType::NoneEvent; } virtual const char *get_name() { return "NoneEvent"; } void accept() { m_accepted = true; } bool get_accepted() { return m_accepted; } virtual ~Event() = default; }; class MouseButtonEvent : public Event { private: bool m_was_left_button_pressed; bool m_was_right_button_pressed; Point m_point; public: MouseButtonEvent(bool was_left_button_pressed, bool was_right_button_pressed, Point point) : m_was_left_button_pressed(was_left_button_pressed) , m_was_right_button_pressed(was_right_button_pressed) , m_point(point) {} EventType get_type() { return EventType::MouseButton; } const char *get_name() { return "MouseButton"; } bool get_was_left_button_pressed() { return m_was_left_button_pressed; } bool get_was_right_button_pressed() { return m_was_right_button_pressed; } Point &get_point() { return m_point; } }; class MouseMoveEvent : public Event { private: Point m_point; public: MouseMoveEvent(Point point) : m_point(point) {} EventType get_type() { return EventType::MouseMove; } const char *get_name() { return "MouseMove"; } Point &get_point() { return m_point; } }; class WidgetRepaintRequestedEvent : public Event { private: bool m_should_do_group { false }; public: WidgetRepaintRequestedEvent(bool should_do_group) : m_should_do_group(should_do_group) {} EventType get_type() { return EventType::WidgetRepaintRequested; } const char *get_name() { return "WidgetRepaintRequested"; } bool should_do_group() { return m_should_do_group; } void set_should_do_group(bool should_do_group) { m_should_do_group = should_do_group; } }; class WidgetRelayoutRequestedEvent : public Event { public: WidgetRelayoutRequestedEvent() {} EventType get_type() { return EventType::WidgetRelayoutRequestedEvent; } const char *get_name() { return "WidgetRelayoutRequestedEvent"; } }; class FocusUpdateEvent : public Event { private: bool m_focus_status; public: FocusUpdateEvent(bool focus_status) : m_focus_status(focus_status) {} EventType get_type() { return EventType::FocusUpdate; } const char *get_name() { return "FocusUpdate"; } bool get_focus_status() { return m_focus_status; } }; class ActivationUpdateEvent : public Event { private: bool m_activation_status; public: ActivationUpdateEvent(bool activation_status) : m_activation_status(activation_status) {} EventType get_type() { return EventType::ActivationUpdate; } const char *get_name() { return "ActivationUpdate"; } bool get_activation_status() { return m_activation_status; } }; }