ManaPlus
setupquickitem.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-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 GUI_WIDGETS_SETUPQUICKITEM_H
23 #define GUI_WIDGETS_SETUPQUICKITEM_H
24 
25 #include "gui/widgets/setupitem.h"
26 
28 
29 class Button;
30 class HorizontContainer;
31 class Label;
32 class SetupTabScroll;
33 
34 typedef std::string (*ModifierGetFuncPtr)();
35 typedef void (*ModifierChangeFuncPtr)(const bool forward);
36 
39 {
40  public:
41  SetupQuickItem(const std::string &restrict description,
42  SetupTabScroll *restrict const parent,
43  const std::string &restrict eventName,
44  ModifierGetFuncPtr getFunc,
45  ModifierChangeFuncPtr changeFunc);
46 
48 
49  ~SetupQuickItem() override final;
50 
51  void createControls();
52 
53  void fromWidget() override final;
54 
55  void toWidget() override final;
56 
57  void action(const ActionEvent &event) override final;
58 
59  void apply(const std::string &eventName) override final;
60 
61  void cancel(const std::string &eventName A_UNUSED) override final;
62 
63  void externalUpdated(const std::string &eventName A_UNUSED)
64  override final;
65 
66  void rereadValue() override final;
67 
68  void save() override final;
69 
70  void gameModifiersChanged() override final;
71 
72  protected:
78 };
79 
80 #endif // GUI_WIDGETS_SETUPQUICKITEM_H
Definition: button.h:102
Definition: label.h:91
void externalUpdated(const std::string &eventName)
ModifierGetFuncPtr mGetFunc
HorizontContainer * mHorizont
ModifierChangeFuncPtr mChangeFunc
Button * mButton
void action(const ActionEvent &event)
void apply(const std::string &eventName)
void gameModifiersChanged()
void cancel(const std::string &eventName)
SetupQuickItem(const std::string &description, SetupTabScroll *const parent, const std::string &eventName, ModifierGetFuncPtr getFunc, ModifierChangeFuncPtr changeFunc)
#define restrict
Definition: localconsts.h:165
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
#define A_UNUSED
Definition: localconsts.h:160
std::string(* ModifierGetFuncPtr)()
void(* ModifierChangeFuncPtr)(const bool forward)