aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/dropdown2.h
blob: 51be377bebc1e739d485e6a0df616427ada8b5ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

/*
 * This code is based on the original source code of Lord Avalot d'Argent version 1.3.
 * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
 */

/* DROPDOWN	A customised version of Oopmenu (qv). */

#ifndef DROPDOWN2_H
#define DROPDOWN2_H

#include "avalanche/color.h"

#include "common/scummsys.h"
#include "common/str.h"

namespace Avalanche {
class AvalancheEngine;

class Dropdown;

typedef void (Dropdown::*func)();

class headtype {
public:
	Common::String title;
	char trigger, alttrigger;
	byte position;
	int16 xpos, xright;
	func do_setup, do_choose;

	headtype *init(char trig, char alttrig, Common::String name, byte p, func dw, func dc, Dropdown *dr);
	void display();
	void highlight();
	bool extdparse(char c);

private:
	Dropdown *_dr;
};



struct optiontype {
	Common::String title;
	char trigger;
	Common::String shortcut;
	bool valid;
};

class onemenu {
public:
	optiontype oo[12];
	byte number;
	int16 width, left;
	bool firstlix;
	int16 flx1, flx2, fly;
	byte oldy; /* used by Lightup */
	bool menunow; /* Is there a menu now? */
	byte menunum; /* And if so, which is it? */
	byte choicenum; /* Your choice? */
	byte highlightnum;

	onemenu *init(Dropdown *dr);
	void start_afresh();
	void opt(Common::String n, char tr, Common::String key, bool val);
	void display();
	void wipe();
	void lightup();
	void displayopt(byte y, bool highlit);
	void movehighlight(int8 add);
	void select(byte n);
	void keystroke(char c);

private:
	Dropdown *_dr;
};



class menuset {
public:
	headtype ddms[8];
	byte howmany;

	menuset *menuset::init(Dropdown *dr);
	void create(char t, Common::String n, char alttrig, func dw, func dc);
	void update();
	void extd(char c);
	void getcertain(byte fv);
	void getmenu(int16 x);

private:
	Dropdown *_dr;
};



class Dropdown {
public:
	friend headtype;
	friend onemenu;
	friend menuset;

	onemenu ddm_o;
	menuset ddm_m;

	Common::String people;



	Dropdown(AvalancheEngine *vm);

	void find_what_you_can_do_with_it();

	void parsekey(char r, char re);

	void menu_link(); /* DDM menu-bar funcs */

	void standard_bar();

private:
	

	



	AvalancheEngine *_vm;

	static const int16 indent = 5;
	static const int16 spacing = 10;

	/* menu_b = blue; { Morpheus }
	 menu_f = yellow;
	 menu_border = black;
	 highlight_b = lightblue;
	 highlight_f = yellow;
	 disabled = lightgray; */

	static const int16 menu_b = lightgray; /* Windowsy */
	static const int16 menu_f = black;
	static const int16 menu_border = black;
	static const int16 highlight_b = black;
	static const int16 highlight_f = white;
	static const int16 disabled = darkgray;



	char r;
	byte fv;



	void chalk(int16 x, int16 y, char t, Common::String z, bool valid);

	void hlchalk(int16 x, int16 y, char t, Common::String z, bool valid);

	void bleep();


	

	void ddm__game();
	void ddm__file();
	void ddm__action();
	void ddm__people();
	void ddm__objects();
	void ddm__with();

	Common::String himher(char x);

	void do__game();
	void do__file();
	void do__action();
	void do__objects();
	void do__people();
	void do__with();

	void checkclick();
};

} // End of namespace Avalanche.

#endif // DROPDOWN2_H