summaryrefslogtreecommitdiff
path: root/Servers/WindowServer/WSMenuBar.h
diff options
context:
space:
mode:
Diffstat (limited to 'Servers/WindowServer/WSMenuBar.h')
-rw-r--r--Servers/WindowServer/WSMenuBar.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Servers/WindowServer/WSMenuBar.h b/Servers/WindowServer/WSMenuBar.h
new file mode 100644
index 0000000000..7854795ed5
--- /dev/null
+++ b/Servers/WindowServer/WSMenuBar.h
@@ -0,0 +1,31 @@
+#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) { 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;
+};