52#include <guichan/font.hpp>
58static const int SLOTS_PER_ROW = 5;
68 _(
"Are you sure you want to delete this character?"), m),
74 void action(
const gcn::ActionEvent &event)
override
76 if (event.getId() ==
"yes")
99 void mouseMoved(gcn::MouseEvent &event)
override;
122 Window(
_(
"Account and Character Management")),
124 mCharHandler(
Net::getCharHandler())
146 "change_email",
this);
169 addKeyListener(
this);
183 const gcn::Widget *sourceParent =
event.getSource()->getParent();
194 const std::string &eventId =
event.getId();
198 if (eventId ==
"use")
202 else if (eventId ==
"new"
206 auto *charCreateDialog =
210 else if (eventId ==
"delete"
216 else if (eventId ==
"switch")
220 else if (eventId ==
"change_password")
224 else if (eventId ==
"change_email")
228 else if (eventId ==
"unregister")
236 gcn::Key key = keyEvent.getKey();
274 characterEntry->setCharacter(
nullptr);
276 for (
auto character : characters)
279 int characterSlot = character->slot;
285 Log::warn(
"Slot out of range: %d", character->slot);
316 characterEntry->setActive(!
mLocked);
329 if (character->dummy->getName() == name)
351 mName->setAlignment(Graphics::CENTER);
362 setSize(80, 112 +
mName->getHeight()
399 mButton->setActionEventId(
"use");
406 mButton->setActionEventId(
"new");
407 mName->setCaption(
_(
"(empty)"));
412 distributeResizedEvent();
417 int x =
event.getX();
418 int y =
event.getY();
const std::string & getName() const
Returns the name of the being.
Character creation dialog.
Listener for confirming character deletion.
CharSelectDialog * mMaster
void action(const gcn::ActionEvent &event) override
CharDeleteConfirm(CharSelectDialog *m, int index)
Character selection dialog.
std::vector< CharacterDisplay * > mCharacterEntries
The player boxes.
void keyPressed(gcn::KeyEvent &keyEvent) override
void attemptCharacterSelect(int index)
Communicate character selection to the server.
void setLocked(bool locked)
gcn::Button * mChangeEmailButton
gcn::Button * mUnregisterButton
Net::CharHandler * mCharHandler
void attemptCharacterDelete(int index)
Communicate character deletion to the server.
CharSelectDialog(LoginData *loginData)
~CharSelectDialog() override
friend class CharDeleteConfirm
void setCharacters(const Net::Characters &characters)
gcn::Button * mChangePasswordButton
void action(const gcn::ActionEvent &event) override
gcn::Label * mAccountNameLabel
bool selectByName(const std::string &name, SelectAction action=Focus)
Attempt to select the character with the given name.
gcn::Button * mSwitchLoginButton
void requestFocus() override
void setCharacter(Net::Character *character)
Net::Character * getCharacter() const
static TextPopup * mTextPopup
The character info popup.
void mouseMoved(gcn::MouseEvent &event) override
void mouseExited(gcn::MouseEvent &event) override
CharacterDisplay(CharSelectDialog *charSelectDialog)
void setActive(bool active)
Net::Character * mCharacter
static void setState(State state)
void action(const gcn::ActionEvent &event) override
Called when receiving actions from the widgets.
This class is a helper for adding widgets to nested tables in a window.
LayoutCell & place(int x, int y, gcn::Widget *wg, int w=1, int h=1)
Adds a widget to the container and sets it at given cell.
The local player character.
unsigned short characterSlots
The number of character slots.
virtual void chooseCharacter(Net::Character *character)=0
virtual void setCharSelectDialog(CharSelectDialog *window)=0
virtual void setCharCreateDialog(CharCreateDialog *window)=0
virtual void deleteCharacter(Net::Character *character)=0
virtual int supportedOptionalActions() const =0
A box showing a player character.
void setPlayer(const Being *being)
Sets a new player character to be displayed by this box.
static std::string formatCurrency(int value)
Formats the given number in the correct currency format.
void center()
Positions the window in the center of it's parent.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
ContainerPlacer getPlacer(int x, int y)
Returns a proxy for adding widgets in an inner table of the layout.
void reflowLayout(int w=0, int h=0)
Computes the position of the widgets according to the current layout.
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 setCloseButton(bool flag)
Sets whether or not the window has a close button.
void warn(const char *log_text,...) LOG_PRINTF_ATTR
The network communication layer.
LoginHandler * getLoginHandler()
ServerType getNetworkType()
std::list< Character * > Characters
CharHandler * getCharHandler()
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
A structure to hold information about a character.
LocalPlayer * dummy
A dummy representing this character.
std::map< int, int > mAttributes