ManaPlus
setup_input.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2007 Joshua Langley <[email protected]>
4  * Copyright (C) 2009 The Mana World Development Team
5  * Copyright (C) 2009-2010 The Mana Developers
6  * Copyright (C) 2011-2019 The ManaPlus Developers
7  * Copyright (C) 2019-2021 Andrei Karas
8  *
9  * This file is part of The ManaPlus Client.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef GUI_WIDGETS_TABS_SETUP_INPUT_H
26 #define GUI_WIDGETS_TABS_SETUP_INPUT_H
27 
29 
31 
32 class Button;
33 class ListBox;
34 class KeyListModel;
35 class ScrollArea;
36 class TabStrip;
37 
38 struct SetupActionData;
39 
40 class Setup_Input final : public SetupTab
41 {
42  public:
46  explicit Setup_Input(const Widget2 *const widget);
47 
49 
50 
53  ~Setup_Input() override final;
54 
55  void apply() override final;
56 
57  void cancel() override final;
58 
59  void action(const ActionEvent &event) override final;
60 
64  void refreshAssignedKey(const int index);
65 
69  void newKeyCallback(const InputActionT index);
70 
74  void refreshKeys();
75 
79  void keyUnresolved();
80 
81  int keyToSetupData(const InputActionT index) const A_WARN_UNUSED;
82 
83  std::string keyToString(const InputActionT index) const A_WARN_UNUSED;
84 
85  private:
86  static void fixTranslations();
87 
88  static void fixTranslation(SetupActionData *const actionDatas,
89  const InputActionT actionStart,
90  const InputActionT actionEnd,
91  const std::string &text) A_NONNULL(1);
92 
95 
102  bool mKeySetting;
104 };
105 
106 #endif // GUI_WIDGETS_TABS_SETUP_INPUT_H
Definition: button.h:102
Button * mUnassignKeyButton
Definition: setup_input.h:97
Button * mResetKeysButton
Definition: setup_input.h:99
TabStrip * mTabs
Definition: setup_input.h:100
void action(const ActionEvent &event)
std::string keyToString(const InputActionT index) const
void refreshKeys()
int keyToSetupData(const InputActionT index) const
ScrollArea * mScrollArea
Definition: setup_input.h:101
static void fixTranslation(SetupActionData *const actionDatas, const InputActionT actionStart, const InputActionT actionEnd, const std::string &text)
static void fixTranslations()
ListBox * mKeyList
Definition: setup_input.h:94
bool mKeySetting
Definition: setup_input.h:102
void newKeyCallback(const InputActionT index)
Button * mAssignKeyButton
Definition: setup_input.h:96
KeyListModel * mKeyListModel
Definition: setup_input.h:93
int * mActionDataSize
Definition: setup_input.h:103
Button * mDefaultButton
Definition: setup_input.h:98
void keyUnresolved()
Setup_Input(const Widget2 *const widget)
Definition: setup_input.cpp:61
void refreshAssignedKey(const int index)
InputAction ::T InputActionT
Definition: inputaction.h:717
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULL(...)
Definition: localconsts.h:168
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53