/* * Copyright (c) 2023, Bastiaan van der Plaat * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "FavoritesModel.h" #include namespace Maps { class FavoritesPanel final : public GUI::Widget { C_OBJECT(FavoritesPanel) public: static ErrorOr> try_create(); ErrorOr initialize(); void load_favorites(); void reset(); void add_favorite(Favorite favorite); void delete_favorite(Favorite const& favorite); Function const&)> on_favorites_change; Function on_selected_favorite_change; protected: FavoritesPanel() = default; private: ErrorOr edit_favorite(GUI::ModelIndex const& index); void favorites_changed(); RefPtr m_empty_container; RefPtr m_favorites_list; RefPtr m_model; RefPtr m_context_menu; }; }