ScummVM API documentation
ports.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 SCI_GRAPHICS_PORTS_H
23#define SCI_GRAPHICS_PORTS_H
24
25#include "common/serializer.h"
26#include "common/list.h"
27#include "common/array.h"
28
29namespace Sci {
30
31class GfxPaint16;
32class GfxScreen;
33class GfxText16;
34struct WorklistManager;
35
36// window styles
37enum {
38 SCI_WINDOWMGR_STYLE_TRANSPARENT = (1 << 0),
39 SCI_WINDOWMGR_STYLE_NOFRAME = (1 << 1),
40 SCI_WINDOWMGR_STYLE_TITLE = (1 << 2),
41 SCI_WINDOWMGR_STYLE_TOPMOST = (1 << 3),
42 SCI_WINDOWMGR_STYLE_USER = (1 << 7)
43};
44
45typedef Common::List<Port *> PortList;
46typedef Common::Array<Port *> PortArray;
47
53public:
54 GfxPorts(SegManager *segMan, GfxScreen *screen);
55 ~GfxPorts() override;
56
57 void init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *text16);
58 void reset();
59
60 void kernelSetActive(uint16 portId);
61 Common::Rect kernelGetPicWindow(int16 &picTop, int16 &picLeft);
62 void kernelSetPicWindow(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag);
63 reg_t kernelGetActive();
64 reg_t kernelNewWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title);
65 void kernelDisposeWindow(uint16 windowId, bool reanimate);
66
67 void setActiveWindowHasEditText() { _portIdWithEditText = (int16)getPort()->id; }
68
69 int16 isFrontWindow(Window *wnd);
70 void beginUpdate(Window *wnd);
71 void endUpdate(Window *wnd);
72 Window *addWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw);
73 void drawWindow(Window *wnd);
74 void removeWindow(Window *pWnd, bool reanimate);
75 void freeWindow(Window *pWnd);
76 void updateWindow(Window *wnd);
77
78 Port *getPortById(uint16 id);
79
80 Port *setPort(Port *newPort);
81 Port *getPort();
82 void setOrigin(int16 left, int16 top);
83 void moveTo(int16 left, int16 top);
84 void move(int16 left, int16 top);
85 void openPort(Port *port);
86 void penColor(int16 color);
87 void backColor(int16 color);
88 void penMode(int16 mode);
89 void textGreyedOutput(bool state);
90 int16 getPointSize();
91
92 void offsetRect(Common::Rect &r);
93 void offsetLine(Common::Point &start, Common::Point &end);
94 void clipLine(Common::Point &start, Common::Point &end);
95
96 void priorityBandsInit(int16 bandCount, int16 top, int16 bottom);
97 void priorityBandsInit(const SciSpan<const byte> &data);
98 void priorityBandsInitSci11(SciSpan<const byte> data);
99
100 void kernelInitPriorityBands();
101 void kernelGraphAdjustPriority(int top, int bottom);
102 byte kernelCoordinateToPriority(int16 y);
103 int16 kernelPriorityToCoordinate(byte priority);
104 void processEngineHunkList(WorklistManager &wm);
105 void printWindowList(Console *con);
106
107 Port *_wmgrPort;
108 Window *_picWind;
109
110 Port *_menuPort;
111 Common::Rect _menuBarRect;
112 Common::Rect _menuRect;
113 Common::Rect _menuLine;
114 Port *_curPort;
115
116 void saveLoadWithSerializer(Common::Serializer &ser) override;
117
118private:
120 PortList _windowList;
121
123 PortArray _windowsById;
124
125 SegManager *_segMan;
126 GfxPaint16 *_paint16;
127 GfxScreen *_screen;
128 GfxText16 *_text16;
129
130 bool _usesOldGfxFunctions;
131
132 uint16 _styleUser;
133
134 // counts windows that got disposed but are not freed yet
135 uint16 _freeCounter;
136
137 Common::Rect _bounds;
138
139 // Priority Bands related variables
140 int16 _priorityTop, _priorityBottom, _priorityBandCount;
141 byte _priorityBands[200];
142 int16 _portIdWithEditText = -1; // ID of the port that has an edit text field
143};
144
145} // End of namespace Sci
146
147#endif // SCI_GRAPHICS_PORTS_H
Definition: serializer.h:352
Definition: serializer.h:80
Definition: console.h:36
Definition: paint16.h:37
Definition: ports.h:52
Definition: screen.h:70
Definition: text16.h:45
Definition: util.h:251
Definition: seg_manager.h:48
Definition: console.h:28
Definition: rect.h:144
Definition: rect.h:536
Definition: helpers.h:56
Definition: helpers.h:78
Definition: gc.h:57
Definition: vm_types.h:39