summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-06 22:50:39 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-06 22:50:39 +0300
commit671ca11caba0dc80636ff76035f55b6b8fc3893e (patch)
treeb221225d8e827a4d559c4724fc0c9829f809dfb2
parent9505f6b7d5a64fb59ba177fd72f9eb83f7d37d9a (diff)
downloadmanaplus-671ca11caba0dc80636ff76035f55b6b8fc3893e.tar.gz
manaplus-671ca11caba0dc80636ff76035f55b6b8fc3893e.tar.bz2
manaplus-671ca11caba0dc80636ff76035f55b6b8fc3893e.tar.xz
manaplus-671ca11caba0dc80636ff76035f55b6b8fc3893e.zip
Add equip button to outfits window.
-rw-r--r--src/gui/outfitwindow.cpp33
-rw-r--r--src/gui/outfitwindow.h1
2 files changed, 22 insertions, 12 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 8b498f46c..fafb69896 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -78,9 +78,9 @@ OutfitWindow::OutfitWindow():
setCloseButton(true);
setStickyButtonLock(true);
- setDefaultSize(250, 400, 150, 230);
+ setDefaultSize(250, 400, 150, 290);
setMinWidth(145);
- setMinHeight(260);
+ setMinHeight(283);
mBorderColor = Theme::getThemeColor(Theme::BORDER, 64);
mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND, 32);
@@ -94,6 +94,7 @@ OutfitWindow::OutfitWindow():
mKeyLabel->setAlignment(gcn::Graphics::CENTER);
mUnequipCheck = new CheckBox(_("Unequip first"),
serverConfig.getValueBool("OutfitUnequip0", true));
+ mEquipButtom = new Button(_("Equip"), "equip", this);
mAwayOutfitCheck = new CheckBox(_("Away outfit"),
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1));
@@ -104,12 +105,13 @@ OutfitWindow::OutfitWindow():
mAwayOutfitCheck->setActionEventId("away");
mAwayOutfitCheck->addActionListener(this);
- place(0, 3, mKeyLabel, 4);
- place(0, 4, mPreviousButton, 1);
- place(1, 4, mCurrentLabel, 2);
- place(3, 4, mNextButton, 1);
- place(0, 5, mUnequipCheck, 4);
- place(0, 6, mAwayOutfitCheck, 4);
+ place(1, 3, mEquipButtom, 2);
+ place(0, 4, mKeyLabel, 4);
+ place(0, 5, mPreviousButton, 1);
+ place(1, 5, mCurrentLabel, 2);
+ place(3, 5, mNextButton, 1);
+ place(0, 6, mUnequipCheck, 4);
+ place(0, 7, mAwayOutfitCheck, 4);
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
@@ -228,20 +230,27 @@ void OutfitWindow::save()
void OutfitWindow::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "next")
+ const std::string eventId = event.getId();
+ if (eventId == "next")
{
next();
}
- else if (event.getId() == "previous")
+ else if (eventId == "previous")
{
previous();
}
- else if (event.getId() == "unequip")
+ else if (eventId == "unequip")
{
if (mCurrentOutfit < OUTFITS_COUNT)
mItemsUnequip[mCurrentOutfit] = mUnequipCheck->isSelected();
}
- else if (event.getId() == "away")
+ else if (eventId == "equip")
+ {
+ wearOutfit(mCurrentOutfit);
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ }
+ else if (eventId == "away")
{
mAwayOutfit = mCurrentOutfit;
if (!mAwayOutfitCheck->isSelected())
diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h
index 29751f488..5c5e4778e 100644
--- a/src/gui/outfitwindow.h
+++ b/src/gui/outfitwindow.h
@@ -109,6 +109,7 @@ class OutfitWindow : public Window, gcn::ActionListener
private:
Button *mPreviousButton;
Button *mNextButton;
+ Button *mEquipButtom;
Label *mCurrentLabel;
CheckBox *mUnequipCheck;
CheckBox *mAwayOutfitCheck;