mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 12:27:35 +00:00
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. :^)
This commit is contained in:
parent
e74b5bc054
commit
a747a10eab
5 changed files with 37 additions and 27 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue