mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
9624b54703
I'm still feeling this out, but I am starting to like the general idea.
32 lines
594 B
C++
32 lines
594 B
C++
#pragma once
|
|
|
|
#include <LibGUI/GMenuItem.h>
|
|
#include <AK/Function.h>
|
|
#include <AK/Vector.h>
|
|
|
|
class GAction;
|
|
|
|
class GMenu {
|
|
public:
|
|
explicit GMenu(const String& name);
|
|
~GMenu();
|
|
|
|
static GMenu* from_menu_id(int);
|
|
|
|
GAction* action_at(int);
|
|
|
|
void add_action(RetainPtr<GAction>&&);
|
|
void add_separator();
|
|
|
|
Function<void(unsigned)> on_item_activation;
|
|
|
|
private:
|
|
friend class GMenuBar;
|
|
int menu_id() const { return m_menu_id; }
|
|
int realize_menu();
|
|
void unrealize_menu();
|
|
|
|
int m_menu_id { 0 };
|
|
String m_name;
|
|
Vector<OwnPtr<GMenuItem>> m_items;
|
|
};
|