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_TEXTPOPUP_H |
26 |
|
|
#define GUI_POPUPS_TEXTPOPUP_H |
27 |
|
|
|
28 |
|
|
#include "gui/widgets/popup.h" |
29 |
|
|
|
30 |
|
|
class Label; |
31 |
|
|
|
32 |
|
|
const int TEXTPOPUPCOUNT = 3; |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* A popup that displays information about an item. |
36 |
|
|
*/ |
37 |
|
|
class TextPopup final : public Popup |
38 |
|
|
{ |
39 |
|
|
public: |
40 |
|
|
/** |
41 |
|
|
* Constructor. Initializes the item popup. |
42 |
|
|
*/ |
43 |
|
|
TextPopup(); |
44 |
|
|
|
45 |
|
|
A_DELETE_COPY(TextPopup) |
46 |
|
|
|
47 |
|
|
/** |
48 |
|
|
* Destructor. Cleans up the item popup on deletion. |
49 |
|
|
*/ |
50 |
|
|
~TextPopup() override final; |
51 |
|
|
|
52 |
|
|
void postInit() override final; |
53 |
|
|
|
54 |
|
|
/** |
55 |
|
|
* Sets the text to be displayed. |
56 |
|
|
*/ |
57 |
|
|
void show(const int x, const int y, const std::string &str1) |
58 |
|
|
{ |
59 |
|
|
show(x, y, str1, static_cast<const char*>(""), |
60 |
|
|
static_cast<const char*>("")); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
/** |
64 |
|
|
* Sets the text to be displayed. |
65 |
|
|
*/ |
66 |
|
|
void show(const int x, const int y, const std::string &str1, |
67 |
|
|
const std::string &str2) |
68 |
|
|
{ show(x, y, str1, str2, static_cast<const char*>("")); } |
69 |
|
|
|
70 |
|
|
/** |
71 |
|
|
* Sets the text to be displayed. |
72 |
|
|
*/ |
73 |
|
|
void show(const int x, const int y, const std::string &str1, |
74 |
|
|
const std::string &str2, const std::string &str3); |
75 |
|
|
|
76 |
|
|
void mouseMoved(MouseEvent &event) override final; |
77 |
|
|
|
78 |
|
|
private: |
79 |
|
|
Label *mText[TEXTPOPUPCOUNT]; |
80 |
|
|
}; |
81 |
|
|
|
82 |
|
|
extern TextPopup *textPopup; |
83 |
|
|
|
84 |
|
|
#endif // GUI_POPUPS_TEXTPOPUP_H |