mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00

Menus are now tied to a Process (by WeakPtr.) This will allow us to pass notifications to the correct event stream.
28 lines
501 B
C++
28 lines
501 B
C++
#pragma once
|
|
|
|
#include "WSMenu.h"
|
|
#include <AK/Vector.h>
|
|
#include <AK/WeakPtr.h>
|
|
|
|
class Process;
|
|
|
|
class WSMenuBar {
|
|
public:
|
|
explicit WSMenuBar(Process&);
|
|
~WSMenuBar();
|
|
|
|
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:
|
|
WeakPtr<Process> m_process;
|
|
Vector<WSMenu*> m_menus;
|
|
};
|