ManaPlus
itempopup.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2008 The Legend of Mazzeroth Development Team
4  * Copyright (C) 2008-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_POPUPS_ITEMPOPUP_H
26 #define GUI_POPUPS_ITEMPOPUP_H
27 
29 
31 
32 #include "gui/widgets/popup.h"
33 
34 class Icon;
35 class Item;
36 class ItemInfo;
37 class Label;
38 class TextBox;
39 
40 struct ItemOptionsList;
41 
45 class ItemPopup final : public Popup
46 {
47  public:
51  ItemPopup();
52 
54 
55 
58  ~ItemPopup() override final;
59 
60  void postInit() override final;
61 
65  void setItem(const ItemInfo &item,
66  const ItemColor color,
67  const bool showImage,
68  int id,
69  const int *const cards,
70  const ItemOptionsList *const options);
71 
72  void setItem(const Item *const item,
73  const bool showImage);
74 
75  void mouseMoved(MouseEvent &event) override final;
76 
77  void resetPopup();
78 
79  private:
80  std::string getCardsString(const int *const cards);
81 
82  static std::string getOptionsString(const ItemOptionsList *const
83  options);
84 
93  std::string mLastName;
94  std::string mCardsStr;
95  std::string mItemOptionsStr;
96  int mLastId;
98 
99  void setLabelColor(Label *label,
100  const ItemDbTypeT type) const A_NONNULL(2);
101 };
102 
103 extern ItemPopup *itemPopup;
104 
105 #endif // GUI_POPUPS_ITEMPOPUP_H
Definition: icon.h:41
Icon * mIcon
Definition: itempopup.h:92
void setItem(const ItemInfo &item, const ItemColor color, const bool showImage, int id, const int *const cards, const ItemOptionsList *const options)
Definition: itempopup.cpp:189
std::string mLastName
Definition: itempopup.h:93
TextBox * mItemCards
Definition: itempopup.h:89
Label * mItemName
Definition: itempopup.h:85
static std::string getOptionsString(const ItemOptionsList *const options)
Definition: itempopup.cpp:379
void postInit()
Definition: itempopup.cpp:124
void setLabelColor(Label *label, const ItemDbTypeT type) const
Definition: itempopup.cpp:421
void resetPopup()
Definition: itempopup.cpp:464
ItemDbTypeT mItemType
Definition: itempopup.h:91
TextBox * mItemDesc
Definition: itempopup.h:86
ItemColor mLastColor
Definition: itempopup.h:97
int mLastId
Definition: itempopup.h:96
std::string getCardsString(const int *const cards)
Definition: itempopup.cpp:330
TextBox * mItemWeight
Definition: itempopup.h:88
void mouseMoved(MouseEvent &event)
Definition: itempopup.cpp:455
std::string mCardsStr
Definition: itempopup.h:94
std::string mItemOptionsStr
Definition: itempopup.h:95
TextBox * mItemEffect
Definition: itempopup.h:87
TextBox * mItemOptions
Definition: itempopup.h:90
Definition: item.h:50
Definition: label.h:91
Definition: popup.h:52
uint16_t ItemColor
Definition: itemcolor.h:30
ItemDbType ::T ItemDbTypeT
Definition: itemdbtype.h:49
ItemPopup * itemPopup
Definition: itempopup.cpp:64
#define A_NONNULL(...)
Definition: localconsts.h:168
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53