ScummVM API documentation
gui.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  * MIT License:
21  *
22  * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
23  *
24  * Permission is hereby granted, free of charge, to any person
25  * obtaining a copy of this software and associated documentation
26  * files (the "Software"), to deal in the Software without
27  * restriction, including without limitation the rights to use,
28  * copy, modify, merge, publish, distribute, sublicense, and/or sell
29  * copies of the Software, and to permit persons to whom the
30  * Software is furnished to do so, subject to the following
31  * conditions:
32  *
33  * The above copyright notice and this permission notice shall be
34  * included in all copies or substantial portions of the Software.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43  * OTHER DEALINGS IN THE SOFTWARE.
44  *
45  */
46 
47 #ifndef WAGE_GUI_H
48 #define WAGE_GUI_H
49 
50 #include "common/str-array.h"
51 #include "graphics/font.h"
52 #include "graphics/managed_surface.h"
53 #include "graphics/macgui/macwindowmanager.h"
54 #include "graphics/macgui/mactextwindow.h"
55 #include "graphics/macgui/macwindow.h"
56 #include "graphics/macgui/mactext.h"
57 #include "graphics/macgui/macmenu.h"
58 #include "graphics/macgui/macwindowborder.h"
59 
60 #include "common/events.h"
61 #include "common/rect.h"
62 
63 #include "common/file.h"
64 #include "graphics/pixelformat.h"
65 #include "image/bmp.h"
66 
67 namespace Wage {
68 
69 using namespace Graphics::MacWindowConstants;
70 
71 class Scene;
72 class WageEngine;
73 
74 enum {
75  kCursorHeight = 12
76 };
77 
78 enum {
79  kFontStyleBold = 1,
80  kFontStyleItalic = 2,
81  kFontStyleUnderline = 4,
82  kFontStyleOutline = 8,
83  kFontStyleShadow = 16,
84  kFontStyleCondensed = 32,
85  kFontStyleExtended = 64
86 };
87 
88 enum {
89  kMenuHighLevel = -1,
90  kMenuAbout = 0,
91  kMenuFile = 1,
92  kMenuEdit = 2,
93  kMenuCommands = 3,
94  kMenuWeapons = 4
95 };
96 
97 enum {
98  kMenuActionAbout,
99  kMenuActionNew,
100  kMenuActionOpen,
101  kMenuActionClose,
102  kMenuActionSave,
103  kMenuActionSaveAs,
104  kMenuActionRevert,
105  kMenuActionQuit,
106 
107  kMenuActionUndo,
108  kMenuActionCut,
109  kMenuActionCopy,
110  kMenuActionPaste,
111  kMenuActionClear,
112 
113  kMenuActionCommand,
114 
115  kMenuActionStartupScreen,
116  kMenuActionStartupSound
117 };
118 
119 enum {
120  kScreenWidth = 512,
121  kScreenHeight = 342
122 };
123 
124 class Gui {
125 public:
126  Gui(WageEngine *engine);
127  ~Gui();
128 
129  void draw();
130  void appendText(const char *str);
131  bool processEvent(Common::Event &event);
132 
133  void setSceneDirty() { _sceneDirty = true; }
134  void regenCommandsMenu();
135  void regenWeaponsMenu();
136 
137  void actionCopy();
138  void actionPaste();
139  void actionUndo();
140  void actionClear();
141  void actionCut();
142  void actionStartupSound();
143  void disableUndo();
144  void disableAllMenus();
145  void enableNewGameMenus();
146  void enableSave();
147  void enableRevert();
148  bool decodeStartupScreen();
149 
150  bool processSceneEvents(WindowClick click, Common::Event &event);
151  bool processConsoleEvents(WindowClick click, Common::Event &event);
152  void executeMenuCommand(int action, Common::String &text);
153 
154  void clearOutput();
155 
156  void gameOver();
157  bool saveDialog();
158  void aboutDialog();
159 
160 private:
161  void drawScene();
162  const Graphics::MacFont *getConsoleMacFont();
163  const Graphics::Font *getConsoleFont();
164  const Graphics::Font *getTitleFont();
165 
166  void loadBorders();
167  void loadBorder(Graphics::MacWindow *target, const char *border[], uint height, uint32 flags, int titlePos = 0);
168 
169 public:
170  Graphics::ManagedSurface _screen;
171 
172  WageEngine *_engine;
173 
174  Scene *_scene;
175 
177  Graphics::MacWindow *_sceneWindow;
178  Graphics::MacTextWindow *_consoleWindow;
179 
180 private:
181  Graphics::ManagedSurface _console;
182  Graphics::MacMenu *_menu;
183  bool _sceneDirty;
184 
185  Common::String _undobuffer;
186 
187  int _commandsMenuId;
188  int _weaponsMenuId;
189 
190  int _selectedMenuItem;
191 };
192 
193 } // End of namespace Wage
194 
195 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: macwindow.h:40
Definition: font.h:83
Definition: macwindow.h:205
Definition: mactextwindow.h:30
Definition: macwindowmanager.h:148
Definition: wage.h:129
Definition: events.h:210
Definition: gui.h:124
Definition: macmenu.h:94
Definition: macfontmanager.h:110
Definition: entities.h:301
Definition: debugger.h:28