blob: 285aa8d0673bc9fe31b28a5b7a3496c54eff5543 (
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
|
#pragma once
#include "WSMenu.h"
#include <AK/Vector.h>
#include <AK/Weakable.h>
#include <AK/WeakPtr.h>
class Process;
class WSMenuBar : public Weakable<WSMenuBar> {
public:
WSMenuBar(int menubar_id, Process&);
~WSMenuBar();
int menubar_id() const { return m_menubar_id; }
const Process* process() const { return m_process.ptr(); }
void add_menu(WSMenu* menu) { m_menus.append(menu); }
template<typename Callback>
void for_each_menu(Callback callback)
{
for (auto& menu : m_menus) {
if (!callback(*menu))
return;
}
}
private:
int m_menubar_id { 0 };
WeakPtr<Process> m_process;
Vector<WSMenu*> m_menus;
};
|