/* * Copyright (c) 2023, Bastiaan van der Plaat * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "MapWidget.h" #include #include #include namespace Maps { class FavoritesPanel final : public GUI::Widget { C_OBJECT(FavoritesPanel) public: struct Favorite { String name; MapWidget::LatLng latlng; int zoom; }; static ErrorOr> create(); void load_favorites(); void reset(); ErrorOr add_favorite(Favorite const& favorite); Function const&)> on_favorites_change; Function on_selected_favorite_change; protected: FavoritesPanel() = default; static ErrorOr> try_create(); ErrorOr setup(); private: ErrorOr edit_favorite(int row); void favorites_changed(); RefPtr m_empty_container; RefPtr m_favorites_list; RefPtr m_context_menu; }; }