summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GButton.cpp4
-rw-r--r--LibGUI/GButton.h4
-rw-r--r--LibGUI/GEvent.cpp12
-rw-r--r--LibGUI/GEvent.h73
-rw-r--r--LibGUI/GEventLoop.cpp12
-rw-r--r--LibGUI/GEventLoop.h4
-rw-r--r--LibGUI/GObject.cpp18
-rw-r--r--LibGUI/GObject.h12
-rw-r--r--LibGUI/GScrollBar.cpp2
-rw-r--r--LibGUI/GScrollBar.h2
-rw-r--r--LibGUI/GSplitter.cpp4
-rw-r--r--LibGUI/GSplitter.h4
-rw-r--r--LibGUI/GStackWidget.cpp2
-rw-r--r--LibGUI/GStackWidget.h2
-rw-r--r--LibGUI/GTextEditor.cpp10
-rw-r--r--LibGUI/GTextEditor.h10
-rw-r--r--LibGUI/GTimer.cpp2
-rw-r--r--LibGUI/GTimer.h2
-rw-r--r--LibGUI/GWidget.cpp16
-rw-r--r--LibGUI/GWidget.h16
-rw-r--r--LibGUI/GWindow.cpp14
-rw-r--r--LibGUI/GWindow.h2
-rw-r--r--LibGUI/Makefile1
23 files changed, 78 insertions, 150 deletions
diff --git a/LibGUI/GButton.cpp b/LibGUI/GButton.cpp
index 2901b9e19f..7496042fed 100644
--- a/LibGUI/GButton.cpp
+++ b/LibGUI/GButton.cpp
@@ -97,13 +97,13 @@ void GButton::mouseup_event(GMouseEvent& event)
GWidget::mouseup_event(event);
}
-void GButton::enter_event(GEvent&)
+void GButton::enter_event(CEvent&)
{
m_hovered = true;
update();
}
-void GButton::leave_event(GEvent&)
+void GButton::leave_event(CEvent&)
{
m_hovered = false;
update();
diff --git a/LibGUI/GButton.h b/LibGUI/GButton.h
index 2e52fde4dc..b61ee2888a 100644
--- a/LibGUI/GButton.h
+++ b/LibGUI/GButton.h
@@ -42,8 +42,8 @@ private:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
- virtual void enter_event(GEvent&) override;
- virtual void leave_event(GEvent&) override;
+ virtual void enter_event(CEvent&) override;
+ virtual void leave_event(CEvent&) override;
String m_caption;
RetainPtr<GraphicsBitmap> m_icon;
diff --git a/LibGUI/GEvent.cpp b/LibGUI/GEvent.cpp
deleted file mode 100644
index 4f6b0b2dfb..0000000000
--- a/LibGUI/GEvent.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <LibGUI/GEvent.h>
-#include <LibGUI/GObject.h>
-
-GChildEvent::GChildEvent(Type type, GObject& child)
- : GEvent(type)
- , m_child(child.make_weak_ptr())
-{
-}
-
-GChildEvent::~GChildEvent()
-{
-}
diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h
index 67d49bf720..df386c113f 100644
--- a/LibGUI/GEvent.h
+++ b/LibGUI/GEvent.h
@@ -1,22 +1,17 @@
#pragma once
+#include <LibCore/CEvent.h>
#include <SharedGraphics/Point.h>
#include <SharedGraphics/Rect.h>
-#include <AK/AKString.h>
-#include <AK/Types.h>
-#include <AK/WeakPtr.h>
-#include <AK/Function.h>
#include <Kernel/KeyCode.h>
#include <LibGUI/GWindowType.h>
class GObject;
-class GEvent {
+class GEvent : public CEvent{
public:
enum Type {
- Invalid = 0,
- Quit,
- Show,
+ Show = 1000,
Hide,
Paint,
Resize,
@@ -27,9 +22,6 @@ public:
Leave,
KeyDown,
KeyUp,
- Timer,
- DeferredDestroy,
- DeferredInvoke,
WindowEntered,
WindowLeft,
WindowBecameInactive,
@@ -37,37 +29,17 @@ public:
FocusIn,
FocusOut,
WindowCloseRequest,
- ChildAdded,
- ChildRemoved,
WM_WindowRemoved,
WM_WindowStateChanged,
};
GEvent() { }
- explicit GEvent(Type type) : m_type(type) { }
+ explicit GEvent(Type type) : CEvent(type) { }
virtual ~GEvent() { }
- Type type() const { return m_type; }
-
- bool is_mouse_event() const { return m_type == MouseMove || m_type == MouseDown || m_type == MouseUp; }
- bool is_key_event() const { return m_type == KeyUp || m_type == KeyDown; }
- bool is_paint_event() const { return m_type == Paint; }
-
-private:
- Type m_type { Invalid };
-};
-
-class GDeferredInvocationEvent : public GEvent {
- friend class GEventLoop;
-public:
- GDeferredInvocationEvent(Function<void(GObject&)> invokee)
- : GEvent(GEvent::Type::DeferredInvoke)
- , m_invokee(move(invokee))
- {
- }
-
-private:
- Function<void(GObject&)> m_invokee;
+ bool is_mouse_event() const { return type() == MouseMove || type() == MouseDown || type() == MouseUp; }
+ bool is_key_event() const { return type() == KeyUp || type() == KeyDown; }
+ bool is_paint_event() const { return type() == Paint; }
};
class GWMEvent : public GEvent {
@@ -121,14 +93,6 @@ private:
bool m_minimized;
};
-class QuitEvent final : public GEvent {
-public:
- QuitEvent()
- : GEvent(GEvent::Quit)
- {
- }
-};
-
class GPaintEvent final : public GEvent {
public:
explicit GPaintEvent(const Rect& rect, const Size& window_size = Size())
@@ -233,26 +197,3 @@ private:
GMouseButton m_button { GMouseButton::None };
unsigned m_modifiers { 0 };
};
-
-class GTimerEvent final : public GEvent {
-public:
- explicit GTimerEvent(int timer_id) : GEvent(GEvent::Timer), m_timer_id(timer_id) { }
- ~GTimerEvent() { }
-
- int timer_id() const { return m_timer_id; }
-
-private:
- int m_timer_id;
-};
-
-class GChildEvent final : public GEvent {
-public:
- GChildEvent(Type, GObject& child);
- ~GChildEvent();
-
- GObject* child() { return m_child.ptr(); }
- const GObject* child() const { return m_child.ptr(); }
-
-private:
- WeakPtr<GObject> m_child;
-};
diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp
index e60ac985d8..da031ceb18 100644
--- a/LibGUI/GEventLoop.cpp
+++ b/LibGUI/GEventLoop.cpp
@@ -153,15 +153,15 @@ int GEventLoop::exec()
#endif
if (!receiver) {
switch (event.type()) {
- case GEvent::Quit:
+ case CEvent::Quit:
ASSERT_NOT_REACHED();
return 0;
default:
dbgprintf("Event type %u with no receiver :(\n", event.type());
}
- } else if (event.type() == GEvent::Type::DeferredInvoke) {
+ } else if (event.type() == CEvent::Type::DeferredInvoke) {
printf("DeferredInvoke: receiver=%s{%p}\n", receiver->class_name(), receiver);
- static_cast<GDeferredInvocationEvent&>(event).m_invokee(*receiver);
+ static_cast<CDeferredInvocationEvent&>(event).m_invokee(*receiver);
} else {
receiver->event(event);
}
@@ -177,7 +177,7 @@ int GEventLoop::exec()
ASSERT_NOT_REACHED();
}
-void GEventLoop::post_event(GObject& receiver, OwnPtr<GEvent>&& event)
+void GEventLoop::post_event(GObject& receiver, OwnPtr<CEvent>&& event)
{
#ifdef GEVENTLOOP_DEBUG
dbgprintf("GEventLoop::post_event: {%u} << receiver=%p, event=%p\n", m_queued_events.size(), &receiver, event.ptr());
@@ -322,9 +322,9 @@ void GEventLoop::wait_for_event()
if (!timer.has_expired())
continue;
#ifdef GEVENTLOOP_DEBUG
- dbgprintf("GEventLoop: Timer %d has expired, sending GTimerEvent to %p\n", timer.timer_id, timer.owner);
+ dbgprintf("GEventLoop: Timer %d has expired, sending CTimerEvent to %p\n", timer.timer_id, timer.owner);
#endif
- post_event(*timer.owner, make<GTimerEvent>(timer.timer_id));
+ post_event(*timer.owner, make<CTimerEvent>(timer.timer_id));
if (timer.should_reload) {
timer.reload();
} else {
diff --git a/LibGUI/GEventLoop.h b/LibGUI/GEventLoop.h
index f32bba887f..a1ebcde5f5 100644
--- a/LibGUI/GEventLoop.h
+++ b/LibGUI/GEventLoop.h
@@ -20,7 +20,7 @@ public:
int exec();
- void post_event(GObject& receiver, OwnPtr<GEvent>&&);
+ void post_event(GObject& receiver, OwnPtr<CEvent>&&);
static GEventLoop& main();
static GEventLoop& current();
@@ -66,7 +66,7 @@ private:
struct QueuedEvent {
WeakPtr<GObject> receiver;
- OwnPtr<GEvent> event;
+ OwnPtr<CEvent> event;
};
Vector<QueuedEvent> m_queued_events;
diff --git a/LibGUI/GObject.cpp b/LibGUI/GObject.cpp
index 3298fa4218..eda781bfbd 100644
--- a/LibGUI/GObject.cpp
+++ b/LibGUI/GObject.cpp
@@ -21,17 +21,17 @@ GObject::~GObject()
delete child;
}
-void GObject::event(GEvent& event)
+void GObject::event(CEvent& event)
{
switch (event.type()) {
case GEvent::Timer:
- return timer_event(static_cast<GTimerEvent&>(event));
+ return timer_event(static_cast<CTimerEvent&>(event));
case GEvent::DeferredDestroy:
delete this;
break;
case GEvent::ChildAdded:
case GEvent::ChildRemoved:
- return child_event(static_cast<GChildEvent&>(event));
+ return child_event(static_cast<CChildEvent&>(event));
case GEvent::Invalid:
ASSERT_NOT_REACHED();
break;
@@ -43,7 +43,7 @@ void GObject::event(GEvent& event)
void GObject::add_child(GObject& object)
{
m_children.append(&object);
- GEventLoop::current().post_event(*this, make<GChildEvent>(GEvent::ChildAdded, object));
+ GEventLoop::current().post_event(*this, make<CChildEvent>(GEvent::ChildAdded, object));
}
void GObject::remove_child(GObject& object)
@@ -51,17 +51,17 @@ void GObject::remove_child(GObject& object)
for (ssize_t i = 0; i < m_children.size(); ++i) {
if (m_children[i] == &object) {
m_children.remove(i);
- GEventLoop::current().post_event(*this, make<GChildEvent>(GEvent::ChildRemoved, object));
+ GEventLoop::current().post_event(*this, make<CChildEvent>(GEvent::ChildRemoved, object));
return;
}
}
}
-void GObject::timer_event(GTimerEvent&)
+void GObject::timer_event(CTimerEvent&)
{
}
-void GObject::child_event(GChildEvent&)
+void GObject::child_event(CChildEvent&)
{
}
@@ -86,7 +86,7 @@ void GObject::stop_timer()
void GObject::delete_later()
{
- GEventLoop::current().post_event(*this, make<GEvent>(GEvent::DeferredDestroy));
+ GEventLoop::current().post_event(*this, make<CEvent>(CEvent::DeferredDestroy));
}
void GObject::dump_tree(int indent)
@@ -103,5 +103,5 @@ void GObject::dump_tree(int indent)
void GObject::deferred_invoke(Function<void(GObject&)> invokee)
{
- GEventLoop::current().post_event(*this, make<GDeferredInvocationEvent>(move(invokee)));
+ GEventLoop::current().post_event(*this, make<CDeferredInvocationEvent>(move(invokee)));
}
diff --git a/LibGUI/GObject.h b/LibGUI/GObject.h
index 4a61990084..428a70ab82 100644
--- a/LibGUI/GObject.h
+++ b/LibGUI/GObject.h
@@ -4,9 +4,9 @@
#include <AK/Vector.h>
#include <AK/Weakable.h>
-class GEvent;
-class GChildEvent;
-class GTimerEvent;
+class CEvent;
+class CChildEvent;
+class CTimerEvent;
class GObject : public Weakable<GObject> {
public:
@@ -15,7 +15,7 @@ public:
virtual const char* class_name() const { return "GObject"; }
- virtual void event(GEvent&);
+ virtual void event(CEvent&);
Vector<GObject*>& children() { return m_children; }
@@ -39,8 +39,8 @@ public:
virtual bool is_window() const { return false; }
protected:
- virtual void timer_event(GTimerEvent&);
- virtual void child_event(GChildEvent&);
+ virtual void timer_event(CTimerEvent&);
+ virtual void child_event(CChildEvent&);
private:
GObject* m_parent { nullptr };
diff --git a/LibGUI/GScrollBar.cpp b/LibGUI/GScrollBar.cpp
index c51b039712..2f356bfa45 100644
--- a/LibGUI/GScrollBar.cpp
+++ b/LibGUI/GScrollBar.cpp
@@ -293,7 +293,7 @@ void GScrollBar::mousemove_event(GMouseEvent& event)
set_value(new_value);
}
-void GScrollBar::leave_event(GEvent&)
+void GScrollBar::leave_event(CEvent&)
{
if (m_hovered_component != Component::Invalid) {
m_hovered_component = Component::Invalid;
diff --git a/LibGUI/GScrollBar.h b/LibGUI/GScrollBar.h
index fb34b168eb..6a5d2f2b7e 100644
--- a/LibGUI/GScrollBar.h
+++ b/LibGUI/GScrollBar.h
@@ -39,7 +39,7 @@ private:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
- virtual void leave_event(GEvent&) override;
+ virtual void leave_event(CEvent&) override;
int button_size() const { return orientation() == Orientation::Vertical ? width() : height(); }
Rect up_button_rect() const;
diff --git a/LibGUI/GSplitter.cpp b/LibGUI/GSplitter.cpp
index cb71bd927e..393dfd4569 100644
--- a/LibGUI/GSplitter.cpp
+++ b/LibGUI/GSplitter.cpp
@@ -16,14 +16,14 @@ GSplitter::~GSplitter()
{
}
-void GSplitter::enter_event(GEvent&)
+void GSplitter::enter_event(CEvent&)
{
set_background_color(Color::from_rgb(0xd6d2ce));
window()->set_override_cursor(m_orientation == Orientation::Horizontal ? GStandardCursor::ResizeHorizontal : GStandardCursor::ResizeVertical);
update();
}
-void GSplitter::leave_event(GEvent&)
+void GSplitter::leave_event(CEvent&)
{
set_background_color(Color::LightGray);
if (!m_resizing)
diff --git a/LibGUI/GSplitter.h b/LibGUI/GSplitter.h
index 2006924d5e..dac51ebc92 100644
--- a/LibGUI/GSplitter.h
+++ b/LibGUI/GSplitter.h
@@ -11,8 +11,8 @@ protected:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
- virtual void enter_event(GEvent&) override;
- virtual void leave_event(GEvent&) override;
+ virtual void enter_event(CEvent&) override;
+ virtual void leave_event(CEvent&) override;
private:
Orientation m_orientation;
diff --git a/LibGUI/GStackWidget.cpp b/LibGUI/GStackWidget.cpp
index dc6bd02f41..4b7e2a2ec6 100644
--- a/LibGUI/GStackWidget.cpp
+++ b/LibGUI/GStackWidget.cpp
@@ -31,7 +31,7 @@ void GStackWidget::resize_event(GResizeEvent& event)
m_active_widget->set_relative_rect({ { }, event.size() });
}
-void GStackWidget::child_event(GChildEvent& event)
+void GStackWidget::child_event(CChildEvent& event)
{
if (!event.child() || !event.child()->is_widget())
return GWidget::child_event(event);
diff --git a/LibGUI/GStackWidget.h b/LibGUI/GStackWidget.h
index 0cac593682..f695928aa4 100644
--- a/LibGUI/GStackWidget.h
+++ b/LibGUI/GStackWidget.h
@@ -13,7 +13,7 @@ public:
virtual const char* class_name() const override { return "GStackWidget"; }
protected:
- virtual void child_event(GChildEvent&) override;
+ virtual void child_event(CChildEvent&) override;
virtual void resize_event(GResizeEvent&) override;
private:
diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp
index 69dacada43..6f6bba2f5d 100644
--- a/LibGUI/GTextEditor.cpp
+++ b/LibGUI/GTextEditor.cpp
@@ -564,18 +564,18 @@ void GTextEditor::set_cursor(const GTextPosition& position)
on_cursor_change();
}
-void GTextEditor::focusin_event(GEvent&)
+void GTextEditor::focusin_event(CEvent&)
{
update_cursor();
start_timer(500);
}
-void GTextEditor::focusout_event(GEvent&)
+void GTextEditor::focusout_event(CEvent&)
{
stop_timer();
}
-void GTextEditor::timer_event(GTimerEvent&)
+void GTextEditor::timer_event(CTimerEvent&)
{
m_cursor_state = !m_cursor_state;
if (is_focused())
@@ -805,13 +805,13 @@ void GTextEditor::paste()
insert_at_cursor_or_replace_selection(paste_text);
}
-void GTextEditor::enter_event(GEvent&)
+void GTextEditor::enter_event(CEvent&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::IBeam);
}
-void GTextEditor::leave_event(GEvent&)
+void GTextEditor::leave_event(CEvent&)
{
ASSERT(window());
window()->set_override_cursor(GStandardCursor::None);
diff --git a/LibGUI/GTextEditor.h b/LibGUI/GTextEditor.h
index 89e438eb67..3e964a5522 100644
--- a/LibGUI/GTextEditor.h
+++ b/LibGUI/GTextEditor.h
@@ -108,12 +108,12 @@ private:
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
- virtual void focusin_event(GEvent&) override;
- virtual void focusout_event(GEvent&) override;
- virtual void timer_event(GTimerEvent&) override;
+ virtual void focusin_event(CEvent&) override;
+ virtual void focusout_event(CEvent&) override;
+ virtual void timer_event(CTimerEvent&) override;
virtual bool accepts_focus() const override { return true; }
- virtual void enter_event(GEvent&) override;
- virtual void leave_event(GEvent&) override;
+ virtual void enter_event(CEvent&) override;
+ virtual void leave_event(CEvent&) override;
void paint_ruler(Painter&);
void update_content_size();
diff --git a/LibGUI/GTimer.cpp b/LibGUI/GTimer.cpp
index 9edd58bd7a..dc61314f1c 100644
--- a/LibGUI/GTimer.cpp
+++ b/LibGUI/GTimer.cpp
@@ -30,7 +30,7 @@ void GTimer::stop()
m_active = false;
}
-void GTimer::timer_event(GTimerEvent&)
+void GTimer::timer_event(CTimerEvent&)
{
if (m_single_shot)
stop();
diff --git a/LibGUI/GTimer.h b/LibGUI/GTimer.h
index 604c5042df..1aa37b4f58 100644
--- a/LibGUI/GTimer.h
+++ b/LibGUI/GTimer.h
@@ -24,7 +24,7 @@ public:
virtual const char* class_name() const override { return "GTimer"; }
private:
- virtual void timer_event(GTimerEvent&) override;
+ virtual void timer_event(CTimerEvent&) override;
bool m_active { false };
bool m_single_shot { false };
diff --git a/LibGUI/GWidget.cpp b/LibGUI/GWidget.cpp
index b8c52cd6b9..0d92e52580 100644
--- a/LibGUI/GWidget.cpp
+++ b/LibGUI/GWidget.cpp
@@ -22,7 +22,7 @@ GWidget::~GWidget()
{
}
-void GWidget::child_event(GChildEvent& event)
+void GWidget::child_event(CChildEvent& event)
{
if (event.type() == GEvent::ChildAdded) {
if (event.child() && event.child()->is_widget() && layout())
@@ -54,7 +54,7 @@ void GWidget::set_relative_rect(const Rect& rect)
update();
}
-void GWidget::event(GEvent& event)
+void GWidget::event(CEvent& event)
{
switch (event.type()) {
case GEvent::Paint:
@@ -178,14 +178,14 @@ void GWidget::handle_mousedown_event(GMouseEvent& event)
mousedown_event(event);
}
-void GWidget::handle_enter_event(GEvent& event)
+void GWidget::handle_enter_event(CEvent& event)
{
if (has_tooltip())
GApplication::the().show_tooltip(m_tooltip, screen_relative_rect().center().translated(0, height() / 2));
enter_event(event);
}
-void GWidget::handle_leave_event(GEvent& event)
+void GWidget::handle_leave_event(CEvent& event)
{
GApplication::the().hide_tooltip();
leave_event(event);
@@ -235,19 +235,19 @@ void GWidget::mousemove_event(GMouseEvent&)
{
}
-void GWidget::focusin_event(GEvent&)
+void GWidget::focusin_event(CEvent&)
{
}
-void GWidget::focusout_event(GEvent&)
+void GWidget::focusout_event(CEvent&)
{
}
-void GWidget::enter_event(GEvent&)
+void GWidget::enter_event(CEvent&)
{
}
-void GWidget::leave_event(GEvent&)
+void GWidget::leave_event(CEvent&)
{
}
diff --git a/LibGUI/GWidget.h b/LibGUI/GWidget.h
index 8b441b005c..2b6c652f25 100644
--- a/LibGUI/GWidget.h
+++ b/LibGUI/GWidget.h
@@ -38,7 +38,7 @@ public:
String tooltip() const { return m_tooltip; }
void set_tooltip(const String& tooltip) { m_tooltip = tooltip; }
- virtual void event(GEvent&) override;
+ virtual void event(CEvent&) override;
virtual void paint_event(GPaintEvent&);
virtual void resize_event(GResizeEvent&);
virtual void show_event(GShowEvent&);
@@ -50,11 +50,11 @@ public:
virtual void mouseup_event(GMouseEvent&);
virtual void click_event(GMouseEvent&);
virtual void doubleclick_event(GMouseEvent&);
- virtual void focusin_event(GEvent&);
- virtual void focusout_event(GEvent&);
- virtual void enter_event(GEvent&);
- virtual void leave_event(GEvent&);
- virtual void child_event(GChildEvent&) override;
+ virtual void focusin_event(CEvent&);
+ virtual void focusout_event(CEvent&);
+ virtual void enter_event(CEvent&);
+ virtual void leave_event(CEvent&);
+ virtual void child_event(CChildEvent&) override;
Rect relative_rect() const { return m_relative_rect; }
Point relative_position() const { return m_relative_rect.location(); }
@@ -154,8 +154,8 @@ private:
void handle_resize_event(GResizeEvent&);
void handle_mousedown_event(GMouseEvent&);
void handle_mouseup_event(GMouseEvent&);
- void handle_enter_event(GEvent&);
- void handle_leave_event(GEvent&);
+ void handle_enter_event(CEvent&);
+ void handle_leave_event(CEvent&);
void do_layout();
GWindow* m_window { nullptr };
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index 1c47ec3c6c..49da256a8d 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -168,21 +168,21 @@ void GWindow::set_override_cursor(GStandardCursor cursor)
GEventLoop::current().post_message_to_server(request);
}
-void GWindow::event(GEvent& event)
+void GWindow::event(CEvent& event)
{
- if (event.is_mouse_event()) {
+ if (event.type() == GEvent::MouseUp || event.type() == GEvent::MouseDown || event.type() == GEvent::MouseMove) {
auto& mouse_event = static_cast<GMouseEvent&>(event);
if (m_global_cursor_tracking_widget) {
auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
- auto local_event = make<GMouseEvent>(event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
+ auto local_event = make<GMouseEvent>((GEvent::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
m_global_cursor_tracking_widget->event(*local_event);
return;
}
if (m_automatic_cursor_tracking_widget) {
auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
- auto local_event = make<GMouseEvent>(event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
+ auto local_event = make<GMouseEvent>((GEvent::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
m_automatic_cursor_tracking_widget->event(*local_event);
if (mouse_event.buttons() == 0)
m_automatic_cursor_tracking_widget = nullptr;
@@ -192,7 +192,7 @@ void GWindow::event(GEvent& event)
return;
if (m_main_widget) {
auto result = m_main_widget->hit_test(mouse_event.x(), mouse_event.y());
- auto local_event = make<GMouseEvent>(event.type(), Point { result.localX, result.localY }, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
+ auto local_event = make<GMouseEvent>((GEvent::Type)event.type(), Point { result.localX, result.localY }, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers());
ASSERT(result.widget);
set_hovered_widget(result.widget);
if (mouse_event.buttons() != 0 && !m_automatic_cursor_tracking_widget)
@@ -203,7 +203,7 @@ void GWindow::event(GEvent& event)
return;
}
- if (event.is_paint_event()) {
+ if (event.type() == GEvent::Paint) {
if (!m_window_id)
return;
m_pending_paint_event_rects.clear();
@@ -240,7 +240,7 @@ void GWindow::event(GEvent& event)
return;
}
- if (event.is_key_event()) {
+ if (event.type() == GEvent::KeyUp || event.type() == GEvent::KeyDown) {
if (m_focused_widget)
return m_focused_widget->event(event);
if (m_main_widget)
diff --git a/LibGUI/GWindow.h b/LibGUI/GWindow.h
index e7d8371059..f36a97146d 100644
--- a/LibGUI/GWindow.h
+++ b/LibGUI/GWindow.h
@@ -56,7 +56,7 @@ public:
void move_to(int x, int y) { move_to({ x, y }); }
void move_to(const Point& point) { set_rect({ point, size() }); }
- virtual void event(GEvent&) override;
+ virtual void event(CEvent&) override;
bool is_visible() const;
bool is_active() const { return m_is_active; }
diff --git a/LibGUI/Makefile b/LibGUI/Makefile
index 39d60524aa..e13c965040 100644
--- a/LibGUI/Makefile
+++ b/LibGUI/Makefile
@@ -40,7 +40,6 @@ LIBGUI_OBJS = \
GClipboard.o \
GSortingProxyModel.o \
GStackWidget.o \
- GEvent.o \
GScrollableWidget.o \
GSocket.o \
GTCPSocket.o \