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 */
21
22#ifndef KYRA_GUI_H
23#define KYRA_GUI_H
24
25#include "kyra/kyra_v1.h"
26#include "kyra/graphics/screen.h"
27
28#include "common/ptr.h"
29#include "common/array.h"
30#include "common/func.h"
31
32#include "graphics/surface.h"
33
34namespace Kyra {
35
36#define BUTTON_FUNCTOR(type, x, y) Button::Callback(new Common::Functor1Mem<Button *, int, type>(x, y))
37
38struct Button {
41
42 Button() : nextButton(0), index(0), keyCode(0), keyCode2(0), data0Val1(0), data1Val1(0), data2Val1(0), data3Val1(0), flags(0),
43 data0ShapePtr(0), data1ShapePtr(0), data2ShapePtr(0), data0Callback(), data1Callback(), data2Callback(),
44 dimTableIndex(0), x(0), y(0), width(0), height(0), data0Val2(0), data0Val3(0), data1Val2(0), data1Val3(0),
45 data2Val2(0), data2Val3(0), data3Val2(0), data3Val3(0), flags2(0), mouseWheel(0), buttonCallback(), extButtonDef(0), arg(0) {}
46
47 Button *nextButton;
48 uint16 index;
49
50 uint16 keyCode;
51 uint16 keyCode2;
52
53 byte data0Val1;
54 byte data1Val1;
55 byte data2Val1;
56 byte data3Val1;
57
58 uint16 flags;
59
60 const uint8 *data0ShapePtr;
61 const uint8 *data1ShapePtr;
62 const uint8 *data2ShapePtr;
63 Callback data0Callback;
64 Callback data1Callback;
65 Callback data2Callback;
66
67 uint16 dimTableIndex;
68
69 int16 x, y;
70 uint16 width, height;
71
72 uint8 data0Val2;
73 uint8 data0Val3;
74
75 uint8 data1Val2;
76 uint8 data1Val3;
77
78 uint8 data2Val2;
79 uint8 data2Val3;
80
81 uint8 data3Val2;
82 uint8 data3Val3;
83
84 uint16 flags2;
85
86 int8 mouseWheel;
87
88 Callback buttonCallback;
89
90 const void *extButtonDef;
91
92 uint16 arg;
93};
94
95class Screen;
96class TextDisplayer;
97
98class GUI {
99public:
100 GUI(KyraEngine_v1 *vm);
101 virtual ~GUI();
102
103 // button specific
104 virtual void processButton(Button *button) = 0;
105 virtual int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) = 0;
106
107 // utilities for thumbnail creation
108 virtual void createScreenThumbnail(Graphics::Surface &dst) = 0;
109
110 void notifyUpdateSaveSlotsList() { _saveSlotsListUpdateNeeded = true; }
111
112protected:
113 KyraEngine_v1 *_vm;
114 Screen *_screen;
115
116 // The engine expects a list of contiguous savegame indices.
117 // Since ScummVM's savegame indices aren't, we re-index them.
118 // The integers stored in _saveSlots are ScummVM savegame indices.
119 Common::Array<int> _saveSlots;
120 void updateSaveFileList(Common::String targetName, bool excludeQuickSaves = false);
121 int getNextSavegameSlot();
122 void updateSaveSlotsList(Common::String targetName, bool force = false);
123
124 virtual void sortSaveSlots();
125
126 char **_savegameList;
127 int _savegameListSize;
128 bool _saveSlotsListUpdateNeeded;
129
130 Common::KeyState _keyPressed;
131};
132
133} // End of namespace Kyra
134
135#endif
Definition: str.h:59
Definition: gui.h:98
Definition: kyra_v1.h:126
Definition: screen.h:587
Definition: text.h:32
Definition: detection.h:27
Definition: func.h:437
Definition: keyboard.h:294
Definition: surface.h:67
Definition: gui.h:38