2019-02-11 09:47:10 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "WSMenu.h"
|
|
|
|
#include <AK/Vector.h>
|
2019-02-12 08:39:19 +01:00
|
|
|
#include <AK/WeakPtr.h>
|
|
|
|
|
|
|
|
class Process;
|
2019-02-11 09:47:10 +01:00
|
|
|
|
|
|
|
class WSMenuBar {
|
|
|
|
public:
|
2019-02-12 08:39:19 +01:00
|
|
|
explicit WSMenuBar(Process&);
|
2019-02-11 09:47:10 +01:00
|
|
|
~WSMenuBar();
|
|
|
|
|
2019-02-12 00:52:19 +01:00
|
|
|
void add_menu(WSMenu* menu) { m_menus.append(menu); }
|
2019-02-11 09:47:10 +01:00
|
|
|
|
|
|
|
template<typename Callback>
|
|
|
|
void for_each_menu(Callback callback)
|
|
|
|
{
|
|
|
|
for (auto& menu : m_menus) {
|
|
|
|
if (!callback(*menu))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2019-02-12 08:39:19 +01:00
|
|
|
WeakPtr<Process> m_process;
|
2019-02-12 00:52:19 +01:00
|
|
|
Vector<WSMenu*> m_menus;
|
2019-02-11 09:47:10 +01:00
|
|
|
};
|