ManaPlus
shortcutcontainer.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2007-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef GUI_WIDGETS_SHORTCUTCONTAINER_H
25 #define GUI_WIDGETS_SHORTCUTCONTAINER_H
26 
27 #include "gui/widgets/widget.h"
28 
31 
32 class Image;
33 class ImageCollection;
34 class Skin;
35 
42  public WidgetListener,
43  public MouseListener
44 {
45  public:
47 
48 
51  ~ShortcutContainer() override;
52 
57  void widgetResized(const Event &event) override final;
58 
59  void widgetMoved(const Event& event) override final;
60 
64  void mouseDragged(MouseEvent &event A_UNUSED) override
65  {
66  }
67 
71  void mousePressed(MouseEvent &event A_UNUSED) override
72  {
73  }
74 
78  void mouseReleased(MouseEvent &event A_UNUSED) override
79  {
80  }
81 
83  { return mMaxItems; }
84 
86  { return mBoxWidth; }
87 
89  { return mBoxHeight; }
90 
91  void drawBackground(Graphics *const g) A_NONNULL(2);
92 
93  void safeDrawBackground(Graphics *const g) A_NONNULL(2);
94 
95  virtual void setSkin(const Widget2 *const widget,
96  Skin *const skin);
97 
98  protected:
102  explicit ShortcutContainer(Widget2 *const widget);
103 
111  int getIndexFromGrid(const int pointX,
112  const int pointY) const A_WARN_UNUSED;
113 
116  static float mAlpha;
117 
118  unsigned mMaxItems;
128 };
129 
130 #endif // GUI_WIDGETS_SHORTCUTCONTAINER_H
Definition: event.h:79
void widgetResized(const Event &event)
void mouseReleased(MouseEvent &event)
void mousePressed(MouseEvent &event)
void widgetMoved(const Event &event)
virtual void setSkin(const Widget2 *const widget, Skin *const skin)
ImageCollection * mVertexes
ShortcutContainer(Widget2 *const widget)
int getBoxHeight() const
int getMaxItems() const
void drawBackground(Graphics *const g)
int getBoxWidth() const
void safeDrawBackground(Graphics *const g)
int getIndexFromGrid(const int pointX, const int pointY) const
void mouseDragged(MouseEvent &event)
Definition: skin.h:37
Definition: widget.h:99
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define notfinal
Definition: localconsts.h:261
#define A_NONNULL(...)
Definition: localconsts.h:168
#define noexcept2
Definition: localconsts.h:50
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
#define A_UNUSED
Definition: localconsts.h:160