2008-08-08 14:23:59 +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 02:34:21 +01:00
|
|
|
*
|
2008-08-08 14:23:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REMAP_DIALOG_H
|
|
|
|
#define REMAP_DIALOG_H
|
|
|
|
|
2008-09-30 13:51:01 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
|
|
|
|
#ifdef ENABLE_KEYMAPPER
|
|
|
|
|
2008-08-08 14:23:59 +00:00
|
|
|
#include "gui/dialog.h"
|
|
|
|
|
|
|
|
namespace GUI {
|
2011-04-29 12:58:01 +02:00
|
|
|
class ButtonWidget;
|
|
|
|
class PopUpWidget;
|
2017-08-13 19:04:34 +02:00
|
|
|
class ScrollContainerWidget;
|
2011-04-29 12:58:01 +02:00
|
|
|
class StaticTextWidget;
|
2008-08-08 14:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
|
2017-08-11 15:32:18 +02:00
|
|
|
class Action;
|
|
|
|
class Keymap;
|
|
|
|
class Keymapper;
|
2017-08-13 13:59:00 +02:00
|
|
|
class InputWatcher;
|
2017-08-11 15:32:18 +02:00
|
|
|
|
2008-08-08 14:23:59 +00:00
|
|
|
class RemapDialog : public GUI::Dialog {
|
|
|
|
public:
|
|
|
|
RemapDialog();
|
|
|
|
virtual ~RemapDialog();
|
|
|
|
virtual void open();
|
2008-08-13 19:24:52 +00:00
|
|
|
virtual void close();
|
2008-08-08 14:23:59 +00:00
|
|
|
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
2008-08-13 14:33:17 +00:00
|
|
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
|
|
|
virtual void handleTickle();
|
2008-08-08 14:23:59 +00:00
|
|
|
|
|
|
|
protected:
|
2017-08-13 19:04:34 +02:00
|
|
|
struct ActionRow {
|
|
|
|
Common::Action *action;
|
|
|
|
|
2008-08-08 14:23:59 +00:00
|
|
|
GUI::StaticTextWidget *actionText;
|
|
|
|
GUI::ButtonWidget *keyButton;
|
2011-10-15 15:30:32 -05:00
|
|
|
GUI::ButtonWidget *clearButton;
|
2017-08-13 19:04:34 +02:00
|
|
|
|
|
|
|
ActionRow() : action(nullptr), actionText(nullptr), keyButton(nullptr), clearButton(nullptr) { }
|
2008-08-08 14:23:59 +00:00
|
|
|
};
|
|
|
|
|
2008-08-11 23:08:21 +00:00
|
|
|
void loadKeymap();
|
2008-08-08 14:23:59 +00:00
|
|
|
void refreshKeymap();
|
2017-08-13 19:04:34 +02:00
|
|
|
void clearKeymap();
|
|
|
|
void reflowActionWidgets();
|
2011-10-15 15:30:32 -05:00
|
|
|
void clearMapping(uint i);
|
2008-08-13 11:46:08 +00:00
|
|
|
void startRemapping(uint i);
|
2017-08-13 13:59:00 +02:00
|
|
|
void stopRemapping();
|
2008-08-08 14:23:59 +00:00
|
|
|
|
|
|
|
Keymapper *_keymapper;
|
2017-08-13 16:35:58 +02:00
|
|
|
Common::Array<Keymap *> _keymapTable;
|
2008-08-08 14:23:59 +00:00
|
|
|
|
2017-08-13 13:59:00 +02:00
|
|
|
InputWatcher *_remapInputWatcher;
|
|
|
|
Action *_remapAction;
|
|
|
|
uint32 _remapTimeout;
|
|
|
|
|
2009-06-06 17:52:44 +00:00
|
|
|
GUI::StaticTextWidget *_kmPopUpDesc;
|
2008-08-08 14:23:59 +00:00
|
|
|
GUI::PopUpWidget *_kmPopUp;
|
2017-08-13 19:04:34 +02:00
|
|
|
GUI::ScrollContainerWidget *_scrollContainer;
|
2008-08-11 23:08:21 +00:00
|
|
|
|
2008-08-13 14:33:17 +00:00
|
|
|
static const uint32 kRemapTimeoutDelay = 3000;
|
2008-08-08 14:23:59 +00:00
|
|
|
|
2008-08-13 22:20:18 +00:00
|
|
|
bool _changes;
|
|
|
|
|
2017-08-13 19:04:34 +02:00
|
|
|
Array<ActionRow> _actions;
|
2008-08-08 14:23:59 +00:00
|
|
|
};
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Common
|
2008-08-08 14:23:59 +00:00
|
|
|
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif // #ifdef ENABLE_KEYMAPPER
|
|
|
|
|
|
|
|
#endif // #ifndef REMAP_DIALOG_H
|