ManaPlus
socialwindow.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2010 The Mana Developers
4  * Copyright (C) 2011-2019 The ManaPlus Developers
5  * Copyright (C) 2019-2021 Andrei Karas
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef GUI_WINDOWS_SOCIALWINDOW_H
24 #define GUI_WINDOWS_SOCIALWINDOW_H
25 
26 #include "gui/widgets/window.h"
27 
30 
31 class Button;
32 class ConfirmDialog;
33 class Guild;
34 class Label;
35 class Map;
36 class Party;
37 class SocialTab;
38 class TabbedArea;
39 class TextDialog;
40 
46 class SocialWindow final : public Window,
47  private ActionListener,
49 {
50  public:
51  SocialWindow();
52 
54 
55  ~SocialWindow() override final;
56 
57  void postInit() override final;
58 
59  bool addTab(Guild *const guild);
60 
61  bool removeTab(Guild *const guild);
62 
63  bool addTab(Party *const party);
64 
65  bool removeTab(Party *const party);
66 
67  void action(const ActionEvent &event) override final;
68 
69  void showGuildInvite(const std::string &restrict guildName,
70  const int guildId,
71  const std::string &restrict inviterName);
72 
73  void showPartyInvite(const std::string &restrict partyName,
74  const std::string &restrict inviter,
75  const int partyId);
76 
77  void updateActiveList();
78 
79  void updateAvatar(const std::string &name);
80 
81  void resetDamage(const std::string &name);
82 
83  void slowLogic();
84 
85  void updatePortals();
86 
87  void updatePortalNames();
88 
89  void updateParty();
90 
91  int getPortalIndex(const int x, const int y) A_WARN_UNUSED;
92 
93  void addPortal(const int x, const int y);
94 
95  void removePortal(const int x, const int y);
96 
97  void nextTab();
98 
99  void prevTab();
100 
102  { return mMap; }
103 
104  void setMap(Map *const map)
105  { mMap = map; mProcessedPortals = false; }
106 
108  { return mProcessedPortals; }
109 
110  void setProcessedPortals(const bool n) noexcept2
111  { mProcessedPortals = n; }
112 
113  void selectPortal(const unsigned num);
114 
115  void updateAttackFilter();
116 
117  void updatePickupFilter();
118 
119  void widgetResized(const Event &event) override final;
120 
121  void updateCounter(const SocialTab *const tab,
122  const std::string &count);
123 
124  void updateMenu(const SocialTab *const tab,
125  const std::string &menu);
126 
127  void updateGuildCounter(const int online,
128  const int total);
129 
130  void updatedPlayer(const std::string &name) override final;
131 
132  void updateAll() override final;
133 
134 #ifdef USE_PROFILER
135  void logicChildren();
136 #endif // USE_PROFILER
137 
138  protected:
139  friend class SocialTab;
140  typedef std::map<Guild*, SocialTab*> GuildMap;
141  typedef std::map<Party*, SocialTab*> PartyMap;
142 
143  void updateButtons();
144 
148  std::string mPartyInviter;
151 
153 
159 
164 
166  int mPartyId;
169 };
170 
171 extern SocialWindow *socialWindow;
172 
173 #endif // GUI_WINDOWS_SOCIALWINDOW_H
virtual void logicChildren()
Definition: button.h:102
Definition: event.h:79
Definition: guild.h:70
Definition: label.h:91
Definition: map.h:75
Definition: party.h:63
void updateGuildCounter(const int online, const int total)
PartyMap mParties
Definition: socialwindow.h:150
void setProcessedPortals(const bool n)
Definition: socialwindow.h:110
void resetDamage(const std::string &name)
void updatePortals()
void removePortal(const int x, const int y)
void showGuildInvite(const std::string &guildName, const int guildId, const std::string &inviterName)
ConfirmDialog * mPartyAcceptDialog
Definition: socialwindow.h:152
SocialTab * mPickupFilter
Definition: socialwindow.h:155
void widgetResized(const Event &event)
int getPortalIndex(const int x, const int y)
Button * mMenuButton
Definition: socialwindow.h:160
std::string mPartyInviter
Definition: socialwindow.h:148
TextDialog * mGuildCreateDialog
Definition: socialwindow.h:147
void updateAvatar(const std::string &name)
std::map< Party *, SocialTab * > PartyMap
Definition: socialwindow.h:141
void updatePickupFilter()
void updateAttackFilter()
void addPortal(const int x, const int y)
bool mProcessedPortals
Definition: socialwindow.h:168
bool removeTab(Guild *const guild)
TabbedArea * mTabs
Definition: socialwindow.h:162
void selectPortal(const unsigned num)
const Map * getMap() const
Definition: socialwindow.h:101
ConfirmDialog * mGuildAcceptDialog
Definition: socialwindow.h:146
void updateMenu(const SocialTab *const tab, const std::string &menu)
SocialTab * mPlayers
Definition: socialwindow.h:156
SocialTab * mFriends
Definition: socialwindow.h:158
void updateCounter(const SocialTab *const tab, const std::string &count)
bool getProcessedPortals() const
Definition: socialwindow.h:107
void action(const ActionEvent &event)
void updatePortalNames()
void setMap(Map *const map)
Definition: socialwindow.h:104
SocialTab * mNavigation
Definition: socialwindow.h:157
void updateButtons()
bool addTab(Guild *const guild)
SocialTab * mAttackFilter
Definition: socialwindow.h:154
void showPartyInvite(const std::string &partyName, const std::string &inviter, const int partyId)
GuildMap mGuilds
Definition: socialwindow.h:149
void updateActiveList()
void updatedPlayer(const std::string &name)
std::map< Guild *, SocialTab * > GuildMap
Definition: socialwindow.h:140
Label * mCountLabel
Definition: socialwindow.h:161
time_t mLastUpdateTime
Definition: socialwindow.h:165
void updateParty()
Definition: window.h:102
#define restrict
Definition: localconsts.h:165
#define override
Definition: localconsts.h:47
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
uint32_t guild
uint32_t party
MenuTypeT menu
Definition: menu.cpp:28
SocialWindow * socialWindow