SuperTuxKart
addons_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2010-2015 Lucas Baudin, Joerg Henrichs
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (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, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 #ifndef HEADER_ADDONS_SCREEN_HPP
19 #define HEADER_ADDONS_SCREEN_HPP\
20 
21 #include "addons/addons_manager.hpp"
22 #include "guiengine/screen.hpp"
23 #include "guiengine/widgets/label_widget.hpp"
24 #include "states_screens/dialogs/addons_loading.hpp"
25 
26 /* used for the installed/unsinstalled icons*/
27 namespace irr { namespace gui { class STKModifiedSpriteBank; } }
28 
29 namespace GUIEngine { class Widget; }
30 
31 struct DateFilter {
32  core::stringw label;
33  int year;
34  int month;
35  int day;
36 };
37 
43  public GUIEngine::ScreenSingleton<AddonsScreen>,
45 {
47 private:
48  AddonsScreen();
49  AddonsLoading *m_load;
50  void loadInformations();
59 
60  irr::gui::STKModifiedSpriteBank
61  *m_icon_bank;
63  *m_update_status;
64 
66  std::string m_type;
67 
71 
72  float m_icon_height;
73 
74  bool m_reloading;
75 
76  bool m_sort_desc;
77 
79  std::vector<DateFilter> m_date_filters;
80 
81 public:
82 
84  void loadList();
85 
87  virtual void loadedFromFile() OVERRIDE;
88 
89  virtual void unloaded() OVERRIDE;
90 
92  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
93  const int playerID) OVERRIDE;
94 
96  virtual void beforeAddingWidget() OVERRIDE;
97 
98  virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE;
99 
100  virtual void init() OVERRIDE;
101  virtual void tearDown() OVERRIDE;
102 
104  virtual void onUpdate(float dt) OVERRIDE;
105 
106  void setLastSelected();
107 
108 };
109 
110 #endif
std::string m_type
Currently selected type.
Definition: addons_screen.hpp:66
virtual void init() OVERRIDE
Callback invoked when entering this menu (after the widgets have been added).
Definition: addons_screen.cpp:142
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual void onUpdate(float dt) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: addons_screen.cpp:503
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: addons_screen.cpp:101
int m_icon_not_installed
Icon for is not installed yet.
Definition: addons_screen.hpp:56
virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE
Definition: addons_screen.cpp:401
Addons screen.
Definition: addons_screen.hpp:42
int m_icon_loading
Icon for 'loading'.
Definition: addons_screen.hpp:58
Definition: addons_screen.hpp:31
Definition: addons_loading.hpp:34
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: addons_screen.cpp:419
std::vector< DateFilter > m_date_filters
List of date filters.
Definition: addons_screen.hpp:79
Definition: list_widget.hpp:36
A simple label widget.
Definition: label_widget.hpp:35
void setLastSelected()
Selects the last selected item on the list (which is the item that is just being installed) again.
Definition: addons_screen.cpp:490
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual void tearDown() OVERRIDE
Callback invoked before leaving this menu.
Definition: addons_screen.cpp:198
int m_selected_index
The currently selected index, used to re-select this item after addons_loading is being displayed.
Definition: addons_screen.hpp:70
virtual void unloaded() OVERRIDE
Callback invoked when this screen is being unloaded.
Definition: addons_screen.cpp:190
int m_icon_installed
Icon for installed addons, no update available.
Definition: addons_screen.hpp:54
void loadList()
Load the addons into the main list.
Definition: addons_screen.cpp:206
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: addons_screen.cpp:70
int m_icon_needs_update
Icon for installed addon, which can be updated.
Definition: addons_screen.hpp:52