summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/buy.cpp5
-rw-r--r--src/gui/sell.cpp77
-rw-r--r--src/gui/sell.h8
3 files changed, 19 insertions, 71 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index a122783e..b95a8b25 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -64,7 +64,6 @@ BuyDialog::BuyDialog():
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
- mQuantityLabel->setWidth(60);
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mIncreaseButton->setEnabled(false);
@@ -72,11 +71,9 @@ BuyDialog::BuyDialog():
mBuyButton->setEnabled(false);
mSlider->setEnabled(false);
- mShopItemList->setActionEventId("item");
mSlider->setActionEventId("slider");
-
- mShopItemList->addSelectionListener(this);
mSlider->addActionListener(this);
+ mShopItemList->addSelectionListener(this);
place(0, 0, mScrollArea, 5).setPadding(3);
place(0, 1, mQuantityLabel, 2);
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index ff6fa17f..8c442aad 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -33,6 +33,8 @@
#include "shop.h"
#include "slider.h"
+#include "widgets/layout.h"
+
#include "../item.h"
#include "../npc.h"
#include "../net/gameserver/player.h"
@@ -66,7 +68,6 @@ SellDialog::SellDialog():
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
- mQuantityLabel->setWidth(60);
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mIncreaseButton->setEnabled(false);
@@ -75,25 +76,24 @@ SellDialog::SellDialog():
mSlider->setEnabled(false);
mShopItemList->setPriceCheck(false);
- mShopItemList->setActionEventId("item");
- mSlider->setActionEventId("slider");
-
- mShopItemList->addActionListener(this);
mShopItemList->addSelectionListener(this);
+ mSlider->setActionEventId("slider");
mSlider->addActionListener(this);
- add(mScrollArea);
- add(mSlider);
- add(mQuantityLabel);
- add(mMoneyLabel);
- add(mItemEffectLabel);
- add(mItemDescLabel);
- add(mIncreaseButton);
- add(mDecreaseButton);
- add(mSellButton);
- add(mQuitButton);
-
- addWindowListener(this);
+ place(0, 0, mScrollArea, 5).setPadding(3);
+ place(0, 1, mQuantityLabel, 2);
+ place(2, 1, mSlider, 3);
+ place(0, 2, mMoneyLabel, 5);
+ place(0, 3, mItemEffectLabel, 5);
+ place(0, 4, mItemDescLabel, 5);
+ place(0, 5, mDecreaseButton);
+ place(1, 5, mIncreaseButton);
+ place(3, 5, mSellButton);
+ place(4, 5, mQuitButton);
+ Layout &layout = getLayout();
+ layout.setRowHeight(0, Layout::FILL);
+ layout.setColWidth(2, Layout::FILL);
+
loadWindowState("Sell");
setLocationRelativeTo(getParent());
}
@@ -193,49 +193,6 @@ void SellDialog::selectionChanged(const SelectionEvent &event)
mSlider->gcn::Slider::setScale(1, mMaxItems);
}
-void SellDialog::windowResized(const WindowEvent &event)
-{
- gcn::Rectangle area = getChildrenArea();
- int width = area.width;
- int height = area.height;
-
- mDecreaseButton->setPosition(8, height - 8 - mDecreaseButton->getHeight());
- mIncreaseButton->setPosition(
- mDecreaseButton->getX() + mDecreaseButton->getWidth() + 5,
- mDecreaseButton->getY());
-
- mQuitButton->setPosition(
- width - 8 - mQuitButton->getWidth(),
- height - 8 - mQuitButton->getHeight());
- mSellButton->setPosition(
- mQuitButton->getX() - 5 - mSellButton->getWidth(),
- mQuitButton->getY());
-
- mItemDescLabel->setDimension(gcn::Rectangle(8,
- mSellButton->getY() - 5 - mItemDescLabel->getHeight(),
- width - 16,
- mItemDescLabel->getHeight()));
- mItemEffectLabel->setDimension(gcn::Rectangle(8,
- mItemDescLabel->getY() - 5 - mItemEffectLabel->getHeight(),
- width - 16,
- mItemEffectLabel->getHeight()));
- mMoneyLabel->setDimension(gcn::Rectangle(8,
- mItemEffectLabel->getY() - 5 - mMoneyLabel->getHeight(),
- width - 16,
- mMoneyLabel->getHeight()));
-
- mQuantityLabel->setPosition(
- width - mQuantityLabel->getWidth() - 8,
- mMoneyLabel->getY() - 5 - mQuantityLabel->getHeight());
- mSlider->setDimension(gcn::Rectangle(8,
- mQuantityLabel->getY(),
- mQuantityLabel->getX() - 8 - 8,
- 10));
-
- mScrollArea->setDimension(gcn::Rectangle(8, 8, width - 16,
- mSlider->getY() - 5 - 8));
-}
-
void SellDialog::setMoney(int amount)
{
mPlayerMoney = amount;
diff --git a/src/gui/sell.h b/src/gui/sell.h
index d1e2ddd2..cde862d5 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -41,8 +41,7 @@ class ShopListBox;
*
* \ingroup Interface
*/
-class SellDialog : public Window, gcn::ActionListener, SelectionListener,
- WindowListener
+class SellDialog : public Window, gcn::ActionListener, SelectionListener
{
public:
/**
@@ -80,11 +79,6 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener,
void selectionChanged(const SelectionEvent &event);
/**
- * Called whenever the window is resized.
- */
- void windowResized(const WindowEvent &event);
-
- /**
* Gives Player's Money amount
*/
void setMoney(int amount);