summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-05-06 03:01:40 +0000
committerAaron Marks <nymacro@gmail.com>2005-05-06 03:01:40 +0000
commitf2105401aea25f663392e947ca618d48272ee489 (patch)
tree672c31b6f1df9577056d9b7439f7d3bd1578eeb3 /src/gui/buy.cpp
parentf2a70bcfbaab713145d4af9cabfc344b665d1c61 (diff)
downloadmana-client-f2105401aea25f663392e947ca618d48272ee489.tar.gz
mana-client-f2105401aea25f663392e947ca618d48272ee489.tar.bz2
mana-client-f2105401aea25f663392e947ca618d48272ee489.tar.xz
mana-client-f2105401aea25f663392e947ca618d48272ee489.zip
Added item description for selected item in buy dialog.
Diffstat (limited to 'src/gui/buy.cpp')
-rw-r--r--src/gui/buy.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 296a45ad..e55866fb 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -43,15 +43,20 @@ BuyDialog::BuyDialog():
okButton = new Button("OK");
cancelButton = new Button("Cancel");
okButton->setEnabled(false);
+ itemNameLabel = new gcn::Label("Name:");
+ itemDescLabel = new gcn::Label("Description:");
- setContentSize(260, 175);
+ setContentSize(260, 198);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
itemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
slider->setDimension(gcn::Rectangle(5, 120, 200, 10));
quantityLabel->setPosition(215, 120);
- moneyLabel->setPosition(5, 135);
- okButton->setPosition(180, 145);
- cancelButton->setPosition(208, 145);
+ moneyLabel->setPosition(5, 133);
+ okButton->setPosition(180, 174);
+ cancelButton->setPosition(208, 174);
+
+ itemNameLabel->setDimension(gcn::Rectangle(5, 145, 240, 14));
+ itemDescLabel->setDimension(gcn::Rectangle(5, 157, 240, 14));
itemList->setEventId("item");
slider->setEventId("slider");
@@ -63,12 +68,15 @@ BuyDialog::BuyDialog():
okButton->addActionListener(this);
cancelButton->addActionListener(this);
+
add(scrollArea);
add(slider);
add(quantityLabel);
add(moneyLabel);
add(okButton);
add(cancelButton);
+ add(itemNameLabel);
+ add(itemDescLabel);
setLocationRelativeTo(getParent());
}
@@ -81,6 +89,8 @@ BuyDialog::~BuyDialog()
delete slider;
delete itemList;
delete scrollArea;
+ delete itemNameLabel;
+ delete itemDescLabel;
}
void BuyDialog::setMoney(int amount)
@@ -154,6 +164,21 @@ void BuyDialog::action(const std::string& eventId)
}
}
+void BuyDialog::mouseClick(int x, int y, int button, int count)
+{
+ Window::mouseClick(x, y, button, count);
+
+// shopInventory[selectedItem];
+ int selectedItem = itemList->getSelected();
+ if (selectedItem > -1)
+ {
+ itemNameLabel->setCaption("Name: " +
+ itemDb.getItemInfo(shopInventory[selectedItem].id)->getName());
+ itemDescLabel->setCaption("Description: " +
+ itemDb.getItemInfo(shopInventory[selectedItem].id)->getDescription());
+ }
+}
+
int BuyDialog::getNumberOfElements()
{
return shopInventory.size();