summaryrefslogtreecommitdiff
path: root/src/gui/sell.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 19:59:39 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 19:59:39 +0000
commit53800016443ed50a5b0ea27b65b39730586352d4 (patch)
tree2a73a6bc69c54b1397e02cada7fc72dac41afcb1 /src/gui/sell.cpp
parent7afe9d904f11fc65f02959798dfc6abb3660d660 (diff)
downloadmana-client-53800016443ed50a5b0ea27b65b39730586352d4.tar.gz
mana-client-53800016443ed50a5b0ea27b65b39730586352d4.tar.bz2
mana-client-53800016443ed50a5b0ea27b65b39730586352d4.tar.xz
mana-client-53800016443ed50a5b0ea27b65b39730586352d4.zip
Converted sell dialog box to layout handler. Removed some useless code from buy dialog box.
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r--src/gui/sell.cpp77
1 files changed, 17 insertions, 60 deletions
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;