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 GUI_WIDGETS_WIDGETGROUP_H
23 #define GUI_WIDGETS_WIDGETGROUP_H
24 
25 #include "gui/widgets/container.h"
26 
27 #include "listeners/actionlistener.h"
28 #include "listeners/widgetlistener.h"
29 
30 #include "localconsts.h"
31 
32 class WidgetGroup notfinal : public Container,
33                              public WidgetListener,
34                              public ActionListener
35 {
36     public:
37         A_DELETE_COPY(WidgetGroup)
38 
39         virtual void addButton(const std::string &restrict text,
40                                const std::string &restrict tag,
41                                const bool pressed);
42 
43         void action(const ActionEvent &event) override;
44 
45         virtual void addWidget(Widget *const widget,
46                                const int spacing);
47 
48         void clear() override final;
49 
50         void widgetResized(const Event &event) override final;
51 
52         virtual Widget *createWidget(const std::string &name,
53                                      const bool pressed)
54                                      const A_WARN_UNUSED = 0;
55 
56     protected:
57         WidgetGroup(const Widget2 *const widget,
58                     const std::string &group,
59                     const int height,
60                     const int spacing);
61 
62         int mSpacing;
63         int mCount;
64         std::string mGroup;
65 
66     private:
67         int mLastX;
68 };
69 
70 #endif  // GUI_WIDGETS_WIDGETGROUP_H
71