1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2012-2019 The ManaPlus Developers |
4 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
5 |
|
|
* |
6 |
|
|
* This file is part of The ManaPlus Client. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#ifndef EVENTS_INPUTEVENT_H |
23 |
|
|
#define EVENTS_INPUTEVENT_H |
24 |
|
|
|
25 |
|
|
#include "enums/input/inputaction.h" |
26 |
|
|
|
27 |
|
|
#include "utils/vector.h" |
28 |
|
|
|
29 |
|
|
#include <map> |
30 |
|
|
#include <string> |
31 |
|
|
|
32 |
|
|
#include "localconsts.h" |
33 |
|
|
|
34 |
|
|
class ChatTab; |
35 |
|
|
|
36 |
|
|
typedef STD_VECTOR<InputActionT> KeysVector; |
37 |
|
|
typedef KeysVector::iterator KeysVectorIter; |
38 |
|
|
typedef KeysVector::const_iterator KeysVectorCIter; |
39 |
|
|
|
40 |
|
|
typedef std::map<int, KeysVector> KeyToActionMap; |
41 |
|
|
typedef KeyToActionMap::iterator KeyToActionMapIter; |
42 |
|
|
|
43 |
|
|
typedef std::map<int, InputActionT> KeyToIdMap; |
44 |
|
|
typedef KeyToIdMap::iterator KeyToIdMapIter; |
45 |
|
|
|
46 |
|
|
typedef std::map<int, int> KeyTimeMap; |
47 |
|
|
typedef KeyTimeMap::iterator KeyTimeMapIter; |
48 |
|
|
|
49 |
|
|
struct InputEvent final |
50 |
|
|
{ |
51 |
|
|
InputEvent(const InputActionT action0, |
52 |
|
|
const int mask0) : |
53 |
|
|
args(), |
54 |
|
|
tab(nullptr), |
55 |
|
|
action(action0), |
56 |
|
|
mask(mask0) |
57 |
|
|
{ } |
58 |
|
|
|
59 |
|
|
InputEvent(const std::string &args0, |
60 |
|
|
ChatTab *const tab0, |
61 |
|
|
const int mask0) : |
62 |
|
|
args(args0), |
63 |
|
|
tab(tab0), |
64 |
|
|
action(InputAction::NO_VALUE), |
65 |
|
|
mask(mask0) |
66 |
|
|
{ } |
67 |
|
|
|
68 |
|
|
A_DELETE_COPY(InputEvent) |
69 |
|
|
|
70 |
|
|
const std::string args; |
71 |
|
|
ChatTab *const tab; |
72 |
|
|
const InputActionT action; |
73 |
|
|
const int mask; |
74 |
|
|
}; |
75 |
|
|
|
76 |
|
|
#endif // EVENTS_INPUTEVENT_H |