scummvm/backends/keymapper/remap-dialog.h

100 lines
2.5 KiB
C
Raw Normal View History

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