summaryrefslogtreecommitdiff
path: root/LibGUI/GEvent.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-18 04:12:27 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-18 04:12:27 +0200
commita747a10eabd12427bf3c4626e6929041aa81fa7c (patch)
treeaef86e888d07d7edf18adafa22687409f535875d /LibGUI/GEvent.h
parente74b5bc054abece021ec38bf2f12a3fb5b659a75 (diff)
downloadserenity-a747a10eabd12427bf3c4626e6929041aa81fa7c.zip
LibGUI: Refactor context menus to be event-driven instead of declarative.
The declarative approach had way too many limitations. This patch adds a context menu event that can be hooked to prepare a custom context menu on demand just-in-time. :^)
Diffstat (limited to 'LibGUI/GEvent.h')
-rw-r--r--LibGUI/GEvent.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h
index cc0cd8aee2..ecbe51ead3 100644
--- a/LibGUI/GEvent.h
+++ b/LibGUI/GEvent.h
@@ -29,6 +29,7 @@ public:
FocusIn,
FocusOut,
WindowCloseRequest,
+ ContextMenu,
WM_WindowRemoved,
WM_WindowStateChanged,
WM_WindowIconChanged,
@@ -141,6 +142,23 @@ private:
Size m_size;
};
+class GContextMenuEvent final : public GEvent {
+public:
+ explicit GContextMenuEvent(const Point& position, const Point& screen_position)
+ : GEvent(GEvent::ContextMenu)
+ , m_position(position)
+ , m_screen_position(screen_position)
+ {
+ }
+
+ const Point& position() const { return m_position; }
+ const Point& screen_position() const { return m_screen_position; }
+
+private:
+ Point m_position;
+ Point m_screen_position;
+};
+
class GShowEvent final : public GEvent {
public:
GShowEvent()