ScummVM API documentation
documents_browser.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
23 #define TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
24 
25 #include "common/str.h"
26 #include "tetraedge/game/document.h"
27 #include "tetraedge/te/te_lua_gui.h"
28 
29 namespace Tetraedge {
30 
31 class DocumentsBrowser : public TeLayout {
32 public:
33  struct DocumentData {
34  Common::String _id;
35  Common::String _name;
36  Common::String _description; // seems always empty..
37  };
38 
40 
41  bool addDocument(Document *document);
42  void addDocument(const Common::String &str);
43 
44  void currentPage(int page);
45  int documentCount(const Common::String &str) { // never used?
46  return 1;
47  }
48 
49  Common::String documentDescription(const Common::String &name) const;
50  Common::String documentName(const Common::String &name) const;
51 
52  void enter();
53  void hideDocument();
54  void leave();
55  void load();
56  // void loadFromBackup(TiXmlNode *node);
57  void loadZoomed();
58  // void saveToBackup(TiXmlNode *node);
59 
60  void showDocument(const Common::String &str, int startPage);
61  void unload();
62 
63  Common::Error syncState(Common::Serializer &s);
64 
65  TeLayout &zoomedLayout() { return _zoomedLayout; }
66 
67  TeLuaGUI &gui() { return _gui; }
68 
69 
70 private:
71  void loadXMLFile(const Common::Path &path);
72 
73  bool onDocumentSelected(Document &doc);
74  bool onNextPage();
75  bool onPreviousPage();
76  bool onQuitDocumentDoubleClickTimer();
77  bool onZoomedButton();
78 
79  Common::String zoomedPageName() const;
80 
81  // Sorry, this is how the original does it...
82  bool onShowedDocumentButton0();
83  bool onShowedDocumentButton1();
84  bool onShowedDocumentButton2();
85  bool onShowedDocumentButton3();
86  bool onShowedDocumentButton4();
87  bool onShowedDocumentButton5();
88  bool onShowedDocumentButton6();
89  bool onShowedDocumentButton7();
90  bool onShowedDocumentButton8();
91  bool onShowedDocumentButton9();
92  /*
93  These are defined but unused in any game..
94  bool onShowedDocumentButton10();
95  bool onShowedDocumentButton11();
96  bool onShowedDocumentButton12();
97  bool onShowedDocumentButton13();
98  bool onShowedDocumentButton14();
99  bool onShowedDocumentButton15();
100  bool onShowedDocumentButton16();
101  bool onShowedDocumentButton17();
102  bool onShowedDocumentButton18();
103  bool onShowedDocumentButton19();
104  */
105 
106  TeTimer _timer;
107  TeLayout _zoomedLayout;
108  uint64 _curPage;
109  uint64 _startPage;
110  int _zoomCount;
111  Common::String _curDocName;
112 
113  TeLuaGUI _gui;
114  TeLuaGUI _zoomedDocGui;
115 
117 };
118 
119 } // end namespace Tetraedge
120 
121 #endif // TETRAEDGE_GAME_DOCUMENTS_BROWSER_H
Definition: str.h:59
Definition: detection.h:27
Definition: error.h:84
Definition: te_lua_gui.h:51
Definition: path.h:52
Definition: serializer.h:79
Definition: te_timer.h:33
Definition: hashmap.h:85
Definition: documents_browser.h:33
Definition: te_layout.h:35
Definition: document.h:34
Definition: documents_browser.h:31