1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00
serenity/WindowServer/WSMenuBar.h
Andreas Kling 15b4c9f9f1 WindowServer: More work on the menu system.
Menus are now tied to a Process (by WeakPtr.) This will allow us to pass
notifications to the correct event stream.
2019-02-12 08:39:19 +01:00

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;
};