#pragma once #include "WSMenu.h" #include #include #include class WSMenuBar : public Weakable { 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) { menu.set_menubar(this); m_menus.append(&menu); } template 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 m_menus; };