1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2004-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 |
|
|
#include "gui/popupmanager.h" |
25 |
|
|
|
26 |
|
|
#include "sdlshared.h" |
27 |
|
|
|
28 |
|
|
#ifndef DYECMD |
29 |
|
|
#include "gui/popups/beingpopup.h" |
30 |
|
|
#include "gui/popups/itempopup.h" |
31 |
|
|
#include "gui/popups/popupmenu.h" |
32 |
|
|
#endif // DYECMD |
33 |
|
|
#include "gui/popups/textpopup.h" |
34 |
|
|
|
35 |
|
|
#include "debug.h" |
36 |
|
|
|
37 |
|
|
PopupManager *popupManager = nullptr; |
38 |
|
|
|
39 |
|
|
PopupManager::PopupManager() |
40 |
|
|
{ |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
PopupManager::~PopupManager() |
44 |
|
|
{ |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
void PopupManager::closePopupMenu() |
48 |
|
|
{ |
49 |
|
|
#ifndef DYECMD |
50 |
|
|
if (popupMenu != nullptr) |
51 |
|
|
popupMenu->handleLink("cancel", nullptr); |
52 |
|
|
#endif // DYECMD |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
void PopupManager::hideBeingPopup() |
56 |
|
|
{ |
57 |
|
|
#ifndef DYECMD |
58 |
|
|
if (beingPopup != nullptr) |
59 |
|
|
beingPopup->setVisible(Visible_false); |
60 |
|
|
#endif // DYECMD |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
void PopupManager::hideTextPopup() |
64 |
|
|
{ |
65 |
|
|
if (textPopup != nullptr) |
66 |
|
|
textPopup->setVisible(Visible_false); |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
void PopupManager::hidePopupMenu() |
70 |
|
|
{ |
71 |
|
|
#ifndef DYECMD |
72 |
|
|
if (popupMenu != nullptr) |
73 |
|
|
popupMenu->setVisible(Visible_false); |
74 |
|
|
#endif // DYECMD |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
void PopupManager::hideItemPopup() |
78 |
|
|
{ |
79 |
|
|
#ifndef DYECMD |
80 |
|
|
if (itemPopup != nullptr) |
81 |
|
|
itemPopup->hide(); |
82 |
|
|
#endif // DYECMD |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
bool PopupManager::isPopupMenuVisible() |
86 |
|
|
{ |
87 |
|
|
#ifndef DYECMD |
88 |
|
|
return popupMenu != nullptr ? popupMenu->isPopupVisible() : false; |
89 |
|
|
#else |
90 |
|
|
return false; |
91 |
|
|
#endif // DYECMD |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
void PopupManager::clearPopup() |
95 |
|
|
{ |
96 |
|
|
#ifndef DYECMD |
97 |
|
|
if (popupMenu != nullptr) |
98 |
|
|
popupMenu->clear(); |
99 |
|
|
#endif // DYECMD |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
bool PopupManager::isTextPopupVisible() |
103 |
|
|
{ |
104 |
|
|
return textPopup != nullptr ? textPopup->isPopupVisible() : false; |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
bool PopupManager::isBeingPopupVisible() |
108 |
|
|
{ |
109 |
|
|
#ifndef DYECMD |
110 |
|
|
return beingPopup != nullptr ? beingPopup->isPopupVisible() : false; |
111 |
|
|
#else // DYECMD |
112 |
|
|
return false; |
113 |
|
|
#endif // DYECMD |
114 |
|
|
} |