1 #pragma once
2 #ifndef ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H
3 #define ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H
4 
5 #include "renderers/Renderer.h"
6 #include "FileData.h"
7 #include "GuiComponent.h"
8 
9 class ThemeData;
10 class Window;
11 
12 // This is an interface that defines the minimum for a GameListView.
13 class IGameListView : public GuiComponent
14 {
15 public:
IGameListView(Window * window,FileData * root)16 	IGameListView(Window* window, FileData* root) : GuiComponent(window), mRoot(root)
17 		{ setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); }
18 
~IGameListView()19 	virtual ~IGameListView() {}
20 
21 	// Called when a new file is added, a file is removed, a file's metadata changes, or a file's children are sorted.
22 	// NOTE: FILE_SORTED is only reported for the topmost FileData, where the sort started.
23 	//       Since sorts are recursive, that FileData's children probably changed too.
24 	virtual void onFileChanged(FileData* file, FileChangeType change) = 0;
25 
26 	// Called whenever the theme changes.
27 	virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) = 0;
28 
29 	void setTheme(const std::shared_ptr<ThemeData>& theme);
getTheme()30 	inline const std::shared_ptr<ThemeData>& getTheme() const { return mTheme; }
31 
32 	virtual FileData* getCursor() = 0;
33 	virtual void setCursor(FileData*) = 0;
34 
35 	virtual bool input(InputConfig* config, Input input) override;
36 	virtual void remove(FileData* game, bool deleteFile) = 0;
37 
38 	virtual const char* getName() const = 0;
39 	virtual void launch(FileData* game) = 0;
40 
41 	virtual HelpStyle getHelpStyle() override;
42 
43 	void render(const Transform4x4f& parentTrans) override;
44 protected:
45 	FileData* mRoot;
46 	std::shared_ptr<ThemeData> mTheme;
47 };
48 
49 #endif // ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H
50