From cff9f1947bac8fa49aaf6f846a6e4335a439ac2e Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 4 Oct 2009 12:27:07 -0600 Subject: Add ability to delect characters from account --- src/gui/charselectdialog.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/gui/charselectdialog.cpp') diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 2fe83849..43748765 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -115,6 +115,7 @@ class CharEntry : public Container Label *mName; Label *mMoney; Button *mButton; + Button *mDelete; }; CharSelectDialog::CharSelectDialog(LockedArray *charInfo, @@ -169,6 +170,8 @@ CharSelectDialog::CharSelectDialog(LockedArray *charInfo, center(); mCharEntries[0]->requestFocus(); setVisible(true); + + Net::getCharHandler()->setCharSelectDialog(this); } void CharSelectDialog::action(const gcn::ActionEvent &event) @@ -295,6 +298,8 @@ CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr): mName = new Label("wwwwwwwwwwwwwwwwwwwwwwww (888)"); mMoney = new Label("wwwwwwwww"); + mDelete = new Button(_("Delete"), "delete", m); + LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); @@ -302,9 +307,10 @@ CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr): place(0, 5, mName, 3); place(0, 6, mMoney, 3); place(0, 7, mButton, 3); + place(0, 8, mDelete, 3); - h.reflowLayout(65, 120 + mName->getHeight() + mMoney->getHeight() + - mButton->getHeight()); + h.reflowLayout(74, 123 + mName->getHeight() + mMoney->getHeight() + + mButton->getHeight() + mDelete->getHeight()); update(); } @@ -313,8 +319,7 @@ void CharEntry::setChar(LocalPlayer *chr) { mCharacter = chr; - if (chr) - mPlayerBox->setPlayer(chr); + mPlayerBox->setPlayer(chr); update(); } @@ -333,6 +338,8 @@ void CharEntry::update() mName->setCaption(strprintf("%s (%d)", mCharacter->getName().c_str(), mCharacter->getLevel())); mMoney->setCaption(Units::formatCurrency(mCharacter->getMoney())); + + mDelete->setVisible(true); } else { @@ -340,6 +347,8 @@ void CharEntry::update() mButton->setActionEventId("new"); mName->setCaption(_("(empty)")); mMoney->setCaption(Units::formatCurrency(0)); + + mDelete->setVisible(false); } // Recompute layout -- cgit v1.2.3-70-g09d2