supertux
addon_browse_menu.hpp
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 
17 #ifndef HEADER_SUPERTUX_SUPERTUX_MENU_ADDON_BROWSE_MENU_HPP
18 #define HEADER_SUPERTUX_SUPERTUX_MENU_ADDON_BROWSE_MENU_HPP
19 
20 #include "gui/menu.hpp"
21 
22 class Addon;
23 class AddonManager;
24 
25 class AddonBrowseMenu final : public Menu
26 {
27 private:
28  enum {
29  MNID_PREV_PAGE = 1,
30  MNID_NEXT_PAGE = 2,
31  MNID_CHECK_ONLINE = 3,
32  MNID_ADDON_LIST_START = 4,
33  };
34 
35 private:
36  AddonManager& m_addon_manager;
37  std::vector<std::string> m_repository_addons;
38  const bool m_langpacks_only;
39  const bool m_auto_install_langpack;
40  int m_browse_page;
41  const int m_max_addons_on_page;
42 
43 public:
44  AddonBrowseMenu(bool langpacks_only, bool auto_install_langpack);
45  ~AddonBrowseMenu() override;
46 
47  void refresh() override;
48  void rebuild_menu();
49  void check_online();
50  void menu_action(MenuItem& item) override;
51 
52 private:
53  AddonBrowseMenu(const AddonBrowseMenu&) = delete;
54  AddonBrowseMenu& operator=(const AddonBrowseMenu&) = delete;
55 };
56 
57 #endif
58 
59 /* EOF */
Definition: addon_browse_menu.hpp:25
void refresh() override
Perform actions to bring the menu up to date with configuration changes.
Definition: addon_browse_menu.cpp:59
Definition: menu_item.hpp:23
Checks for, installs and removes Add-ons.
Definition: addon_manager.hpp:36
Definition: addon.hpp:27
Definition: menu.hpp:55