88 std::unique_ptr<AvatarListBox>
mList;
101 mList = std::make_unique<AvatarListBox>(guild);
104 mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
105 mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
108 void action(
const gcn::ActionEvent &event)
override
110 if (event.getId() ==
"do invite")
123 else if (event.getId() ==
"~do invite")
127 else if (event.getId() ==
"yes")
134 else if (event.getId() ==
"no")
145 strprintf(
_(
"Who would you like to invite to guild %s?"),
155 strprintf(
_(
"Are you sure you want to leave guild %s?"),
176 mList = std::make_unique<AvatarListBox>(party);
179 mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
180 mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
183 void action(
const gcn::ActionEvent &event)
override
185 if (event.getId() ==
"do invite")
194 else if (event.getId() ==
"~do invite")
198 else if (event.getId() ==
"yes")
205 else if (event.getId() ==
"no")
216 strprintf(
_(
"Who would you like to invite to party %s?"),
226 strprintf(
_(
"Are you sure you want to leave party %s?"),
278 mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
279 mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
309 Popup(
"SocialCreatePopup")
333 else if (link ==
"party")
344 parent->getAbsolutePosition(x, y);
345 y += parent->getHeight();
377 int width = 0, height = 0;
483 const std::string &eventId =
event.getId();
488 if (eventId ==
"yes")
494 else if (eventId ==
"no")
507 if (eventId ==
"yes")
512 else if (eventId ==
"no")
521 else if (event.getId() ==
"create")
528 else if (event.getId() ==
"invite" &&
mTabs->getSelectedTabIndex() > -1)
532 else if (event.getId() ==
"leave" &&
mTabs->getSelectedTabIndex() > -1)
536 else if (event.getId() ==
"create guild")
540 if (name.size() > 16)
556 else if (event.getId() ==
"~create guild")
560 else if (event.getId() ==
"create party")
564 if (name.size() > 16)
580 else if (event.getId() ==
"~create party")
589 _(
"Choose your guild's name."),
this);
596 const std::string &inviterName)
601 serverNotice(
_(
"Received guild request, but one already exists."));
605 std::string msg =
strprintf(
_(
"%s has invited you to join the guild %s."),
606 inviterName.c_str(), guildName.c_str());
617 const std::string &partyName)
622 serverNotice(
_(
"Received party request, but one already exists."));
629 if (partyName.empty())
631 msg =
_(
"You have been invited you to join a party.");
635 msg =
strprintf(
_(
"You have been invited to join the %s party."),
641 if (partyName.empty())
643 msg =
strprintf(
_(
"%s has invited you to join their party."),
648 msg =
strprintf(
_(
"%s has invited you to join the %s party."),
649 inviter.c_str(), partyName.c_str());
667 _(
"Cannot create party. You are already in a party."),
673 _(
"Choose your party's name."),
this);
682 unsigned playerCount =
static_cast<unsigned>(players.size());
A simple browser box able to handle links and forward events to the parent conteiner.
void setHighlightMode(unsigned int mode)
Sets the Highlight mode for links.
void addRow(std::string_view row)
Adds a text row to the browser.
void setLinkHandler(LinkHandler *handler)
Sets the handler for links.
void action(const gcn::ActionEvent &event) override
const std::string & getName() const
Get the name of the guild.
short getId() const
Get the id of the guild.
void reflow(int &nW, int &nH)
Sets the positions of all the widgets.
A simple interface to windows that need to handle links from BrowserBox widget.
virtual void requestOnlineList()=0
virtual void inviteResponse(int guildId, bool response)=0
virtual void create(const std::string &name)=0
virtual void invite(int guildId, const std::string &name)=0
virtual void leave(int guildId)=0
virtual void create(const std::string &name=std::string())=0
virtual void inviteResponse(const std::string &inviter, bool accept)=0
void action(const gcn::ActionEvent &event) override
const std::string & getName() const
Get the name of the party.
void setPlayers(const std::vector< Avatar * > &players)
~PlayerListTab() override
std::vector< Avatar * > mPlayers
Avatar * getAvatarAt(int index) override
int getNumberOfElements() override
Returns the number of players in the list.
void setPlayers(const std::vector< Avatar * > &players)
void registerWindowForReset(Window *window)
Enables the Reset Windows button.
ConfirmDialog * mConfirmDialog
TextDialog * mInviteDialog
std::unique_ptr< ScrollArea > mScroll
std::unique_ptr< AvatarListBox > mList
void showGuildInvite(const std::string &guildName, int guildId, const std::string &inviterName)
std::map< Guild *, SocialTab * > mGuilds
CreatePopup * mCreatePopup
ConfirmDialog * mPartyAcceptDialog
std::string mPartyInviter
TextDialog * mGuildCreateDialog
bool removeTab(Guild *guild)
std::map< Party *, SocialTab * > mParties
TextDialog * mPartyCreateDialog
ConfirmDialog * mGuildAcceptDialog
bool addTab(Guild *guild)
void action(const gcn::ActionEvent &event) override
Handle events.
Timer mOnlineListUpdateTimer
PlayerListTab * mPlayerListTab
void showPartyInvite(const std::string &inviter, const std::string &partyName=std::string())
void setPlayersOnline(const std::vector< Avatar * > &players)
A tab, the same as the Guichan tab in 0.8, but extended to allow transparency.
void setCaption(const std::string &caption)
Sets the caption of the tab.
void setTabColor(const gcn::Color *color)
Set the normal color fo the tab's text.
A tabbed area, the same as the guichan tabbed area in 0.8, but extended.
void addTab(gcn::Tab *tab, gcn::Widget *widget) override
Add a tab.
void removeTab(gcn::Tab *tab) override
Override the remove tab function as it's broken in guichan 0.8.
int getNumberOfTabs() const
Return how many tabs have been created.
const std::string & getText() const
Get the text in the textfield.
static const gcn::Color & getThemeColor(int type)
Gets the color associated with the type in the default palette (0).
bool passed() const
Returns whether the timer has passed.
void set(uint32_t ms=0)
Sets the timer with an optional duration in milliseconds.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
virtual void close()
Overrideable functionality for when the window is to close.
Layout & getLayout()
Gets the layout handler for this window.
void setWindowName(const std::string &name)
Sets the name of the window.
void setMinimumContentSize(int width, int height)
Sets the minimum size of the window content.
void setResizable(bool resize)
Sets whether or not the window can be resized.
void setSaveVisible(bool save)
Sets whether the window will save it's visibility.
LayoutCell & place(int x, int y, gcn::Widget *, int w=1, int h=1)
Adds a widget to the window and sets it at given cell.
void scheduleDelete()
Schedule this window for deletion.
void setCloseButton(bool flag)
Sets whether or not the window has a close button.
void setDefaultSize()
Set the default win pos and size to the current ones.
void loadWindowState()
Reads the position (and the size for resizable windows) in the configuration based on the given strin...
void delete_all(Container &c)
void serverNotice(const std::string &message)
SocialWindow * socialWindow
LocalPlayer * local_player
ChatHandler * getChatHandler()
GuildHandler * getGuildHandler()
PartyHandler * getPartyHandler()
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.