/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, sin-ack * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "Menu.h" #include #include #include namespace WindowServer { class Menubar { public: void add_menu(Menu& menu, Gfx::IntRect window_rect) { // FIXME: Check against duplicate menu additions. m_menus.append(menu); layout_menu(menu, window_rect); } bool has_menus() { return !m_menus.is_empty(); } void for_each_menu(Function callback) { for (auto& menu : m_menus) { if (callback(menu) == IterationDecision::Break) return; } } private: void layout_menu(Menu&, Gfx::IntRect window_rect); Vector m_menus; // FIXME: This doesn't support removing menus from a menubar or inserting a // menu in the middle. Gfx::IntPoint m_next_menu_location { 0, 0 }; }; }