0x47 stub
[scummvm-innocent.git] / engines / sword2 / controls.h
blob043330c1782f0cc803c1f9aa8b02b62fee6589bb
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.
24 * $URL$
25 * $Id$
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
36 namespace Sword2 {
38 class Sword2Engine;
39 class FontRendererGui;
40 class Widget;
41 class Switch;
42 class Slider;
43 class Button;
44 class ScrollButton;
45 class Slot;
47 enum {
48 kSaveDialog,
49 kRestoreDialog
52 /**
53 * Base class for all dialogs.
56 class Dialog {
57 private:
58 int _numWidgets;
59 Widget *_widgets[MAX_WIDGETS];
60 bool _finish;
61 int _result;
63 public:
64 Sword2Engine *_vm;
66 Dialog(Sword2Engine *vm);
67 virtual ~Dialog();
69 void registerWidget(Widget *widget);
71 virtual void paint();
72 virtual void setResult(int result);
74 virtual int runModal();
76 virtual void onAction(Widget *widget, int result = 0) {}
79 class OptionsDialog : public Dialog {
80 private:
81 FontRendererGui *_fr;
82 Widget *_panel;
83 Switch *_objectLabelsSwitch;
84 Switch *_subtitlesSwitch;
85 Switch *_reverseStereoSwitch;
86 Switch *_musicSwitch;
87 Switch *_speechSwitch;
88 Switch *_fxSwitch;
89 Slider *_musicSlider;
90 Slider *_speechSlider;
91 Slider *_fxSlider;
92 Slider *_gfxSlider;
93 Widget *_gfxPreview;
94 Button *_okButton;
95 Button *_cancelButton;
97 Audio::Mixer *_mixer;
99 public:
100 OptionsDialog(Sword2Engine *vm);
101 ~OptionsDialog();
103 virtual void paint();
104 virtual void onAction(Widget *widget, int result = 0);
107 class SaveRestoreDialog : public Dialog {
108 private:
109 int _mode, _selectedSlot;
110 byte _editBuffer[SAVE_DESCRIPTION_LEN];
111 int _editPos, _firstPos;
112 int _cursorTick;
114 FontRendererGui *_fr1;
115 FontRendererGui *_fr2;
116 Widget *_panel;
117 Slot *_slotButton[8];
118 ScrollButton *_zupButton;
119 ScrollButton *_upButton;
120 ScrollButton *_downButton;
121 ScrollButton *_zdownButton;
122 Button *_okButton;
123 Button *_cancelButton;
125 public:
126 SaveRestoreDialog(Sword2Engine *vm, int mode);
127 ~SaveRestoreDialog();
129 void updateSlots();
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 {
144 private:
145 uint32 _headerTextId;
146 uint32 _okTextId;
147 uint32 _cancelTextId;
148 FontRendererGui *_fr;
149 Widget *_panel;
150 Button *_okButton;
151 Button *_cancelButton;
153 public:
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 {
161 public:
162 StartDialog(Sword2Engine *vm);
163 virtual int runModal();
166 class RestartDialog : public MiniDialog {
167 public:
168 RestartDialog(Sword2Engine *vm);
169 virtual int runModal();
172 class QuitDialog : public MiniDialog {
173 public:
174 QuitDialog(Sword2Engine *vm);
175 virtual int runModal();
178 class SaveDialog : public SaveRestoreDialog {
179 public:
180 SaveDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kSaveDialog) {}
183 class RestoreDialog : public SaveRestoreDialog {
184 public:
185 RestoreDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kRestoreDialog) {}
188 } // End of namespace Sword2
190 #endif