ManaPlus
widgetgroup.h
Go to the documentation of this file.
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 
29 
30 #include "localconsts.h"
31 
33  public WidgetListener,
34  public ActionListener
35 {
36  public:
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
Definition: event.h:79
virtual void addWidget(Widget *const widget, const int spacing)
Definition: widgetgroup.cpp:67
virtual void addButton(const std::string &text, const std::string &tag, const bool pressed)
Definition: widgetgroup.cpp:42
std::string mGroup
Definition: widgetgroup.h:64
WidgetGroup(const Widget2 *const widget, const std::string &group, const int height, const int spacing)
Definition: widgetgroup.cpp:26
void clear()
Definition: widgetgroup.cpp:79
virtual Widget * createWidget(const std::string &name, const bool pressed) const =0
void widgetResized(const Event &event)
Definition: widgetgroup.cpp:86
void action(const ActionEvent &event)
Definition: widgetgroup.cpp:58
Definition: widget.h:99
#define restrict
Definition: localconsts.h:165
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define notfinal
Definition: localconsts.h:261
#define A_DELETE_COPY(func)
Definition: localconsts.h:53