1 /* ScummVM - Graphic Adventure Engine
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.
7 * Additional copyright for this file:
8 * Copyright (C) 1994-1998 Revolution Software Ltd.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #ifndef SWORD2_CONTROL_H
29 #define SWORD2_CONTROL_H
31 #include "sword2/defs.h"
32 #include "sword2/saveload.h"
34 #define MAX_WIDGETS 25
39 class FontRendererGui
;
53 * Base class for all dialogs.
59 Widget
*_widgets
[MAX_WIDGETS
];
66 Dialog(Sword2Engine
*vm
);
69 void registerWidget(Widget
*widget
);
72 virtual void setResult(int result
);
74 virtual int runModal();
76 virtual void onAction(Widget
*widget
, int result
= 0) {}
79 class OptionsDialog
: public Dialog
{
83 Switch
*_objectLabelsSwitch
;
84 Switch
*_subtitlesSwitch
;
85 Switch
*_reverseStereoSwitch
;
87 Switch
*_speechSwitch
;
90 Slider
*_speechSlider
;
95 Button
*_cancelButton
;
100 OptionsDialog(Sword2Engine
*vm
);
103 virtual void paint();
104 virtual void onAction(Widget
*widget
, int result
= 0);
107 class SaveRestoreDialog
: public Dialog
{
109 int _mode
, _selectedSlot
;
110 byte _editBuffer
[SAVE_DESCRIPTION_LEN
];
111 int _editPos
, _firstPos
;
114 FontRendererGui
*_fr1
;
115 FontRendererGui
*_fr2
;
117 Slot
*_slotButton
[8];
118 ScrollButton
*_zupButton
;
119 ScrollButton
*_upButton
;
120 ScrollButton
*_downButton
;
121 ScrollButton
*_zdownButton
;
123 Button
*_cancelButton
;
126 SaveRestoreDialog(Sword2Engine
*vm
, int mode
);
127 ~SaveRestoreDialog();
130 void drawEditBuffer(Slot
*slot
);
132 virtual void onAction(Widget
*widget
, int result
= 0);
133 virtual void paint();
134 virtual void setResult(int result
);
135 virtual int runModal();
139 * A "mini" dialog is usually a yes/no question, but also used for the
140 * restart/restore dialog at the beginning of the game.
143 class MiniDialog
: public Dialog
{
145 uint32 _headerTextId
;
147 uint32 _cancelTextId
;
148 FontRendererGui
*_fr
;
151 Button
*_cancelButton
;
154 MiniDialog(Sword2Engine
*vm
, uint32 headerTextId
, uint32 okTextId
= TEXT_OK
, uint32 cancelTextId
= TEXT_CANCEL
);
155 virtual ~MiniDialog();
156 virtual void paint();
157 virtual void onAction(Widget
*widget
, int result
= 0);
160 class StartDialog
: public MiniDialog
{
162 StartDialog(Sword2Engine
*vm
);
163 virtual int runModal();
166 class RestartDialog
: public MiniDialog
{
168 RestartDialog(Sword2Engine
*vm
);
169 virtual int runModal();
172 class QuitDialog
: public MiniDialog
{
174 QuitDialog(Sword2Engine
*vm
);
175 virtual int runModal();
178 class SaveDialog
: public SaveRestoreDialog
{
180 SaveDialog(Sword2Engine
*vm
) : SaveRestoreDialog(vm
, kSaveDialog
) {}
183 class RestoreDialog
: public SaveRestoreDialog
{
185 RestoreDialog(Sword2Engine
*vm
) : SaveRestoreDialog(vm
, kRestoreDialog
) {}
188 } // End of namespace Sword2