summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-26 08:24:01 -0700
committerIra Rice <irarice@gmail.com>2009-02-26 08:24:01 -0700
commit0ffbbaa33f633bccf3b2a49713eb1cb117ff8a5a (patch)
tree51cec1c070c97b7d03120254710da1577daf5f92 /src/gui
parent0dde31c3db09113639fa443142995b6efcff6646 (diff)
downloadmana-0ffbbaa33f633bccf3b2a49713eb1cb117ff8a5a.tar.gz
mana-0ffbbaa33f633bccf3b2a49713eb1cb117ff8a5a.tar.bz2
mana-0ffbbaa33f633bccf3b2a49713eb1cb117ff8a5a.tar.xz
mana-0ffbbaa33f633bccf3b2a49713eb1cb117ff8a5a.zip
Fixed an error in shoplistboxes as identified by Octalot.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp2
-rw-r--r--src/gui/buy.h2
-rw-r--r--src/gui/listbox.cpp3
-rw-r--r--src/gui/listbox.h10
-rw-r--r--src/gui/sell.cpp2
-rw-r--r--src/gui/shop.cpp3
-rw-r--r--src/gui/shoplistbox.cpp9
-rw-r--r--src/gui/shoplistbox.h2
8 files changed, 11 insertions, 22 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index a2485ca1..5a57dcc6 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -118,7 +118,7 @@ void BuyDialog::reset()
setMoney(0);
}
-void BuyDialog::addItem(short id, int price)
+void BuyDialog::addItem(int id, int price)
{
mShopItems->addItem(id, price);
mShopItemList->adjustSize();
diff --git a/src/gui/buy.h b/src/gui/buy.h
index b05608c0..9029fe9d 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -69,7 +69,7 @@ class BuyDialog : public Window, public gcn::ActionListener,
/**
* Adds an item to the shop inventory.
*/
- void addItem(short id, int price);
+ void addItem(int id, int price);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 8ae68e09..45d14884 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -56,7 +56,7 @@ void ListBox::draw(gcn::Graphics *graphics)
const int fontHeight = getFont()->getHeight();
- // Draw rectangle below the selected list element
+ // Draw filled rectangle around the selected list element
if (mSelected >= 0)
graphics->fillRectangle(gcn::Rectangle(0, fontHeight * mSelected,
getWidth(), fontHeight));
@@ -97,6 +97,7 @@ void ListBox::setSelected(int selected)
mSelected = selected;
}
}
+ gcn::ListBox::setSelected(mSelected);
}
// -- KeyListener notifications
diff --git a/src/gui/listbox.h b/src/gui/listbox.h
index a6392a94..09f00cdf 100644
--- a/src/gui/listbox.h
+++ b/src/gui/listbox.h
@@ -47,17 +47,17 @@ class ListBox : public gcn::ListBox
*/
void draw(gcn::Graphics *graphics);
- void mouseDragged(gcn::MouseEvent &event);
-
// Inherited from KeyListener
- virtual void keyPressed(gcn::KeyEvent& keyEvent);
+ void keyPressed(gcn::KeyEvent& keyEvent);
// Inherited from MouseListener
- virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
- virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+
+ void mouseDragged(gcn::MouseEvent &event);
/**
* Sets the selected item. The selected item is represented by
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index f974f247..154d1a57 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -121,7 +121,7 @@ void SellDialog::addItem(const Item *item, int price)
}
mShopItems->addItem(item->getInvIndex(), item->getId(),
- item->getQuantity(), price);
+ item->getQuantity(), price);
mShopItemList->adjustSize();
}
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index da68cf28..bd676bc0 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -44,8 +44,7 @@ std::string ShopItems::getElementAt(int i)
return mShopItems.at(i)->getDisplayName();
}
-void ShopItems::addItem(int inventoryIndex, int id, int quantity,
- int price)
+void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price)
{
ShopItem* item = 0;
if (mMergeDuplicates)
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 6d3d9464..6e70e022 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -108,15 +108,6 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
}
}
-void ShopListBox::mousePressed(gcn::MouseEvent &event)
-{
- if (event.getButton() == gcn::MouseEvent::LEFT)
- {
- setSelected(event.getY() / mRowHeight);
- distributeActionEvent();
- }
-}
-
void ShopListBox::adjustSize()
{
if (mListModel)
diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h
index 8542a7b8..bed9902b 100644
--- a/src/gui/shoplistbox.h
+++ b/src/gui/shoplistbox.h
@@ -57,8 +57,6 @@ class ShopListBox : public ListBox
*/
unsigned int getRowHeight() const { return mRowHeight; }
- void mousePressed(gcn::MouseEvent &event);
-
/**
* gives information about the current player's money
*/