Merge pull request #90 from gizmo98/patch-2
[libretro-ppsspp.git] / UI / MainScreen.h
blob6ef9018a1485729e1997c05fbe101f2714ddcbd3
1 // Copyright (c) 2013- PPSSPP Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0 or later versions.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official git repository and contact information can be found at
16 // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
18 #pragma once
20 #include "base/functional.h"
21 #include "file/path.h"
22 #include "ui/ui_screen.h"
23 #include "ui/viewgroup.h"
24 #include "UI/MiscScreens.h"
26 class GameBrowser : public UI::LinearLayout {
27 public:
28 GameBrowser(std::string path, bool allowBrowsing, bool *gridStyle_, std::string lastText, std::string lastLink, int flags = 0, UI::LayoutParams *layoutParams = 0);
30 UI::Event OnChoice;
31 UI::Event OnHoldChoice;
32 UI::Event OnHighlight;
34 UI::Choice *HomebrewStoreButton() { return homebrewStoreButton_; }
36 private:
37 void Refresh();
38 bool IsCurrentPathPinned();
39 const std::vector<std::string> GetPinnedPaths();
40 const std::string GetBaseName(const std::string &path);
42 UI::EventReturn GameButtonClick(UI::EventParams &e);
43 UI::EventReturn GameButtonHoldClick(UI::EventParams &e);
44 UI::EventReturn GameButtonHighlight(UI::EventParams &e);
45 UI::EventReturn NavigateClick(UI::EventParams &e);
46 UI::EventReturn LayoutChange(UI::EventParams &e);
47 UI::EventReturn LastClick(UI::EventParams &e);
48 UI::EventReturn HomeClick(UI::EventParams &e);
49 UI::EventReturn PinToggleClick(UI::EventParams &e);
51 UI::ViewGroup *gameList_;
52 PathBrowser path_;
53 bool *gridStyle_;
54 bool allowBrowsing_;
55 std::string lastText_;
56 std::string lastLink_;
57 int flags_;
58 UI::Choice *homebrewStoreButton_;
61 class MainScreen : public UIScreenWithBackground {
62 public:
63 MainScreen();
64 ~MainScreen();
66 virtual bool isTopLevel() const { return true; }
68 // Horrible hack to show the demos & homebrew tab after having installed a game from a zip file.
69 static bool showHomebrewTab;
71 protected:
72 virtual void CreateViews();
73 virtual void DrawBackground(UIContext &dc);
74 virtual void update(InputState &input);
75 virtual void sendMessage(const char *message, const char *value);
76 virtual void dialogFinished(const Screen *dialog, DialogResult result);
78 private:
79 bool DrawBackgroundFor(UIContext &dc, const std::string &gamePath, float progress);
81 UI::EventReturn OnGameSelected(UI::EventParams &e);
82 UI::EventReturn OnGameSelectedInstant(UI::EventParams &e);
83 UI::EventReturn OnGameHighlight(UI::EventParams &e);
84 // Event handlers
85 UI::EventReturn OnLoadFile(UI::EventParams &e);
86 UI::EventReturn OnGameSettings(UI::EventParams &e);
87 UI::EventReturn OnRecentChange(UI::EventParams &e);
88 UI::EventReturn OnCredits(UI::EventParams &e);
89 UI::EventReturn OnSupport(UI::EventParams &e);
90 UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
91 UI::EventReturn OnForums(UI::EventParams &e);
92 UI::EventReturn OnExit(UI::EventParams &e);
93 UI::EventReturn OnDownloadUpgrade(UI::EventParams &e);
94 UI::EventReturn OnDismissUpgrade(UI::EventParams &e);
95 UI::EventReturn OnHomebrewStore(UI::EventParams &e);
97 UI::LinearLayout *upgradeBar_;
98 UI::TabHolder *tabHolder_;
100 std::string highlightedGamePath_;
101 std::string prevHighlightedGamePath_;
102 float highlightProgress_;
103 float prevHighlightProgress_;
104 bool backFromStore_;
105 bool lockBackgroundAudio_;
106 bool lastVertical_;
108 bool UseVerticalLayout() const;
111 class UmdReplaceScreen : public UIDialogScreenWithBackground {
112 public:
113 UmdReplaceScreen() {}
115 protected:
116 virtual void CreateViews();
117 virtual void update(InputState &input);
118 //virtual void sendMessage(const char *message, const char *value);
120 private:
121 UI::EventReturn OnGameSelected(UI::EventParams &e);
122 UI::EventReturn OnGameSelectedInstant(UI::EventParams &e);
124 UI::EventReturn OnCancel(UI::EventParams &e);
125 UI::EventReturn OnGameSettings(UI::EventParams &e);