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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 /*
24  * Based on
25  * WebVenture (c) 2010, Sean Kasun
26  * https://github.com/mrkite/webventure, http://seancode.com/webventure/
27  *
28  * Used with explicit permission from the author
29  */
30 
31 #ifndef MACVENTURE_WINDOWS_H
32 #define MACVENTURE_WINDOWS_H
33 
34 #include "common/rect.h"
35 #include "common/array.h"
36 
37 namespace MacVenture {
38 // massive HACK
39 typedef uint32 ObjID;
40 
41 enum WindowReference {
42 	kNoWindow = 0,
43 	kInventoryStart = 1,
44 	kCommandsWindow = 0x80,
45 	kMainGameWindow = 0x81,
46 	kOutConsoleWindow = 0x82,
47 	kSelfWindow = 0x83,
48 	kExitsWindow = 0x84,
49 	kDiplomaWindow = 0x85
50 };
51 
52 enum MVWindowType {
53 	kDocument = 0x00,
54 	kDBox = 0x01,
55 	kPlainDBox = 0x02,
56 	kAltBox = 0x03,
57 	kNoGrowDoc = 0x04,
58 	kMovableDBox = 0x05,
59 	kZoomDoc = 0x08,
60 	kZoomNoGrow = 0x0c,
61 	// WebVenture assigns arbitrary kinds post-loading
62 	kInvWindow = 0x0e,
63 	kRDoc16 = 0x10,
64 	kRDoc4 = 0x12,
65 	kRDoc6 = 0x14,
66 	kRDoc10 = 0x16,
67 	kNoType = 0xFF
68 };
69 
70 struct DrawableObject {
71 	ObjID obj;
72 	byte mode;
DrawableObjectDrawableObject73 	DrawableObject(ObjID id, byte md) {
74 		obj = id;
75 		mode = md;
76 	}
77 };
78 
79 enum {
80 	kScrollAmount = 10
81 };
82 
83 struct WindowData {
84 	Common::Rect bounds;
85 	MVWindowType type;
86 	ObjID objRef;
87 	uint16 visible;
88 	uint16 hasCloseBox;
89 	WindowReference refcon;
90 	uint8 titleLength;
91 	Common::String title;
92 	Common::Array<DrawableObject> children;
93 	bool updateScroll;
94 	Common::Point scrollPos;
95 };
96 
97 struct BorderBounds {
98 	uint16 leftOffset;
99 	uint16 topOffset;
100 	uint16 rightOffset;
101 	uint16 bottomOffset;
102 
BorderBoundsBorderBounds103 	BorderBounds(uint16 l, uint16 t, uint16 r, uint16 b) :
104 	leftOffset(l), topOffset(t), rightOffset(r), bottomOffset(b) {}
105 };
106 }
107 #endif
108