1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 07:07:34 +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:
Andreas Kling 2019-04-18 04:12:27 +02:00
parent e74b5bc054
commit a747a10eab
5 changed files with 37 additions and 27 deletions

View file

@ -31,6 +31,7 @@ protected:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void context_menu_event(GContextMenuEvent&) override;
virtual void keydown_event(GKeyEvent&) override;
private:
@ -47,4 +48,5 @@ private:
Rect m_transform_widget_origin_rect;
Point m_next_insertion_position;
Direction m_resize_direction { Direction::None };
OwnPtr<GMenu> m_context_menu;
};