summaryrefslogtreecommitdiff
path: root/src/gui/selldialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-11 02:48:10 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-11 02:48:10 +0300
commit0b20f61d590d82468d14e564da14444a80ab2c76 (patch)
treee9f549a57ee2a83d5643388f24f5352208a1c2fd /src/gui/selldialog.cpp
parent62a7ad8a4f8cc297c8a0eb6468fb27086de368d0 (diff)
downloadmanaverse-0b20f61d590d82468d14e564da14444a80ab2c76.tar.gz
manaverse-0b20f61d590d82468d14e564da14444a80ab2c76.tar.bz2
manaverse-0b20f61d590d82468d14e564da14444a80ab2c76.tar.xz
manaverse-0b20f61d590d82468d14e564da14444a80ab2c76.zip
Add support for double click in buy and sell dialog.
Diffstat (limited to 'src/gui/selldialog.cpp')
-rw-r--r--src/gui/selldialog.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 06b622930..e299362cc 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -105,8 +105,12 @@ void SellDialog::init()
mSellButton->setEnabled(false);
mSlider->setEnabled(false);
+ mShopItemList->setDistributeMousePressed(false);
mShopItemList->setPriceCheck(false);
mShopItemList->addSelectionListener(this);
+ mShopItemList->setActionEventId("sell");
+ mShopItemList->addActionListener(this);
+
mSlider->setActionEventId("slider");
mSlider->addActionListener(this);
@@ -174,7 +178,9 @@ void SellDialog::addItem(const int id, const unsigned char color,
void SellDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "quit")
+ const std::string &eventId = event.getId();
+
+ if (eventId == "quit")
{
close();
return;
@@ -183,36 +189,36 @@ void SellDialog::action(const gcn::ActionEvent &event)
const int selectedItem = mShopItemList->getSelected();
// The following actions require a valid item selection
- if (selectedItem == -1 ||
- selectedItem >= mShopItems->getNumberOfElements())
+ if (selectedItem == -1
+ || selectedItem >= mShopItems->getNumberOfElements())
{
return;
}
- if (event.getId() == "slider")
+ if (eventId == "slider")
{
mAmountItems = static_cast<int>(mSlider->getValue());
updateButtonsAndLabels();
}
- else if (event.getId() == "inc" && mAmountItems < mMaxItems)
+ else if (eventId == "inc" && mAmountItems < mMaxItems)
{
mAmountItems++;
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
- else if (event.getId() == "dec" && mAmountItems > 1)
+ else if (eventId == "dec" && mAmountItems > 1)
{
mAmountItems--;
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
- else if (event.getId() == "max")
+ else if (eventId == "max")
{
mAmountItems = mMaxItems;
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
- else if (event.getId() == "sell" && mAmountItems > 0
+ else if (eventId == "sell" && mAmountItems > 0
&& mAmountItems <= mMaxItems)
{
if (mNpcId != -1)