blob: 08fc527e59d112f3a9c438f80fc0c6ce91e378d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#pragma once
#include "WSMenu.h"
#include <AK/Vector.h>
#include <AK/Weakable.h>
#include <AK/WeakPtr.h>
class WSMenuBar : public Weakable<WSMenuBar> {
public:
WSMenuBar(WSClientConnection& client, int menubar_id);
~WSMenuBar();
WSClientConnection& client() { return m_client; }
const WSClientConnection& client() const { return m_client; }
int menubar_id() const { return m_menubar_id; }
void add_menu(WSMenu& menu)
{
menu.set_menubar(this);
m_menus.append(&menu);
}
template<typename Callback>
void for_each_menu(Callback callback)
{
for (auto& menu : m_menus) {
if (!callback(*menu))
return;
}
}
private:
WSClientConnection& m_client;
int m_menubar_id { 0 };
Vector<WSMenu*> m_menus;
};
|