ManaPlus
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends

#include <socialwindow.h>

Inheritance diagram for SocialWindow:
Window ActionListener PlayerRelationsListener BasicContainer2 MouseListener WidgetListener BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 SocialWindow ()
 
 ~SocialWindow ()
 
void postInit ()
 
bool addTab (Guild *const guild)
 
bool removeTab (Guild *const guild)
 
bool addTab (Party *const party)
 
bool removeTab (Party *const party)
 
void action (const ActionEvent &event)
 
void showGuildInvite (const std::string &guildName, const int guildId, const std::string &inviterName)
 
void showPartyInvite (const std::string &partyName, const std::string &inviter, const int partyId)
 
void updateActiveList ()
 
void updateAvatar (const std::string &name)
 
void resetDamage (const std::string &name)
 
void slowLogic ()
 
void updatePortals ()
 
void updatePortalNames ()
 
void updateParty ()
 
int getPortalIndex (const int x, const int y)
 
void addPortal (const int x, const int y)
 
void removePortal (const int x, const int y)
 
void nextTab ()
 
void prevTab ()
 
const MapgetMap () const
 
void setMap (Map *const map)
 
bool getProcessedPortals () const
 
void setProcessedPortals (const bool n)
 
void selectPortal (const unsigned num)
 
void updateAttackFilter ()
 
void updatePickupFilter ()
 
void widgetResized (const Event &event)
 
void updateCounter (const SocialTab *const tab, const std::string &count)
 
void updateMenu (const SocialTab *const tab, const std::string &menu)
 
void updateGuildCounter (const int online, const int total)
 
void updatedPlayer (const std::string &name)
 
void updateAll ()
 
- Public Member Functions inherited from Window
 Window (const std::string &caption, const Modal modal, Window *const parent, std::string skin)
 
 ~Window ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void setLocationHorisontallyRelativeTo (const Widget *const widget)
 
void setLocationRelativeTo (const ImagePosition::Type &position, int offsetX, int offsetY)
 
void setResizable (const bool resize)
 
void redraw ()
 
void widgetMoved (const Event &event)
 
void widgetHidden (const Event &event)
 
void setCloseButton (const bool flag)
 
bool getCloseButton () const
 
void setAllowClose (const bool b)
 
bool getAlowClose () const
 
bool isResizable () const
 
void setMinWidth (const int width)
 
int getMinWidth () const
 
void setMinHeight (const int height)
 
int getMinHeight () const
 
void setMaxWidth (const int width)
 
int getMaxWidth () const
 
void setMaxHeight (const int height)
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 
void setStickyButton (const bool flag)
 
void setSticky (const bool sticky)
 
bool isSticky () const
 
void setStickyButtonLock (const bool sticky)
 
bool isStickyButtonLock () const
 
virtual void setVisible (Visible visible)
 
void setVisible (const Visible visible, const bool forceSticky)
 
bool isDefaultVisible () const
 
void setDefaultVisible (const bool save)
 
bool willSaveVisible () const
 
void setSaveVisible (const bool save)
 
WindowgetParentWindow () const
 
virtual void scheduleDelete ()
 
void mousePressed (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void mouseMoved (MouseEvent &event)
 
void mouseReleased (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void mouseEntered (MouseEvent &event)
 
void updateResizeHandler (MouseEvent &event)
 
void setWindowName (const std::string &name)
 
const std::string & getWindowName () const
 
void loadWindowState ()
 
void saveWindowState ()
 
void setDefaultSize (const int defaultX, const int defaultY, int defaultWidth, int defaultHeight)
 
void setDefaultSize ()
 
void setDefaultSize (const int defaultWidth, const int defaultHeight, const ImagePosition::Type &position, const int offsetx, const int offsetY)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w, int h)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w, const int h)
 
ContainerPlacer getPlacer (const int x, const int y)
 
void center ()
 
void centerHorisontally ()
 
virtual void close ()
 
void setModal (const Modal modal)
 
Rect getWindowArea () const
 
bool isResizeAllowed (const MouseEvent &event) const
 
void setCaptionFont (Font *font)
 
void enableVisibleSound (bool b)
 
bool isWindowVisible () const
 
void setPadding (int padding)
 
int getPadding () const
 
void setTitleBarHeight (unsigned int height)
 
unsigned int getTitleBarHeight () const
 
void setCaption (const std::string &caption)
 
const std::string & getCaption () const
 
void setAlignment (Graphics::Alignment alignment)
 
Graphics::Alignment getAlignment () const
 
void setMovable (Move movable)
 
bool isMovable () const
 
Rect getChildrenArea ()
 
virtual void resizeToContent ()
 
- Public Member Functions inherited from BasicContainer2
 BasicContainer2 (const Widget2 *const widget)
 
 ~BasicContainer2 ()
 
void setOpaque (Opaque opaque)
 
bool isOpaque () const
 
virtual void add (Widget *const widget)
 
void addXY (Widget *const widget, const int x, const int y)
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
 ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
void focusNext ()
 
void focusPrevious ()
 
void logic ()
 
void setFocusHandler (FocusHandler *const focusHandler)
 
void setInternalFocusHandler (FocusHandler *const focusHandler)
 
WidgetgetWidgetAt (int x, int y)
 
void death (const Event &event)
 
WidgetfindFirstWidget (const std::set< Widget *> &list)
 
void add (Widget *const widget)
 
virtual void remove (Widget *const widget)
 
virtual void clear ()
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
 ~Widget ()
 
virtual void drawFrame (Graphics *graphics)
 
virtual void safeDrawFrame (Graphics *graphics)
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
virtual void setParent (Widget *parent)
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 
- Public Member Functions inherited from WidgetDeathListener
virtual ~WidgetDeathListener ()
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetShown (const Event &event)
 
- Public Member Functions inherited from PlayerRelationsListener
virtual ~PlayerRelationsListener ()
 

Protected Types

typedef std::map< Guild *, SocialTab * > GuildMap
 
typedef std::map< Party *, SocialTab * > PartyMap
 
- Protected Types inherited from BasicContainer
typedef std::vector< Widget * > WidgetList
 
typedef WidgetList::iterator WidgetListIterator
 
typedef WidgetList::const_iterator WidgetListConstIterator
 
typedef WidgetList::reverse_iterator WidgetListReverseIterator
 
typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 

Protected Member Functions

void updateButtons ()
 
- Protected Member Functions inherited from Window
bool canMove () const
 
int getOption (const std::string &name, const int def) const
 
bool getOptionBool (const std::string &name, const bool def) const
 
void setTitlePadding (const int p)
 
int getTitlePadding () const
 
- Protected Member Functions inherited from BasicContainer
virtual void drawChildren (Graphics *const graphics)
 
virtual void safeDrawChildren (Graphics *const graphics)
 
virtual void logicChildren ()
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from WidgetDeathListener
 WidgetDeathListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- Protected Member Functions inherited from PlayerRelationsListener
 PlayerRelationsListener ()
 

Protected Attributes

int mGuildInvited
 
ConfirmDialogmGuildAcceptDialog
 
TextDialogmGuildCreateDialog
 
std::string mPartyInviter
 
GuildMap mGuilds
 
PartyMap mParties
 
ConfirmDialogmPartyAcceptDialog
 
SocialTabmAttackFilter
 
SocialTabmPickupFilter
 
SocialTabmPlayers
 
SocialTabmNavigation
 
SocialTabmFriends
 
ButtonmMenuButton
 
LabelmCountLabel
 
TabbedAreamTabs
 
MapmMap
 
time_t mLastUpdateTime
 
int mPartyId
 
bool mNeedUpdate
 
bool mProcessedPortals
 
- Protected Attributes inherited from Window
std::string mCaption
 
Graphics::Alignment mAlignment
 
int mPadding
 
unsigned int mTitleBarHeight
 
Move mMovable
 
int mDragOffsetX
 
int mDragOffsetY
 
bool mMoved
 
SkinmSkin
 
int mDefaultX
 
int mDefaultY
 
int mDefaultWidth
 
int mDefaultHeight
 
int mCaptionOffsetX
 
int mCaptionOffsetY
 
bool mShowTitle
 
bool mLastRedraw
 
- Protected Attributes inherited from BasicContainer2
Opaque mOpaque
 
- Protected Attributes inherited from BasicContainer
WidgetList mWidgets
 
WidgetList mLogicWidgets
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 

Friends

class SocialTab
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *const windowContainer)
 
- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Data Fields inherited from Widget
Visible mVisible
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 
- Private Member Functions inherited from ActionListener
virtual ~ActionListener ()
 
 ActionListener ()
 

Detailed Description

Party window.

Definition at line 45 of file socialwindow.h.

Member Typedef Documentation

◆ GuildMap

typedef std::map<Guild*, SocialTab*> SocialWindow::GuildMap
protected

Definition at line 139 of file socialwindow.h.

◆ PartyMap

typedef std::map<Party*, SocialTab*> SocialWindow::PartyMap
protected

Definition at line 140 of file socialwindow.h.

Constructor & Destructor Documentation

◆ SocialWindow()

SocialWindow::SocialWindow ( )

Definition at line 50 of file socialwindow.cpp.

50  :
51  // TRANSLATORS: social window name
52  Window(_("Social"), Modal_false, nullptr, "social.xml"),
55  mGuildInvited(0),
56  mGuildAcceptDialog(nullptr),
57  mGuildCreateDialog(nullptr),
58  mPartyInviter(),
59  mGuilds(),
60  mParties(),
61  mPartyAcceptDialog(nullptr),
62  mAttackFilter(nullptr),
63  mPickupFilter(nullptr),
64  // TRANSLATORS: here P is title for visible players tab in social window
65  mPlayers(new SocialPlayersTab(this, _("P"),
66  fromBool(getOptionBool("showtabbackground", false), Opaque))),
68  fromBool(getOptionBool("showtabbackground", false), Opaque))),
69  // TRANSLATORS: here F is title for friends tab in social window
70  mFriends(new SocialFriendsTab(this, _("F"),
71  fromBool(getOptionBool("showtabbackground", false), Opaque))),
72  // TRANSLATORS: social window button
73  mMenuButton(new Button(this, _("Menu"), "menu", BUTTON_SKIN, this)),
74  mCountLabel(new Label(this, "1000 / 1000")),
76  mMap(nullptr),
77  mLastUpdateTime(0),
78  mPartyId(0),
79  mNeedUpdate(false),
80  mProcessedPortals(false)
81 {
82 }
#define _(s)
Definition: gettext.h:34
PartyMap mParties
Definition: socialwindow.h:149
bool getOptionBool(const std::string &name, const bool def) const
Definition: window.cpp:1465
Label * mCountLabel
Definition: socialwindow.h:160
SocialTab * mPickupFilter
Definition: socialwindow.h:154
SocialTab * mNavigation
Definition: socialwindow.h:156
Definition: button.h:96
GuildMap mGuilds
Definition: socialwindow.h:148
SocialTab * mFriends
Definition: socialwindow.h:157
bool mProcessedPortals
Definition: socialwindow.h:167
const std::string BUTTON_SKIN
Definition: button.h:88
Definition: label.h:87
#define fromBool(val, name)
Definition: booldefines.h:48
ConfirmDialog * mGuildAcceptDialog
Definition: socialwindow.h:145
Button * mMenuButton
Definition: socialwindow.h:159
std::string mPartyInviter
Definition: socialwindow.h:147
TabbedArea * mTabs
Definition: socialwindow.h:161
time_t mLastUpdateTime
Definition: socialwindow.h:164
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
SocialTab * mPlayers
Definition: socialwindow.h:155
SocialTab * mAttackFilter
Definition: socialwindow.h:153
Window(const std::string &caption, const Modal modal, Window *const parent, std::string skin)
Definition: window.cpp:108
TextDialog * mGuildCreateDialog
Definition: socialwindow.h:146
ConfirmDialog * mPartyAcceptDialog
Definition: socialwindow.h:151

◆ ~SocialWindow()

SocialWindow::~SocialWindow ( )

Definition at line 149 of file socialwindow.cpp.

References Window::close(), delete2, FOR_EACH, mAttackFilter, mFriends, mGuildAcceptDialog, mGuildInvited, mGuilds, mNavigation, mParties, mPartyAcceptDialog, mPartyInviter, mPickupFilter, mPlayers, playerRelations, PlayerRelationsManager::removeListener(), and Window::scheduleDelete().

150 {
152  if (mGuildAcceptDialog != nullptr)
153  {
156  mGuildAcceptDialog = nullptr;
157 
158  mGuildInvited = 0;
159  }
160 
161  if (mPartyAcceptDialog != nullptr)
162  {
165  mPartyAcceptDialog = nullptr;
166 
167  mPartyInviter.clear();
168  }
174  FOR_EACH (GuildMap::iterator, it, mGuilds)
175  {
176  delete (*it).second;
177  }
178  mGuilds.clear();
179  FOR_EACH (PartyMap::iterator, it, mParties)
180  {
181  delete (*it).second;
182  }
183  mParties.clear();
184 }
void removeListener(PlayerRelationsListener *const listener)
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
PartyMap mParties
Definition: socialwindow.h:149
SocialTab * mPickupFilter
Definition: socialwindow.h:154
SocialTab * mNavigation
Definition: socialwindow.h:156
GuildMap mGuilds
Definition: socialwindow.h:148
SocialTab * mFriends
Definition: socialwindow.h:157
#define delete2(var)
Definition: delete2.h:24
virtual void close()
Definition: window.cpp:901
ConfirmDialog * mGuildAcceptDialog
Definition: socialwindow.h:145
virtual void scheduleDelete()
Definition: window.cpp:830
std::string mPartyInviter
Definition: socialwindow.h:147
SocialTab * mPlayers
Definition: socialwindow.h:155
SocialTab * mAttackFilter
Definition: socialwindow.h:153
PlayerRelationsManager playerRelations
ConfirmDialog * mPartyAcceptDialog
Definition: socialwindow.h:151

Member Function Documentation

◆ action()

void SocialWindow::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Implements ActionListener.

Definition at line 265 of file socialwindow.cpp.

References _, ChatMsgType::BY_SERVER, ChatTab::chatLog(), GuildManager::getEnableGuildBot(), Event::getSource(), guildHandler, guildManager, IgnoreRecord_false, Net::GuildHandler::inviteResponse(), GuildManager::inviteResponse(), Net::PartyHandler::inviteResponse(), localChatTab, mGuildAcceptDialog, mGuildInvited, mPartyAcceptDialog, mPartyId, mPartyInviter, partyHandler, popupMenu, PopupMenu::showAttackPopup(), PopupMenu::showFriendsPopup(), PopupMenu::showGuildPopup(), PopupMenu::showNavigationPopup(), PopupMenu::showPartyPopup(), PopupMenu::showPickupPopup(), PopupMenu::showPlayersPopup(), strprintf(), and TryRemoveColors_true.

266 {
267  const std::string &eventId = event.getId();
268 
269  if (event.getSource() == mPartyAcceptDialog)
270  {
271  if (eventId == "yes")
272  {
273  if (localChatTab != nullptr)
274  {
276  // TRANSLATORS: chat message
277  strprintf(_("Accepted party invite from %s."),
278  mPartyInviter.c_str()),
282  }
284  }
285  else if (eventId == "no")
286  {
287  if (localChatTab != nullptr)
288  {
290  // TRANSLATORS: chat message
291  strprintf(_("Rejected party invite from %s."),
292  mPartyInviter.c_str()),
296  }
298  }
299 
300  mPartyInviter.clear();
301  mPartyAcceptDialog = nullptr;
302  }
303  else if (event.getSource() == mGuildAcceptDialog)
304  {
305  if (eventId == "yes")
306  {
307  if (localChatTab != nullptr)
308  {
310  // TRANSLATORS: chat message
311  strprintf(_("Accepted guild invite from %s."),
312  mPartyInviter.c_str()),
316  }
317 #ifdef TMWA_SUPPORT
318  if (guildManager == nullptr || !GuildManager::getEnableGuildBot())
320  else
322 #else // TMWA_SUPPORT
323 
325 #endif // TMWA_SUPPORT
326  }
327  else if (eventId == "no")
328  {
329  if (localChatTab != nullptr)
330  {
332  // TRANSLATORS: chat message
333  strprintf(_("Rejected guild invite from %s."),
334  mPartyInviter.c_str()),
338  }
339 #ifdef TMWA_SUPPORT
340  if (guildManager == nullptr || !GuildManager::getEnableGuildBot())
342  else
344 #else // TMWA_SUPPORT
345 
347 #endif // TMWA_SUPPORT
348  }
349 
350  mGuildInvited = 0;
351  mGuildAcceptDialog = nullptr;
352  }
353  else if (eventId == "party")
354  {
356  }
357  else if (eventId == "guild")
358  {
360  }
361  else if (eventId == "attack")
362  {
364  }
365  else if (eventId == "friends")
366  {
368  }
369  else if (eventId == "navigation")
370  {
372  }
373  else if (eventId == "pickup")
374  {
376  }
377  else if (eventId == "players")
378  {
380  }
381 }
void showPartyPopup()
Definition: popupmenu.cpp:3546
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
const bool TryRemoveColors_true
static void inviteResponse(const bool response)
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
void showNavigationPopup()
Definition: popupmenu.cpp:3580
void showAttackPopup()
Definition: popupmenu.cpp:3570
Net::GuildHandler * guildHandler
Definition: net.cpp:89
void showPlayersPopup()
Definition: popupmenu.cpp:3600
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
PopupMenu * popupMenu
Definition: popupmenu.cpp:102
GuildManager * guildManager
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
static bool getEnableGuildBot()
Definition: guildmanager.h:55
ConfirmDialog * mGuildAcceptDialog
Definition: socialwindow.h:145
void showPickupPopup()
Definition: popupmenu.cpp:3590
void showGuildPopup()
Definition: popupmenu.cpp:3556
std::string mPartyInviter
Definition: socialwindow.h:147
void showFriendsPopup()
Definition: popupmenu.cpp:3610
Net::PartyHandler * partyHandler
Definition: net.cpp:91
virtual void inviteResponse(const int partyId, const bool accept) const =0
virtual void inviteResponse(const int guildId, const bool response) const =0
ConfirmDialog * mPartyAcceptDialog
Definition: socialwindow.h:151

◆ addPortal()

void SocialWindow::addPortal ( const int  x,
const int  y 
)

Definition at line 570 of file socialwindow.cpp.

References mNavigation.

Referenced by LocalPlayer::setHome().

571 {
572  if (mNavigation != nullptr)
573  static_cast<SocialNavigationTab*>(mNavigation)->addPortal(x, y);
574 }
SocialTab * mNavigation
Definition: socialwindow.h:156
void addPortal(const int x, const int y)

◆ addTab() [1/2]

bool SocialWindow::addTab ( Guild *const  guild)

Definition at line 186 of file socialwindow.cpp.

References TabbedArea::addTab(), fromBool, Window::getOptionBool(), Guild::getServerGuild(), guild, mGuilds, SocialTab::mScroll, mTabs, and updateButtons().

Referenced by Being::addGuild(), postInit(), Being::setGuild(), and Being::setParty().

187 {
188  if (guild == nullptr)
189  return false;
190 
191  if (mGuilds.find(guild) != mGuilds.end())
192  return false;
193 
194  SocialTab *tab = nullptr;
195  if (guild->getServerGuild())
196  {
197  tab = new SocialGuildTab(this, guild,
198  fromBool(getOptionBool("showtabbackground", false), Opaque));
199  }
200 #ifdef TMWA_SUPPORT
201  else
202  {
203  tab = new SocialGuildTab2(this, guild,
204  fromBool(getOptionBool("showtabbackground", false), Opaque));
205  }
206 #endif // TMWA_SUPPORT
207 
208  mGuilds[guild] = tab;
209  mTabs->addTab(tab, tab->mScroll);
210 
211  updateButtons();
212 
213  return true;
214 }
bool getOptionBool(const std::string &name, const bool def) const
Definition: window.cpp:1465
ScrollArea * mScroll
Definition: socialtab.h:137
bool getServerGuild() const
Definition: guild.h:205
GuildMap mGuilds
Definition: socialwindow.h:148
#define fromBool(val, name)
Definition: booldefines.h:48
TabbedArea * mTabs
Definition: socialwindow.h:161
void updateButtons()
uint32_t guild
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237

◆ addTab() [2/2]

bool SocialWindow::addTab ( Party *const  party)

Definition at line 231 of file socialwindow.cpp.

References TabbedArea::addTab(), fromBool, Window::getOptionBool(), mParties, SocialTab::mScroll, mTabs, party, and updateButtons().

232 {
233  if (party == nullptr)
234  return false;
235 
236  if (mParties.find(party) != mParties.end())
237  return false;
238 
239  SocialPartyTab *const tab = new SocialPartyTab(this, party,
240  fromBool(getOptionBool("showtabbackground", false), Opaque));
241  mParties[party] = tab;
242 
243  mTabs->addTab(tab, tab->mScroll);
244 
245  updateButtons();
246 
247  return true;
248 }
PartyMap mParties
Definition: socialwindow.h:149
bool getOptionBool(const std::string &name, const bool def) const
Definition: window.cpp:1465
ScrollArea * mScroll
Definition: socialtab.h:137
uint32_t party
#define fromBool(val, name)
Definition: booldefines.h:48
TabbedArea * mTabs
Definition: socialwindow.h:161
void updateButtons()
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237

◆ getMap()

const Map* SocialWindow::getMap ( ) const
inline

◆ getPortalIndex()

int SocialWindow::getPortalIndex ( const int  x,
const int  y 
)

Definition at line 560 of file socialwindow.cpp.

References mNavigation.

Referenced by EAthena::BeingRecv::processBeingSpawn(), TmwAthena::BeingRecv::processBeingVisible(), EAthena::BeingRecv::processBeingVisible(), and LocalPlayer::setHome().

561 {
562  if (mNavigation != nullptr)
563  {
564  return static_cast<SocialNavigationTab*>(
566  }
567  return -1;
568 }
SocialTab * mNavigation
Definition: socialwindow.h:156
int getPortalIndex(const int x, const int y)

◆ getProcessedPortals()

bool SocialWindow::getProcessedPortals ( ) const
inline

Definition at line 106 of file socialwindow.h.

References mProcessedPortals.

Referenced by SocialNavigationTab::updateList().

107  { return mProcessedPortals; }
bool mProcessedPortals
Definition: socialwindow.h:167

◆ nextTab()

void SocialWindow::nextTab ( )

Definition at line 582 of file socialwindow.cpp.

References mTabs, and TabbedArea::selectNextTab().

583 {
584  if (mTabs != nullptr)
585  mTabs->selectNextTab();
586 }
TabbedArea * mTabs
Definition: socialwindow.h:161
void selectNextTab()
Definition: tabbedarea.cpp:818

◆ postInit()

void SocialWindow::postInit ( )
virtual

Reimplemented from Window.

Definition at line 84 of file socialwindow.cpp.

References PlayerRelationsManager::addListener(), addTab(), TabbedArea::addTab(), config, Window::enableVisibleSound(), fromBool, Configuration::getBoolValue(), Being::getGuild(), Window::getOptionBool(), Being::getParty(), TabbedArea::getTabContainer(), TabbedArea::getWidgetContainer(), Window::loadWindowState(), localPlayer, mAttackFilter, mCountLabel, mFriends, mMenuButton, mNavigation, mPickupFilter, mPlayers, SocialTab::mScroll, mTabs, Window::place(), playerRelations, Window::postInit(), SetupWindow::registerWindowForReset(), Window::setCloseButton(), Window::setDefaultSize(), Window::setMinHeight(), Window::setMinWidth(), Window::setResizable(), Window::setSaveVisible(), Widget::setSelectable(), Window::setStickyButtonLock(), setupWindow, Window::setVisible(), Window::setWindowName(), updateButtons(), Visible_false, and widgetResized().

85 {
87  setWindowName("Social");
89  setSaveVisible(true);
90  setResizable(true);
91  setSaveVisible(true);
92  setCloseButton(true);
93  setStickyButtonLock(true);
94 
95  setMinWidth(120);
96  setMinHeight(55);
97  setDefaultSize(590, 200, 180, 300);
98  if (setupWindow != nullptr)
100 
101  place(0, 0, mMenuButton, 1, 1);
102  place(0, 1, mCountLabel, 1, 1);
103  place(0, 2, mTabs, 2, 4);
104 
105  widgetResized(Event(nullptr));
106 
107  loadWindowState();
108 
112  mTabs->setSelectable(false);
115 
116  if (config.getBoolValue("enableAttackFilter"))
117  {
118  mAttackFilter = new SocialAttackTab(this,
119  fromBool(getOptionBool("showtabbackground", false), Opaque));
121  }
122  else
123  {
124  mAttackFilter = nullptr;
125  }
126 
127  if (config.getBoolValue("enablePickupFilter"))
128  {
129  mPickupFilter = new SocialPickupTab(this,
130  fromBool(getOptionBool("showtabbackground", false), Opaque));
132  }
133  else
134  {
135  mPickupFilter = nullptr;
136  }
137 
138  if ((localPlayer != nullptr) && (localPlayer->getParty() != nullptr))
140 
141  if ((localPlayer != nullptr) && (localPlayer->getGuild() != nullptr))
143 
144  enableVisibleSound(true);
145  updateButtons();
147 }
void setDefaultSize()
Definition: window.cpp:1197
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
Definition: window.cpp:1383
bool getOptionBool(const std::string &name, const bool def) const
Definition: window.cpp:1465
Label * mCountLabel
Definition: socialwindow.h:160
void loadWindowState()
Definition: window.cpp:1086
SocialTab * mPickupFilter
Definition: socialwindow.h:154
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
ScrollArea * mScroll
Definition: socialtab.h:137
void setMinWidth(const int width)
Definition: window.cpp:590
void addListener(PlayerRelationsListener *const listener)
SocialTab * mNavigation
Definition: socialwindow.h:156
Configuration config
SocialTab * mFriends
Definition: socialwindow.h:157
Party * getParty() const
Definition: being.h:329
bool addTab(Guild *const guild)
void registerWindowForReset(Window *const window)
void setSelectable(const bool selectable)
Definition: widget.h:947
Widget * getWidgetContainer() const
Definition: tabbedarea.h:243
bool getBoolValue(const std::string &key) const
Widget * getTabContainer() const
Definition: tabbedarea.h:240
const bool Visible_false
Definition: visible.h:29
#define fromBool(val, name)
Definition: booldefines.h:48
LocalPlayer * localPlayer
void setCloseButton(const bool flag)
Definition: window.cpp:748
Button * mMenuButton
Definition: socialwindow.h:159
void enableVisibleSound(bool b)
Definition: window.h:480
void setMinHeight(const int height)
Definition: window.cpp:603
void setSaveVisible(const bool save)
Definition: window.h:299
virtual void setVisible(Visible visible)
Definition: window.cpp:777
TabbedArea * mTabs
Definition: socialwindow.h:161
Definition: event.h:77
void updateButtons()
void setResizable(const bool resize)
Definition: window.cpp:626
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:771
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
SocialTab * mPlayers
Definition: socialwindow.h:155
SocialTab * mAttackFilter
Definition: socialwindow.h:153
PlayerRelationsManager playerRelations
void postInit()
Definition: window.cpp:248
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237
void setWindowName(const std::string &name)
Definition: window.h:354
void widgetResized(const Event &event)

◆ prevTab()

void SocialWindow::prevTab ( )

Definition at line 588 of file socialwindow.cpp.

References mTabs, and TabbedArea::selectPrevTab().

589 {
590  if (mTabs != nullptr)
591  mTabs->selectPrevTab();
592 }
void selectPrevTab()
Definition: tabbedarea.cpp:827
TabbedArea * mTabs
Definition: socialwindow.h:161

◆ removePortal()

void SocialWindow::removePortal ( const int  x,
const int  y 
)

Definition at line 576 of file socialwindow.cpp.

References mNavigation.

Referenced by PopupMenu::handleLink(), and LocalPlayer::setHome().

577 {
578  if (mNavigation != nullptr)
579  static_cast<SocialNavigationTab*>(mNavigation)->removePortal(x, y);
580 }
SocialTab * mNavigation
Definition: socialwindow.h:156
void removePortal(const int x, const int y)

◆ removeTab() [1/2]

bool SocialWindow::removeTab ( Guild *const  guild)

Definition at line 216 of file socialwindow.cpp.

References mGuilds, mTabs, TabbedArea::removeTab(), and updateButtons().

Referenced by GuildManager::afterRemove(), GuildManager::clear(), Being::clearGuilds(), TmwAthena::GeneralHandler::gameEnded(), EAthena::GeneralHandler::gameEnded(), EAthena::GuildRecv::processGuildExpulsionContinue(), EAthena::GuildRecv::processGuildLeave(), EAthena::GuildRecv::processGuildLeave2(), Ea::PartyRecv::processPartyLeave(), GuildManager::reload(), Being::removeGuild(), Being::setGuild(), and Being::setParty().

217 {
218  const GuildMap::iterator it = mGuilds.find(guild);
219  if (it == mGuilds.end())
220  return false;
221 
222  mTabs->removeTab(it->second);
223  delete it->second;
224  mGuilds.erase(it);
225 
226  updateButtons();
227 
228  return true;
229 }
void removeTab(Tab *const tab)
Definition: tabbedarea.cpp:322
GuildMap mGuilds
Definition: socialwindow.h:148
TabbedArea * mTabs
Definition: socialwindow.h:161
void updateButtons()

◆ removeTab() [2/2]

bool SocialWindow::removeTab ( Party *const  party)

Definition at line 250 of file socialwindow.cpp.

References mParties, mTabs, TabbedArea::removeTab(), and updateButtons().

251 {
252  const PartyMap::iterator it = mParties.find(party);
253  if (it == mParties.end())
254  return false;
255 
256  mTabs->removeTab(it->second);
257  delete it->second;
258  mParties.erase(it);
259 
260  updateButtons();
261 
262  return true;
263 }
PartyMap mParties
Definition: socialwindow.h:149
void removeTab(Tab *const tab)
Definition: tabbedarea.cpp:322
TabbedArea * mTabs
Definition: socialwindow.h:161
void updateButtons()

◆ resetDamage()

void SocialWindow::resetDamage ( const std::string &  name)

Definition at line 529 of file socialwindow.cpp.

References mPlayers, and SocialTab::resetDamage().

Referenced by TmwAthena::BeingRecv::processBeingSelfEffect(), and EAthena::BeingRecv::processBeingSpecialEffect().

530 {
531  mPlayers->resetDamage(name);
532 }
virtual void resetDamage(const std::string &name)
Definition: socialtab.h:61
SocialTab * mPlayers
Definition: socialwindow.h:155

◆ selectPortal()

void SocialWindow::selectPortal ( const unsigned  num)

Definition at line 554 of file socialwindow.cpp.

References mNavigation, and SocialTab::selectIndex().

Referenced by Actions::closeMoveNpcDialog(), and setProcessedPortals().

555 {
556  if (mNavigation != nullptr)
557  mNavigation->selectIndex(num);
558 }
SocialTab * mNavigation
Definition: socialwindow.h:156
virtual void selectIndex(const unsigned num)
Definition: socialtab.h:65

◆ setMap()

void SocialWindow::setMap ( Map *const  map)
inline

Definition at line 103 of file socialwindow.h.

References mMap, and mProcessedPortals.

Referenced by Game::changeMap().

104  { mMap = map; mProcessedPortals = false; }
bool mProcessedPortals
Definition: socialwindow.h:167

◆ setProcessedPortals()

void SocialWindow::setProcessedPortals ( const bool  n)
inline

◆ showGuildInvite()

void SocialWindow::showGuildInvite ( const std::string &  guildName,
const int  guildId,
const std::string &  inviterName 
)

Definition at line 383 of file socialwindow.cpp.

References _, Widget::addActionListener(), ChatMsgType::BY_SERVER, ChatTab::chatLog(), CREATEWIDGETV, IgnoreRecord_false, localChatTab, mGuildAcceptDialog, mGuildInvited, Modal_false, Actions::msg(), SOUND_REQUEST, strprintf(), and TryRemoveColors_true.

Referenced by GuildManager::process(), and EAthena::GuildRecv::processGuildInvite().

386 {
387  // check there isnt already an invite showing
388  if (mGuildInvited != 0)
389  {
390  if (localChatTab != nullptr)
391  {
392  // TRANSLATORS: chat message
393  localChatTab->chatLog(_("Received guild request, but one already "
394  "exists."),
398  }
399  return;
400  }
401 
402  const std::string msg = strprintf(
403  // TRANSLATORS: chat message
404  _("%s has invited you to join the guild %s."),
405  inviterName.c_str(), guildName.c_str());
406 
407  if (localChatTab != nullptr)
408  {
409  localChatTab->chatLog(msg,
413  }
414 
416  // TRANSLATORS: guild invite message
417  _("Accept Guild Invite"),
418  msg,
420  false,
421  Modal_false,
422  this);
424  mGuildInvited = guildId;
425 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
static const std::string SOUND_REQUEST
Definition: sound.h:28
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
bool msg(InputEvent &event)
Definition: chat.cpp:38
#define CREATEWIDGETV(var, type,...)
Definition: createwidget.h:24
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
ConfirmDialog * mGuildAcceptDialog
Definition: socialwindow.h:145

◆ showPartyInvite()

void SocialWindow::showPartyInvite ( const std::string &  partyName,
const std::string &  inviter,
const int  partyId 
)

Definition at line 427 of file socialwindow.cpp.

References _, Widget::addActionListener(), ChatMsgType::BY_SERVER, ChatTab::chatLog(), CREATEWIDGETV, IgnoreRecord_false, localChatTab, Modal_false, mPartyAcceptDialog, mPartyId, mPartyInviter, Actions::msg(), SOUND_REQUEST, strprintf(), and TryRemoveColors_true.

Referenced by TmwAthena::PartyRecv::processPartyInvited(), and EAthena::PartyRecv::processPartyInvited().

430 {
431  // check there isnt already an invite showing
432  if (!mPartyInviter.empty())
433  {
434  if (localChatTab != nullptr)
435  {
436  // TRANSLATORS: chat message
437  localChatTab->chatLog(_("Received party request, but one already "
438  "exists."),
442  }
443  return;
444  }
445 
446  std::string msg;
447  if (inviter.empty())
448  {
449  if (partyName.empty())
450  {
451  // TRANSLATORS: party invite message
452  msg = _("You have been invited you to join a party.");
453  }
454  else
455  {
456  // TRANSLATORS: party invite message
457  msg = strprintf(_("You have been invited to join the %s party."),
458  partyName.c_str());
459  }
460  }
461  else
462  {
463  if (partyName.empty())
464  {
465  // TRANSLATORS: party invite message
466  msg = strprintf(_("%s has invited you to join their party."),
467  inviter.c_str());
468  }
469  else
470  {
471  // TRANSLATORS: party invite message
472  msg = strprintf(_("%s has invited you to join the %s party."),
473  inviter.c_str(), partyName.c_str());
474  }
475  }
476 
477  if (localChatTab != nullptr)
478  {
479  localChatTab->chatLog(msg,
483  }
484 
485  // show invite
487  // TRANSLATORS: party invite message
488  _("Accept Party Invite"),
489  msg,
491  false,
492  Modal_false,
493  this);
495  mPartyInviter = inviter;
496  mPartyId = partyId;
497 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
static const std::string SOUND_REQUEST
Definition: sound.h:28
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
bool msg(InputEvent &event)
Definition: chat.cpp:38
#define CREATEWIDGETV(var, type,...)
Definition: createwidget.h:24
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
std::string mPartyInviter
Definition: socialwindow.h:147
ConfirmDialog * mPartyAcceptDialog
Definition: socialwindow.h:151

◆ slowLogic()

void SocialWindow::slowLogic ( )

Definition at line 504 of file socialwindow.cpp.

References BLOCK_END, BLOCK_START, cur_time, mFriends, mLastUpdateTime, mNeedUpdate, mPlayers, and SocialTab::updateList().

Referenced by Game::slowLogic().

505 {
506  BLOCK_START("SocialWindow::slowLogic")
507  const time_t nowTime = cur_time;
508  if (mNeedUpdate && nowTime - mLastUpdateTime > 1)
509  {
510  mPlayers->updateList();
511  mFriends->updateList();
512  mNeedUpdate = false;
513  mLastUpdateTime = nowTime;
514  }
515  else if (nowTime - mLastUpdateTime > 5)
516  {
517  mPlayers->updateList();
518  mNeedUpdate = false;
519  mLastUpdateTime = nowTime;
520  }
521  BLOCK_END("SocialWindow::slowLogic")
522 }
virtual void updateList()
Definition: socialtab.h:53
#define BLOCK_START(name)
Definition: perfomance.h:78
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
SocialTab * mFriends
Definition: socialwindow.h:157
volatile time_t cur_time
Definition: timer.cpp:57
time_t mLastUpdateTime
Definition: socialwindow.h:164
SocialTab * mPlayers
Definition: socialwindow.h:155

◆ updateActiveList()

void SocialWindow::updateActiveList ( )

◆ updateAll()

void SocialWindow::updateAll ( )
virtual

Implements PlayerRelationsListener.

Definition at line 669 of file socialwindow.cpp.

References BLOCK_END, BLOCK_START, BasicContainer::logicChildren(), and mNeedUpdate.

Referenced by setProcessedPortals().

670 {
671  mNeedUpdate = true;
672 }

◆ updateAttackFilter()

void SocialWindow::updateAttackFilter ( )

Definition at line 594 of file socialwindow.cpp.

References mAttackFilter, and SocialTab::updateList().

Referenced by Actions::changeRelation(), ActorManager::setPlayer(), and setProcessedPortals().

595 {
596  if (mAttackFilter != nullptr)
598 }
virtual void updateList()
Definition: socialtab.h:53
SocialTab * mAttackFilter
Definition: socialwindow.h:153

◆ updateAvatar()

void SocialWindow::updateAvatar ( const std::string &  name)

Definition at line 524 of file socialwindow.cpp.

References mPlayers, and SocialTab::updateAvatar().

Referenced by Being::takeDamage().

525 {
526  mPlayers->updateAvatar(name);
527 }
virtual void updateAvatar(const std::string &name)
Definition: socialtab.h:57
SocialTab * mPlayers
Definition: socialwindow.h:155

◆ updateButtons()

void SocialWindow::updateButtons ( )
protected

Definition at line 534 of file socialwindow.cpp.

Referenced by addTab(), postInit(), and removeTab().

535 {
536 // if (!mTabs)
537 // return;
538 
539 // const bool hasTabs = mTabs->getNumberOfTabs() > 0;
540 }

◆ updateCounter()

void SocialWindow::updateCounter ( const SocialTab *const  tab,
const std::string &  count 
)

Definition at line 630 of file socialwindow.cpp.

References Label::adjustSize(), TabbedArea::getSelectedTab(), mCountLabel, mTabs, and Label::setCaption().

Referenced by setProcessedPortals(), and SocialTab::updateCounter().

632 {
633  if (mTabs->getSelectedTab() == tab)
634  {
635  mCountLabel->setCaption(counter);
637  }
638 }
Label * mCountLabel
Definition: socialwindow.h:160
void setCaption(const std::string &caption)
Definition: label.cpp:261
TabbedArea * mTabs
Definition: socialwindow.h:161
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
void adjustSize()
Definition: label.cpp:197

◆ updatedPlayer()

void SocialWindow::updatedPlayer ( const std::string &  name)
virtual

Implements PlayerRelationsListener.

Definition at line 664 of file socialwindow.cpp.

References mNeedUpdate.

Referenced by setProcessedPortals().

665 {
666  mNeedUpdate = true;
667 }

◆ updateGuildCounter()

void SocialWindow::updateGuildCounter ( const int  online,
const int  total 
)

Definition at line 647 of file socialwindow.cpp.

References SocialTab::buildCounter(), Being::getGuild(), guild, localPlayer, and mGuilds.

Referenced by GuildManager::process(), EAthena::GuildRecv::processGuildMemberList(), EAthena::GuildRecv::processGuildMemberLogin(), setProcessedPortals(), and GuildManager::updateList().

648 {
649  if (localPlayer == nullptr)
650  return;
651 
652  Guild *const guild = localPlayer->getGuild();
653  if (guild != nullptr)
654  {
655  const GuildMap::iterator it = mGuilds.find(guild);
656  if (it != mGuilds.end())
657  {
658  SocialTab *const tab = (*it).second;
659  tab->buildCounter(online, total);
660  }
661  }
662 }
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
GuildMap mGuilds
Definition: socialwindow.h:148
LocalPlayer * localPlayer
virtual void buildCounter(const int online, const int total)
Definition: socialtab.h:69
uint32_t guild
Definition: guild.h:68

◆ updateMenu()

void SocialWindow::updateMenu ( const SocialTab *const  tab,
const std::string &  menu 
)

Definition at line 640 of file socialwindow.cpp.

References TabbedArea::getSelectedTab(), mMenuButton, mTabs, and Widget::setActionEventId().

Referenced by setProcessedPortals(), and SocialTab::updateMenu().

642 {
643  if (mTabs->getSelectedTab() == tab)
645 }
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
MenuTypeT menu
Definition: menu.cpp:27
Button * mMenuButton
Definition: socialwindow.h:159
TabbedArea * mTabs
Definition: socialwindow.h:161
Tab * getSelectedTab() const
Definition: tabbedarea.h:174

◆ updateParty()

void SocialWindow::updateParty ( )

Definition at line 606 of file socialwindow.cpp.

References SocialTab::buildCounter(), Being::getParty(), localPlayer, mParties, and party.

Referenced by TmwAthena::PartyRecv::processPartyInfo(), and EAthena::PartyRecv::processPartyInfo().

607 {
608  if (localPlayer == nullptr)
609  return;
610 
611  Party *const party = localPlayer->getParty();
612  if (party != nullptr)
613  {
614  const PartyMap::iterator it = mParties.find(party);
615  if (it != mParties.end())
616  {
617  SocialTab *const tab = (*it).second;
618  tab->buildCounter(0, 0);
619  }
620  }
621 }
PartyMap mParties
Definition: socialwindow.h:149
Definition: party.h:61
Party * getParty() const
Definition: being.h:329
uint32_t party
LocalPlayer * localPlayer
virtual void buildCounter(const int online, const int total)
Definition: socialtab.h:69

◆ updatePickupFilter()

void SocialWindow::updatePickupFilter ( )

Definition at line 600 of file socialwindow.cpp.

References mPickupFilter, and SocialTab::updateList().

Referenced by Actions::changeRelation(), ActorManager::setPlayer(), and setProcessedPortals().

601 {
602  if (mPickupFilter != nullptr)
604 }
virtual void updateList()
Definition: socialtab.h:53
SocialTab * mPickupFilter
Definition: socialwindow.h:154

◆ updatePortalNames()

void SocialWindow::updatePortalNames ( )

Definition at line 548 of file socialwindow.cpp.

References mNavigation.

Referenced by RenameListener::action().

549 {
550  if (mNavigation != nullptr)
551  static_cast<SocialNavigationTab*>(mNavigation)->updateNames();
552 }
SocialTab * mNavigation
Definition: socialwindow.h:156

◆ updatePortals()

void SocialWindow::updatePortals ( )

Definition at line 542 of file socialwindow.cpp.

References mNavigation, and SocialTab::updateList().

Referenced by LocalPlayer::updateCoords().

543 {
544  if (mNavigation != nullptr)
546 }
virtual void updateList()
Definition: socialtab.h:53
SocialTab * mNavigation
Definition: socialwindow.h:156

◆ widgetResized()

void SocialWindow::widgetResized ( const Event event)
virtual

Called whenever the widget changes size.

Reimplemented from Window.

Definition at line 623 of file socialwindow.cpp.

References TabbedArea::adjustSize(), mTabs, and Window::widgetResized().

Referenced by postInit(), and setProcessedPortals().

624 {
625  Window::widgetResized(event);
626  if (mTabs != nullptr)
627  mTabs->adjustSize();
628 }
void widgetResized(const Event &event)
Definition: window.cpp:654
void adjustSize()
Definition: tabbedarea.cpp:568
TabbedArea * mTabs
Definition: socialwindow.h:161

Friends And Related Function Documentation

◆ SocialTab

friend class SocialTab
friend

Definition at line 138 of file socialwindow.h.

Field Documentation

◆ mAttackFilter

SocialTab* SocialWindow::mAttackFilter
protected

Definition at line 153 of file socialwindow.h.

Referenced by postInit(), updateAttackFilter(), and ~SocialWindow().

◆ mCountLabel

Label* SocialWindow::mCountLabel
protected

Definition at line 160 of file socialwindow.h.

Referenced by postInit(), and updateCounter().

◆ mFriends

SocialTab* SocialWindow::mFriends
protected

Definition at line 157 of file socialwindow.h.

Referenced by postInit(), slowLogic(), and ~SocialWindow().

◆ mGuildAcceptDialog

ConfirmDialog* SocialWindow::mGuildAcceptDialog
protected

Definition at line 145 of file socialwindow.h.

Referenced by action(), showGuildInvite(), and ~SocialWindow().

◆ mGuildCreateDialog

TextDialog* SocialWindow::mGuildCreateDialog
protected

Definition at line 146 of file socialwindow.h.

◆ mGuildInvited

int SocialWindow::mGuildInvited
protected

Definition at line 144 of file socialwindow.h.

Referenced by action(), showGuildInvite(), and ~SocialWindow().

◆ mGuilds

GuildMap SocialWindow::mGuilds
protected

Definition at line 148 of file socialwindow.h.

Referenced by addTab(), removeTab(), updateGuildCounter(), and ~SocialWindow().

◆ mLastUpdateTime

time_t SocialWindow::mLastUpdateTime
protected

Definition at line 164 of file socialwindow.h.

Referenced by slowLogic().

◆ mMap

Map* SocialWindow::mMap
protected

Definition at line 162 of file socialwindow.h.

Referenced by getMap(), and setMap().

◆ mMenuButton

Button* SocialWindow::mMenuButton
protected

Definition at line 159 of file socialwindow.h.

Referenced by postInit(), and updateMenu().

◆ mNavigation

SocialTab* SocialWindow::mNavigation
protected

◆ mNeedUpdate

bool SocialWindow::mNeedUpdate
protected

Definition at line 166 of file socialwindow.h.

Referenced by slowLogic(), updateActiveList(), updateAll(), and updatedPlayer().

◆ mParties

PartyMap SocialWindow::mParties
protected

Definition at line 149 of file socialwindow.h.

Referenced by addTab(), removeTab(), updateParty(), and ~SocialWindow().

◆ mPartyAcceptDialog

ConfirmDialog* SocialWindow::mPartyAcceptDialog
protected

Definition at line 151 of file socialwindow.h.

Referenced by action(), showPartyInvite(), and ~SocialWindow().

◆ mPartyId

int SocialWindow::mPartyId
protected

Definition at line 165 of file socialwindow.h.

Referenced by action(), and showPartyInvite().

◆ mPartyInviter

std::string SocialWindow::mPartyInviter
protected

Definition at line 147 of file socialwindow.h.

Referenced by action(), showPartyInvite(), and ~SocialWindow().

◆ mPickupFilter

SocialTab* SocialWindow::mPickupFilter
protected

Definition at line 154 of file socialwindow.h.

Referenced by postInit(), updatePickupFilter(), and ~SocialWindow().

◆ mPlayers

SocialTab* SocialWindow::mPlayers
protected

Definition at line 155 of file socialwindow.h.

Referenced by postInit(), resetDamage(), slowLogic(), updateAvatar(), and ~SocialWindow().

◆ mProcessedPortals

bool SocialWindow::mProcessedPortals
protected

Definition at line 167 of file socialwindow.h.

Referenced by getProcessedPortals(), setMap(), and setProcessedPortals().

◆ mTabs

TabbedArea* SocialWindow::mTabs
protected

The documentation for this class was generated from the following files: