2012-06-14 01:33:50 +00:00
|
|
|
/* 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.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2012-06-14 01:33:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUI_SAVELOAD_DIALOG_H
|
|
|
|
#define GUI_SAVELOAD_DIALOG_H
|
|
|
|
|
|
|
|
#include "gui/dialog.h"
|
|
|
|
#include "gui/widgets/list.h"
|
|
|
|
|
|
|
|
#include "engines/metaengine.h"
|
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
2012-07-01 14:07:48 +00:00
|
|
|
#define kSwitchSaveLoadDialog -2
|
2012-06-29 13:52:56 +00:00
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
// TODO: We might want to disable the grid based save/load chooser for more
|
|
|
|
// platforms, than those which define DISABLE_FANCY_THEMES. But those are
|
|
|
|
// probably not able to handle the grid chooser anyway, so disabling it
|
|
|
|
// for them is a good start.
|
|
|
|
#ifdef DISABLE_FANCY_THEMES
|
|
|
|
#define DISABLE_SAVELOADCHOOSER_GRID
|
|
|
|
#endif // DISABLE_FANCY_THEMES
|
|
|
|
|
|
|
|
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 13:58:42 +00:00
|
|
|
enum SaveLoadChooserType {
|
|
|
|
kSaveLoadDialogList = 0,
|
|
|
|
kSaveLoadDialogGrid = 1
|
|
|
|
};
|
|
|
|
|
2012-07-13 15:17:58 +00:00
|
|
|
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine);
|
2012-07-24 21:46:54 +00:00
|
|
|
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 14:07:48 +00:00
|
|
|
|
2012-06-14 01:33:50 +00:00
|
|
|
class SaveLoadChooserDialog : protected Dialog {
|
|
|
|
public:
|
2012-06-29 13:52:56 +00:00
|
|
|
SaveLoadChooserDialog(const Common::String &dialogName, const bool saveMode);
|
|
|
|
SaveLoadChooserDialog(int x, int y, int w, int h, const bool saveMode);
|
2012-06-14 01:33:50 +00:00
|
|
|
|
|
|
|
virtual void open();
|
|
|
|
|
2012-06-29 13:52:56 +00:00
|
|
|
virtual void reflowLayout();
|
|
|
|
|
2012-07-24 21:27:59 +00:00
|
|
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
2012-06-29 13:52:56 +00:00
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 13:58:42 +00:00
|
|
|
virtual SaveLoadChooserType getType() const = 0;
|
2012-07-24 21:46:54 +00:00
|
|
|
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 13:58:42 +00:00
|
|
|
|
2012-06-14 01:33:50 +00:00
|
|
|
int run(const Common::String &target, const MetaEngine *metaEngine);
|
|
|
|
virtual const Common::String &getResultString() const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int runIntern() = 0;
|
|
|
|
|
2012-06-29 13:52:56 +00:00
|
|
|
const bool _saveMode;
|
2012-06-14 01:33:50 +00:00
|
|
|
const MetaEngine *_metaEngine;
|
|
|
|
bool _delSupport;
|
|
|
|
bool _metaInfoSupport;
|
|
|
|
bool _thumbnailSupport;
|
|
|
|
bool _saveDateSupport;
|
|
|
|
bool _playTimeSupport;
|
|
|
|
Common::String _target;
|
2012-06-29 13:52:56 +00:00
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-24 21:27:59 +00:00
|
|
|
ButtonWidget *_listButton;
|
|
|
|
ButtonWidget *_gridButton;
|
2012-06-29 13:52:56 +00:00
|
|
|
|
|
|
|
void addChooserButtons();
|
2012-07-24 21:27:59 +00:00
|
|
|
ButtonWidget *createSwitchButton(const Common::String &name, const char *desc, const char *tooltip, const char *image, uint32 cmd = 0);
|
2012-07-24 21:46:54 +00:00
|
|
|
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
2012-06-14 01:33:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SaveLoadChooserSimple : public SaveLoadChooserDialog {
|
|
|
|
typedef Common::String String;
|
|
|
|
typedef Common::Array<Common::String> StringArray;
|
|
|
|
public:
|
|
|
|
SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode);
|
|
|
|
|
2012-07-24 21:27:59 +00:00
|
|
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
2012-06-14 01:33:50 +00:00
|
|
|
|
|
|
|
virtual const Common::String &getResultString() const;
|
|
|
|
|
|
|
|
virtual void reflowLayout();
|
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 13:58:42 +00:00
|
|
|
virtual SaveLoadChooserType getType() const { return kSaveLoadDialogList; }
|
2012-07-24 21:46:54 +00:00
|
|
|
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-01 13:58:42 +00:00
|
|
|
|
2012-09-26 00:45:34 +00:00
|
|
|
virtual void open();
|
2012-06-14 01:33:50 +00:00
|
|
|
virtual void close();
|
|
|
|
private:
|
|
|
|
virtual int runIntern();
|
|
|
|
|
2012-07-24 21:27:59 +00:00
|
|
|
ListWidget *_list;
|
|
|
|
ButtonWidget *_chooseButton;
|
|
|
|
ButtonWidget *_deleteButton;
|
|
|
|
GraphicsWidget *_gfxWidget;
|
|
|
|
ContainerWidget *_container;
|
|
|
|
StaticTextWidget *_date;
|
|
|
|
StaticTextWidget *_time;
|
|
|
|
StaticTextWidget *_playtime;
|
2012-06-14 01:33:50 +00:00
|
|
|
|
|
|
|
SaveStateList _saveList;
|
|
|
|
String _resultString;
|
|
|
|
|
|
|
|
void updateSaveList();
|
|
|
|
void updateSelection(bool redraw);
|
|
|
|
};
|
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
2012-07-13 15:17:58 +00:00
|
|
|
|
|
|
|
class EditTextWidget;
|
|
|
|
|
|
|
|
class SavenameDialog : public Dialog {
|
|
|
|
public:
|
|
|
|
SavenameDialog();
|
|
|
|
|
|
|
|
void setDescription(const Common::String &desc);
|
|
|
|
const Common::String &getDescription();
|
|
|
|
|
|
|
|
void setTargetSlot(int slot) { _targetSlot = slot; }
|
|
|
|
|
|
|
|
virtual void open();
|
|
|
|
protected:
|
2012-07-24 21:27:59 +00:00
|
|
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
2012-07-13 15:17:58 +00:00
|
|
|
private:
|
|
|
|
int _targetSlot;
|
|
|
|
StaticTextWidget *_title;
|
|
|
|
EditTextWidget *_description;
|
|
|
|
};
|
|
|
|
|
2012-07-24 21:24:17 +00:00
|
|
|
class SaveLoadChooserGrid : public SaveLoadChooserDialog {
|
2012-06-15 20:39:57 +00:00
|
|
|
public:
|
2012-07-24 21:24:17 +00:00
|
|
|
SaveLoadChooserGrid(const Common::String &title, bool saveMode);
|
|
|
|
~SaveLoadChooserGrid();
|
2012-06-15 20:39:57 +00:00
|
|
|
|
|
|
|
virtual const Common::String &getResultString() const;
|
|
|
|
|
|
|
|
virtual void open();
|
|
|
|
|
|
|
|
virtual void reflowLayout();
|
|
|
|
|
2012-07-01 13:58:42 +00:00
|
|
|
virtual SaveLoadChooserType getType() const { return kSaveLoadDialogGrid; }
|
|
|
|
|
2012-06-15 20:39:57 +00:00
|
|
|
virtual void close();
|
|
|
|
protected:
|
2012-07-24 21:27:59 +00:00
|
|
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
2012-06-15 20:39:57 +00:00
|
|
|
virtual void handleMouseWheel(int x, int y, int direction);
|
|
|
|
private:
|
|
|
|
virtual int runIntern();
|
|
|
|
|
|
|
|
uint _columns, _lines;
|
|
|
|
uint _entriesPerPage;
|
|
|
|
uint _curPage;
|
|
|
|
SaveStateList _saveList;
|
|
|
|
|
2012-07-24 21:27:59 +00:00
|
|
|
ButtonWidget *_nextButton;
|
|
|
|
ButtonWidget *_prevButton;
|
2012-06-15 20:39:57 +00:00
|
|
|
|
2012-07-24 21:27:59 +00:00
|
|
|
StaticTextWidget *_pageDisplay;
|
2012-07-01 14:47:40 +00:00
|
|
|
|
2012-07-13 15:17:58 +00:00
|
|
|
ContainerWidget *_newSaveContainer;
|
|
|
|
int _nextFreeSaveSlot;
|
|
|
|
Common::String _resultString;
|
|
|
|
|
|
|
|
SavenameDialog _savenameDialog;
|
|
|
|
bool selectDescription();
|
|
|
|
|
2012-06-15 20:39:57 +00:00
|
|
|
struct SlotButton {
|
|
|
|
SlotButton() : container(0), button(0), description(0) {}
|
|
|
|
SlotButton(ContainerWidget *c, PicButtonWidget *b, StaticTextWidget *d) : container(c), button(b), description(d) {}
|
|
|
|
|
|
|
|
ContainerWidget *container;
|
|
|
|
PicButtonWidget *button;
|
|
|
|
StaticTextWidget *description;
|
|
|
|
|
|
|
|
void setVisible(bool state) {
|
|
|
|
container->setVisible(state);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
typedef Common::Array<SlotButton> ButtonArray;
|
|
|
|
ButtonArray _buttons;
|
|
|
|
void destroyButtons();
|
|
|
|
void hideButtons();
|
|
|
|
void updateSaves();
|
|
|
|
};
|
|
|
|
|
2012-07-24 21:46:54 +00:00
|
|
|
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
|
|
|
|
2012-06-14 01:33:50 +00:00
|
|
|
} // End of namespace GUI
|
|
|
|
|
|
|
|
#endif
|