addon_browse_menu.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SuperTux
  2. // Copyright (C) 2022 Vankata453
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_SUPERTUX_MENU_ADDON_BROWSE_MENU_HPP
  17. #define HEADER_SUPERTUX_SUPERTUX_MENU_ADDON_BROWSE_MENU_HPP
  18. #include "gui/menu.hpp"
  19. class Addon;
  20. class AddonManager;
  21. class AddonBrowseMenu final : public Menu
  22. {
  23. private:
  24. enum {
  25. MNID_PREV_PAGE = 1,
  26. MNID_NEXT_PAGE = 2,
  27. MNID_CHECK_ONLINE = 3,
  28. MNID_ADDON_LIST_START = 4,
  29. };
  30. private:
  31. AddonManager& m_addon_manager;
  32. std::vector<std::string> m_repository_addons;
  33. const bool m_langpacks_only;
  34. const bool m_auto_install_langpack;
  35. int m_browse_page;
  36. const int m_max_addons_on_page;
  37. public:
  38. AddonBrowseMenu(bool langpacks_only, bool auto_install_langpack);
  39. ~AddonBrowseMenu() override;
  40. void refresh() override;
  41. void rebuild_menu();
  42. void check_online();
  43. void menu_action(MenuItem& item) override;
  44. private:
  45. AddonBrowseMenu(const AddonBrowseMenu&) = delete;
  46. AddonBrowseMenu& operator=(const AddonBrowseMenu&) = delete;
  47. };
  48. #endif
  49. /* EOF */