2005-01-17 10:57:15 +00:00
|
|
|
/* Copyright (C) 1994-1998 Revolution Software Ltd.
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
2006-02-09 15:12:44 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-07-28 01:44:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CONTROL_S
|
|
|
|
#define _CONTROL_S
|
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
#include "sword2/defs.h"
|
|
|
|
|
|
|
|
#define MAX_WIDGETS 25
|
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
namespace Sword2 {
|
|
|
|
|
2003-11-08 15:47:51 +00:00
|
|
|
class Sword2Engine;
|
2005-02-20 15:38:48 +00:00
|
|
|
class FontRendererGui;
|
|
|
|
class Widget;
|
|
|
|
class Switch;
|
|
|
|
class Slider;
|
|
|
|
class Button;
|
|
|
|
class ScrollButton;
|
|
|
|
class Slot;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kSaveDialog,
|
2005-02-21 08:16:50 +00:00
|
|
|
kRestoreDialog
|
2005-02-20 15:38:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for all dialogs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Dialog {
|
|
|
|
private:
|
|
|
|
int _numWidgets;
|
|
|
|
Widget *_widgets[MAX_WIDGETS];
|
|
|
|
bool _finish;
|
|
|
|
int _result;
|
2003-11-08 15:47:51 +00:00
|
|
|
|
2003-10-03 06:54:44 +00:00
|
|
|
public:
|
2003-11-16 14:18:29 +00:00
|
|
|
Sword2Engine *_vm;
|
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
Dialog(Sword2Engine *vm);
|
|
|
|
virtual ~Dialog();
|
|
|
|
|
|
|
|
void registerWidget(Widget *widget);
|
|
|
|
|
|
|
|
virtual void paint();
|
|
|
|
virtual void setResult(int result);
|
|
|
|
|
|
|
|
virtual int runModal();
|
|
|
|
|
|
|
|
virtual void onAction(Widget *widget, int result = 0) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class OptionsDialog : public Dialog {
|
|
|
|
private:
|
|
|
|
FontRendererGui *_fr;
|
|
|
|
Widget *_panel;
|
|
|
|
Switch *_objectLabelsSwitch;
|
|
|
|
Switch *_subtitlesSwitch;
|
|
|
|
Switch *_reverseStereoSwitch;
|
|
|
|
Switch *_musicSwitch;
|
|
|
|
Switch *_speechSwitch;
|
|
|
|
Switch *_fxSwitch;
|
|
|
|
Slider *_musicSlider;
|
|
|
|
Slider *_speechSlider;
|
|
|
|
Slider *_fxSlider;
|
|
|
|
Slider *_gfxSlider;
|
|
|
|
Widget *_gfxPreview;
|
|
|
|
Button *_okButton;
|
|
|
|
Button *_cancelButton;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2005-02-20 15:38:48 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
OptionsDialog(Sword2Engine *vm);
|
|
|
|
~OptionsDialog();
|
|
|
|
|
|
|
|
virtual void paint();
|
|
|
|
virtual void onAction(Widget *widget, int result = 0);
|
|
|
|
};
|
|
|
|
|
2005-02-21 08:16:50 +00:00
|
|
|
class SaveRestoreDialog : public Dialog {
|
2005-02-20 15:38:48 +00:00
|
|
|
private:
|
|
|
|
int _mode, _selectedSlot;
|
|
|
|
byte _editBuffer[SAVE_DESCRIPTION_LEN];
|
|
|
|
int _editPos, _firstPos;
|
|
|
|
int _cursorTick;
|
|
|
|
|
|
|
|
FontRendererGui *_fr1;
|
|
|
|
FontRendererGui *_fr2;
|
|
|
|
Widget *_panel;
|
|
|
|
Slot *_slotButton[8];
|
|
|
|
ScrollButton *_zupButton;
|
|
|
|
ScrollButton *_upButton;
|
|
|
|
ScrollButton *_downButton;
|
|
|
|
ScrollButton *_zdownButton;
|
|
|
|
Button *_okButton;
|
|
|
|
Button *_cancelButton;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
public:
|
2005-02-21 08:16:50 +00:00
|
|
|
SaveRestoreDialog(Sword2Engine *vm, int mode);
|
|
|
|
~SaveRestoreDialog();
|
2003-10-03 06:54:44 +00:00
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
void updateSlots();
|
|
|
|
void drawEditBuffer(Slot *slot);
|
|
|
|
|
|
|
|
virtual void onAction(Widget *widget, int result = 0);
|
|
|
|
virtual void paint();
|
|
|
|
virtual void setResult(int result);
|
|
|
|
virtual int runModal();
|
|
|
|
};
|
2003-10-03 06:54:44 +00:00
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
/**
|
|
|
|
* A "mini" dialog is usually a yes/no question, but also used for the
|
|
|
|
* restart/restore dialog at the beginning of the game.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class MiniDialog : public Dialog {
|
|
|
|
private:
|
|
|
|
uint32 _headerTextId;
|
|
|
|
uint32 _okTextId;
|
|
|
|
uint32 _cancelTextId;
|
|
|
|
FontRendererGui *_fr;
|
|
|
|
Widget *_panel;
|
|
|
|
Button *_okButton;
|
|
|
|
Button *_cancelButton;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MiniDialog(Sword2Engine *vm, uint32 headerTextId, uint32 okTextId = TEXT_OK, uint32 cancelTextId = TEXT_CANCEL);
|
|
|
|
virtual ~MiniDialog();
|
|
|
|
virtual void paint();
|
|
|
|
virtual void onAction(Widget *widget, int result = 0);
|
2003-10-03 06:54:44 +00:00
|
|
|
};
|
|
|
|
|
2005-02-20 15:38:48 +00:00
|
|
|
class StartDialog : public MiniDialog {
|
|
|
|
public:
|
|
|
|
StartDialog(Sword2Engine *vm);
|
|
|
|
virtual int runModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
class RestartDialog : public MiniDialog {
|
|
|
|
public:
|
|
|
|
RestartDialog(Sword2Engine *vm);
|
|
|
|
virtual int runModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
class QuitDialog : public MiniDialog {
|
|
|
|
public:
|
|
|
|
QuitDialog(Sword2Engine *vm);
|
|
|
|
virtual int runModal();
|
|
|
|
};
|
2005-02-21 08:16:50 +00:00
|
|
|
|
|
|
|
class SaveDialog : public SaveRestoreDialog {
|
|
|
|
public:
|
|
|
|
SaveDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kSaveDialog) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class RestoreDialog : public SaveRestoreDialog {
|
|
|
|
public:
|
|
|
|
RestoreDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kRestoreDialog) {}
|
|
|
|
};
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
} // End of namespace Sword2
|
|
|
|
|
2003-07-28 01:44:38 +00:00
|
|
|
#endif
|