From f842e0b40d8382011f0bc46b1446945d99ac0425 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 14 Jan 2007 14:54:39 +0000 Subject: Upgraded to Guichan 0.6.0 (merge from guichan-0.6.0 branch). --- src/gui/buy.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui/buy.cpp') diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index c701499c..a8a1ea7e 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -85,8 +85,8 @@ BuyDialog::BuyDialog(Network *network): mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14)); mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14)); - mShopItemList->setEventId("item"); - mSlider->setEventId("slider"); + mShopItemList->setActionEventId("item"); + mSlider->setActionEventId("slider"); mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); @@ -143,11 +143,11 @@ void BuyDialog::addItem(short id, int price) mShopItemList->adjustSize(); } -void BuyDialog::action(const std::string& eventId, gcn::Widget* widget) +void BuyDialog::action(const gcn::ActionEvent &event) { int selectedItem = mShopItemList->getSelected(); - if (eventId == "quit") + if (event.getId() == "quit") { setVisible(false); current_npc = 0; @@ -161,12 +161,12 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget) bool updateButtonsAndLabels = false; - if (eventId == "slider") + if (event.getId() == "slider") { mAmountItems = (int)(mSlider->getValue() * mMaxItems); updateButtonsAndLabels = true; } - else if (eventId == "+") + else if (event.getId() == "+") { if (mAmountItems < mMaxItems) { mAmountItems++; @@ -177,7 +177,7 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget) mSlider->setValue(double(mAmountItems)/double(mMaxItems)); updateButtonsAndLabels = true; } - else if (eventId == "-") + else if (event.getId() == "-") { if (mAmountItems > 0) { mAmountItems--; @@ -191,7 +191,7 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget) // TODO: Actually we'd have a bug elsewhere if this check for the number // of items to be bought ever fails, Bertram removed the assertions, is // there a better way to ensure this fails in an _obivous_ way in C++? - else if (eventId == "buy" && (mAmountItems > 0 && + else if (event.getId() == "buy" && (mAmountItems > 0 && mAmountItems <= mMaxItems)) { MessageOut outMsg(mNetwork); -- cgit v1.2.3-70-g09d2