mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
39 lines
739 B
C++
39 lines
739 B
C++
#pragma once
|
|
|
|
#include <AK/Function.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibGUI/GMenuItem.h>
|
|
|
|
class GAction;
|
|
class Point;
|
|
|
|
class GMenu {
|
|
public:
|
|
explicit GMenu(const StringView& name);
|
|
~GMenu();
|
|
|
|
static GMenu* from_menu_id(int);
|
|
|
|
GAction* action_at(int);
|
|
|
|
void add_action(NonnullRefPtr<GAction>);
|
|
void add_separator();
|
|
|
|
void popup(const Point& screen_position);
|
|
void dismiss();
|
|
|
|
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 { -1 };
|
|
String m_name;
|
|
Vector<OwnPtr<GMenuItem>> m_items;
|
|
};
|