mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibGUI+WindowServer: Add support for per-GWidget context menus.
You can now simply assign a GMenu as a GWidget's context menu and it will automagically pop up on right click. :^)
This commit is contained in:
parent
8feecf6c77
commit
c06a3bdeb4
12 changed files with 102 additions and 8 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
class GraphicsBitmap;
|
||||
class GLayout;
|
||||
class GMenu;
|
||||
class GWindow;
|
||||
|
||||
enum class SizePolicy { Fixed, Fill };
|
||||
|
@ -41,6 +42,9 @@ public:
|
|||
bool is_enabled() const { return m_enabled; }
|
||||
void set_enabled(bool);
|
||||
|
||||
const GMenu* context_menu() const { return m_context_menu.ptr(); }
|
||||
void set_context_menu(OwnPtr<GMenu>&&);
|
||||
|
||||
virtual void event(CEvent&) override;
|
||||
virtual void paint_event(GPaintEvent&);
|
||||
virtual void resize_event(GResizeEvent&);
|
||||
|
@ -186,4 +190,5 @@ private:
|
|||
bool m_enabled { true };
|
||||
|
||||
CElapsedTimer m_click_clock;
|
||||
OwnPtr<GMenu> m_context_menu;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue