ManaPlus
popupmenu.h
Go to the documentation of this file.
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 #ifndef GUI_POPUPS_POPUPMENU_H
25 #define GUI_POPUPS_POPUPMENU_H
26 
27 #ifndef DYECMD
28 
30 
31 #include "enums/inventorytype.h"
32 
34 
38 
40 #include "gui/widgets/popup.h"
41 
44 
45 #include "localconsts.h"
46 
47 class ActorSprite;
48 class Being;
49 class Button;
50 class ChatTab;
51 class FloorItem;
52 class Item;
53 class ListModel;
54 class MapItem;
55 class ProgressBar;
56 class ScrollArea;
57 class StaticBrowserBox;
58 class TextCommand;
59 class TextDialog;
60 class TextField;
61 class Window;
62 
63 struct GroupInfo;
64 struct SkillInfo;
65 
69 class PopupMenu final : public Popup, public LinkHandler
70 {
71  public:
75  PopupMenu();
76 
78 
79  void postInit() override final;
80 
84  void showPopup(const int x, const int y, const Being *const being);
85 
89  void showPopup(const int x, const int y,
90  const STD_VECTOR<ActorSprite*> &beings);
91 
92  void showPlayerPopup(const std::string &nick);
93 
98  void showPopup(const int x, const int y,
99  const FloorItem *const floorItem);
100 
105  void showPopup(Window *const parent,
106  const int x, const int y,
107  const Item *const item,
108  const InventoryTypeT type);
109 
110  void showPopup(const int x, const int y, Button *const button);
111 
112  void showPopup(const int x, const int y, const ProgressBar *const bar);
113 
114  void showPopup(const int x, const int y, MapItem *const mapItem);
115 
116  void showItemPopup(const int x,
117  const int y,
118  const Item *const item);
119 
120  void showItemPopup(const int x, const int y,
121  const int itemId,
122  const ItemColor color);
123 
124  void showDropPopup(const int x,
125  const int y,
126  const Item *const item);
127 
128  void showOutfitsWindowPopup(const int x, const int y);
129 
130  void showSpellPopup(const int x, const int y, TextCommand *const cmd);
131 
132  void showAttackMonsterPopup(const int x, const int y,
133  const std::string &name,
134  const int type);
135 
136  void showPickupItemPopup(const int x, const int y,
137  const std::string &name);
138 
139  void showUndressPopup(const int x, const int y,
140  const Being *const being,
141  const Item *const item);
142 
143  void showMapPopup(const int x, const int y,
144  const int x2, const int y2,
145  const bool isMinimap);
146 
151  void showChatPopup(const int x, const int y, ChatTab *const tab);
152 
153  void showChangePos(const int x, const int y);
154 
155  void showPopup(const int x, const int y, ListModel *const model);
156 
157  void showTextFieldPopup(TextField *const input);
158 
159  void showLinkPopup(const std::string &link);
160 
161  void showWindowsPopup();
162 
163  void showNpcDialogPopup(const BeingId npcId,
164  const int x, const int y);
165 
166  void showWindowPopup(Window *const window);
167 
168  void showSkillPopup(const SkillInfo *const info);
169 
170  void showSkillLevelPopup(const SkillInfo *const info);
171 
172  void showSkillTypePopup(const SkillInfo *const info);
173 
174  void showSkillOffsetPopup(const SkillInfo *const info,
175  const bool isOffsetX);
176 
177  void showCraftPopup();
178 
179  void showEmoteType();
180 
181  void showPartyPopup();
182 
183  void showGuildPopup();
184 
185  void showAttackPopup();
186 
187  void showNavigationPopup();
188 
189  void showPickupPopup();
190 
191  void showPlayersPopup();
192 
193  void showFriendsPopup();
194 
198  void handleLink(const std::string &link,
199  MouseEvent *event A_UNUSED) override final;
200 
201  void clear() override final;
202 
203  void moveUp();
204 
205  void moveDown();
206 
207  void select();
208 
209  private:
210  void initPopup();
211 
212  bool isAllowCommand(const ServerCommandTypeT command);
213 
214  bool isAllowOtherCommand(const ServerCommandTypeT command);
215 
216  void setMousePos();
217 
218  void setMousePos2();
219 
220  void addPlayerRelation(const std::string &name);
221 
222  void addFollow();
223 
224  void addBuySell(const Being *const being) A_NONNULL(2);
225 
226  void addParty(const std::string &nick);
227 
228  void addPartyName(const std::string &partyName);
229 
230  void addBuySellDefault();
231 
232  void addPlayerMisc();
233 
234  void addPickupFilter(const std::string &name);
235 
236  void addProtection();
237 
238  void addUse(const Item *const item) A_NONNULL(2);
239 
240  void addItemMenu(const Item *const item,
241  const InventoryTypeT type) A_NONNULL(2);
242 
243  void addDrop(const Item *const item,
244  const bool isProtected) A_NONNULL(2);
245 
246  void addGmCommands();
247 
248  void showMuteCommands();
249 
250  void showPlayerMenu();
251 
253 
254  void showItemGMCommands();
255 
256  void addNormalRelations();
257 
258  void addWindowMenu(const Window *const window);
259 
260  void showHomunGMCommands();
261 
262  void showPetGMCommands();
263 
265 
266  void addChat(const Being *const being);
267 
268  void addMailCommands();
269 
270  void addCatchPetCommands();
271 
272  void showGMPopup(const std::string &name);
273 
274  void showPlayerGMCommands(const std::string &name);
275 
276  void showNpcGMCommands();
277 
278  void showMonsterGMCommands();
279 
280  void showAdoptCommands();
281 
282  void addSocialMenu();
283 
284  bool addBeingMenu();
285 
288 
291  int mItemId;
304  std::string mName;
305  std::string mExtName;
309  int mX;
310  int mY;
312 
316  void showPopup(int x, int y);
317 };
318 
319 extern PopupMenu *popupMenu;
320 
321 #endif // DYE_CMD
322 #endif // GUI_POPUPS_POPUPMENU_H
ActorType ::T ActorTypeT
Definition: actortype.h:43
int BeingId
Definition: beingid.h:30
int BeingTypeId
Definition: beingtypeid.h:30
#define maxCards
Definition: cards.h:25
Definition: being.h:96
Definition: button.h:102
Definition: item.h:50
void showSpellPopup(const int x, const int y, TextCommand *const cmd)
Definition: popupmenu.cpp:887
void showMapPopup(const int x, const int y, const int x2, const int y2, const bool isMinimap)
Definition: popupmenu.cpp:805
void addBuySell(const Being *const being)
Definition: popupmenu.cpp:2593
int mItemCards[4]
Definition: popupmenu.h:293
void addBuySellDefault()
Definition: popupmenu.cpp:2627
const GroupInfo * mGroup
Definition: popupmenu.h:303
void addUse(const Item *const item)
Definition: popupmenu.cpp:2798
ActorTypeT mType
Definition: popupmenu.h:307
void showAttackPopup()
Definition: popupmenu.cpp:3570
void addPickupFilter(const std::string &name)
Definition: popupmenu.cpp:2717
StaticBrowserBox * mBrowserBox
Definition: popupmenu.h:286
void showPickupPopup()
Definition: popupmenu.cpp:3590
std::string mName
Definition: popupmenu.h:304
MapItem * mMapItem
Definition: popupmenu.h:295
void showPlayersPopup()
Definition: popupmenu.cpp:3600
void addPlayerMisc()
Definition: popupmenu.cpp:2705
TextCommand * mSpell
Definition: popupmenu.h:297
std::string mExtName
Definition: popupmenu.h:305
void showMonsterGMCommands()
Definition: popupmenu.cpp:3277
void showAdoptCommands()
Definition: popupmenu.cpp:3499
void showAttackMonsterPopup(const int x, const int y, const std::string &name, const int type)
Definition: popupmenu.cpp:2018
ChatTab * mTab
Definition: popupmenu.h:296
ScrollArea * mScrollArea
Definition: popupmenu.h:287
void postInit()
Definition: popupmenu.cpp:146
void showTextFieldPopup(TextField *const input)
Definition: popupmenu.cpp:2172
BeingTypeId mSubType
Definition: popupmenu.h:308
void showSkillTypePopup(const SkillInfo *const info)
Definition: popupmenu.cpp:2394
void showItemGMCommands()
Definition: popupmenu.cpp:3355
void addMailCommands()
Definition: popupmenu.cpp:3480
void initPopup()
Definition: popupmenu.cpp:152
void showFriendsPopup()
Definition: popupmenu.cpp:3610
bool isAllowCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:160
void showMercenaryGMCommands()
Definition: popupmenu.cpp:3456
void addPartyName(const std::string &partyName)
Definition: popupmenu.cpp:2641
void addFollow()
Definition: popupmenu.cpp:2581
void showNpcDialogPopup(const BeingId npcId, const int x, const int y)
Definition: popupmenu.cpp:2244
Button * mButton
Definition: popupmenu.h:302
RenameListener mRenameListener
Definition: popupmenu.h:299
void showHomunGMCommands()
Definition: popupmenu.cpp:3448
void showPartyPopup()
Definition: popupmenu.cpp:3546
void addPlayerRelation(const std::string &name)
Definition: popupmenu.cpp:2492
void addSocialMenu()
Definition: popupmenu.cpp:3508
void addDrop(const Item *const item, const bool isProtected)
Definition: popupmenu.cpp:2864
int mItemId
Definition: popupmenu.h:291
void showLinkPopup(const std::string &link)
Definition: popupmenu.cpp:2194
void setMousePos2()
Definition: popupmenu.cpp:553
void showPlayerPopup(const std::string &nick)
Definition: popupmenu.cpp:606
void showPickupItemPopup(const int x, const int y, const std::string &name)
Definition: popupmenu.cpp:2101
void showItemPopup(const int x, const int y, const Item *const item)
Definition: popupmenu.cpp:1790
void addGmCommands()
Definition: popupmenu.cpp:2888
void select()
Definition: popupmenu.cpp:3630
int mItemIndex
Definition: popupmenu.h:292
void showUndressPopup(const int x, const int y, const Being *const being, const Item *const item)
Definition: popupmenu.cpp:2138
void showNavigationPopup()
Definition: popupmenu.cpp:3580
void addParty(const std::string &nick)
Definition: popupmenu.cpp:2665
void showChatPopup(const int x, const int y, ChatTab *const tab)
Definition: popupmenu.cpp:913
BeingId mFloorItemId
Definition: popupmenu.h:290
void showPlayerMenu()
Definition: popupmenu.cpp:2898
void showSkillLevelPopup(const SkillInfo *const info)
Definition: popupmenu.cpp:2356
BeingId mBeingId
Definition: popupmenu.h:289
void addWindowMenu(const Window *const window)
Definition: popupmenu.cpp:1185
void showWindowsPopup()
Definition: popupmenu.cpp:2217
void showFloorItemGMCommands()
Definition: popupmenu.cpp:3336
void addChat(const Being *const being)
Definition: popupmenu.cpp:2690
void setMousePos()
Definition: popupmenu.cpp:540
void addProtection()
Definition: popupmenu.cpp:2777
void showGuildPopup()
Definition: popupmenu.cpp:3556
void addCatchPetCommands()
Definition: popupmenu.cpp:3490
void handleLink(const std::string &link, MouseEvent *event)
Definition: popupmenu.cpp:1251
void clear()
Definition: popupmenu.cpp:2758
void showSkillOffsetPopup(const SkillInfo *const info, const bool isOffsetX)
Definition: popupmenu.cpp:2307
void moveUp()
Definition: popupmenu.cpp:3620
void showOutfitsWindowPopup(const int x, const int y)
Definition: popupmenu.cpp:853
void showPlayerGMCommands(const std::string &name)
Definition: popupmenu.cpp:2962
TextDialog * mDialog
Definition: popupmenu.h:301
void showPetGMCommands()
Definition: popupmenu.cpp:3452
void moveDown()
Definition: popupmenu.cpp:3625
bool isAllowOtherCommand(const ServerCommandTypeT command)
Definition: popupmenu.cpp:183
PlayerListener mPlayerListener
Definition: popupmenu.h:300
void showCraftPopup()
Definition: popupmenu.cpp:3460
void showMuteCommands()
Definition: popupmenu.cpp:3170
void showGMPopup(const std::string &name)
Definition: popupmenu.cpp:3396
void showSkillPopup(const SkillInfo *const info)
Definition: popupmenu.cpp:2263
void showEmoteType()
Definition: popupmenu.cpp:1215
void showChangePos(const int x, const int y)
Definition: popupmenu.cpp:1117
TextField * mTextField
Definition: popupmenu.h:306
void addNormalRelations()
Definition: popupmenu.cpp:2473
void showWindowPopup(Window *const window)
Definition: popupmenu.cpp:1164
bool addBeingMenu()
Definition: popupmenu.cpp:520
void showDropPopup(const int x, const int y, const Item *const item)
Definition: popupmenu.cpp:1849
void showPopup(const int x, const int y, const Being *const being)
Definition: popupmenu.cpp:203
void addItemMenu(const Item *const item, const InventoryTypeT type)
Definition: popupmenu.cpp:2817
Window * mCallerWindow
Definition: popupmenu.h:298
bool mAllowCleanMenu
Definition: popupmenu.h:311
ItemColor mItemColor
Definition: popupmenu.h:294
void showNpcGMCommands()
Definition: popupmenu.cpp:3233
Definition: popup.h:52
Definition: window.h:102
InventoryType ::T InventoryTypeT
Definition: inventorytype.h:42
uint16_t ItemColor
Definition: itemcolor.h:30
#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
#define A_UNUSED
Definition: localconsts.h:160
bool info(InputEvent &event)
Definition: commands.cpp:57
PopupMenu * popupMenu
Definition: popupmenu.cpp:103
ServerCommandType ::T ServerCommandTypeT