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 
116 class Gui {
117 public:
118  Gui(WageEngine *engine);
119  ~Gui();
120 
121  void draw();
122  void appendText(const char *str);
123  bool processEvent(Common::Event &event);
124 
125  void setSceneDirty() { _sceneDirty = true; }
126  void regenCommandsMenu();
127  void regenWeaponsMenu();
128 
129  void actionCopy();
130  void actionPaste();
131  void actionUndo();
132  void actionClear();
133  void actionCut();
134  void disableUndo();
135  void disableAllMenus();
136  void enableNewGameMenus();
137  void enableSave();
138  void enableRevert();
139 
140  bool processSceneEvents(WindowClick click, Common::Event &event);
141  void executeMenuCommand(int action, Common::String &text);
142 
143  void clearOutput();
144 
145 private:
146  void drawScene();
147  const Graphics::MacFont *getConsoleMacFont();
148  const Graphics::Font *getConsoleFont();
149  const Graphics::Font *getTitleFont();
150 
151  void loadBorders();
152  void loadBorder(Graphics::MacWindow *target, const char *border[], uint height, uint32 flags, int titlePos = 0);
153 
154 public:
155  Graphics::ManagedSurface _screen;
156 
157  WageEngine *_engine;
158 
159  Scene *_scene;
160 
162  Graphics::MacWindow *_sceneWindow;
163  Graphics::MacTextWindow *_consoleWindow;
164 
165 private:
166  Graphics::ManagedSurface _console;
167  Graphics::MacMenu *_menu;
168  bool _sceneDirty;
169 
170  Common::String _undobuffer;
171 
172  int _commandsMenuId;
173  int _weaponsMenuId;
174 };
175 
176 } // End of namespace Wage
177 
178 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: macwindow.h:40
Definition: font.h:82
Definition: macwindow.h:192
Definition: mactextwindow.h:30
Definition: macwindowmanager.h:148
Definition: wage.h:126
Definition: events.h:198
Definition: gui.h:116
Definition: macmenu.h:94
Definition: macfontmanager.h:85
Definition: entities.h:300
Definition: debugger.h:28