mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
Plumb menu item activation events from WindowServer to clients.
GMenu now has an "on_item_activation" callback that fires whenever one of its items are activated. The menu item identifier is used to distinguish between items. Use this to implement font switching in Terminal. :^)
This commit is contained in:
parent
9c1c885483
commit
db98327bdc
10 changed files with 93 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GMenuItem.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
class GMenu {
|
||||
|
@ -8,9 +9,13 @@ public:
|
|||
explicit GMenu(const String& name);
|
||||
~GMenu();
|
||||
|
||||
static GMenu* from_menu_id(int);
|
||||
|
||||
void add_item(unsigned identifier, const String& text);
|
||||
void add_separator();
|
||||
|
||||
Function<void(unsigned)> on_item_activation;
|
||||
|
||||
private:
|
||||
friend class GMenuBar;
|
||||
int menu_id() const { return m_menu_id; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue