opuntiaOS - an operating system targeting x86 and ARMv7
at master 1.3 kB view raw
1/* 2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors. 3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com> 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9#include <libfoundation/EventLoop.h> 10#include <libg/Point.h> 11#include <libipc/VectorEncoder.h> 12#include <libui/App.h> 13#include <libui/PopupMenu.h> 14 15namespace UI { 16 17void PopupMenu::show(LG::Point<int> point, const Menu& menu) 18{ 19 m_menu = menu; 20 auto& connection = App::the().connection(); 21 22 std::vector<LIPC::StringEncoder> tmp; 23 for (auto& item : m_menu.items()) { 24 tmp.push_back(item.title()); 25 } 26 27 auto resp_message = connection.send_sync_message<PopupShowMenuMessageReply>(PopupShowMenuMessage(connection.key(), m_host_window_id, point, LIPC::VectorEncoder<LIPC::StringEncoder>(std::move(tmp)))); 28} 29 30void PopupMenu::show(LG::Point<int> point, Menu&& menu) 31{ 32 m_menu = std::move(menu); 33 auto& connection = App::the().connection(); 34 35 std::vector<LIPC::StringEncoder> tmp; 36 for (auto& item : m_menu.items()) { 37 tmp.push_back(item.title()); 38 } 39 40 auto resp_message = connection.send_sync_message<PopupShowMenuMessageReply>(PopupShowMenuMessage(connection.key(), m_host_window_id, point, LIPC::VectorEncoder<LIPC::StringEncoder>(std::move(tmp)))); 41} 42 43} // namespace UI