summaryrefslogtreecommitdiff
path: root/src/gui/itemamountwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-06 20:57:24 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-06 22:58:35 +0300
commit4ad3cd45f7a8c3f6d1817705c06223d1a2798a2f (patch)
treea776928bb1339cdd29eb2e54d50eb3fa6e3448d7 /src/gui/itemamountwindow.cpp
parent22ed653d8b630c813333d5c73a4ca02dede2a5a5 (diff)
downloadplus-4ad3cd45f7a8c3f6d1817705c06223d1a2798a2f.tar.gz
plus-4ad3cd45f7a8c3f6d1817705c06223d1a2798a2f.tar.bz2
plus-4ad3cd45f7a8c3f6d1817705c06223d1a2798a2f.tar.xz
plus-4ad3cd45f7a8c3f6d1817705c06223d1a2798a2f.zip
Improve constructors in some classes.
Diffstat (limited to 'src/gui/itemamountwindow.cpp')
-rw-r--r--src/gui/itemamountwindow.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index d950a1dd4..98fe9582a 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -136,13 +136,21 @@ void ItemAmountWindow::finish(Item *const item, const int amount,
ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
Item *const item, const int maxRange) :
Window("", true, parent, "amount.xml"),
+ ActionListener(),
+ KeyListener(),
+ mItemAmountTextField(new IntTextField(1)),
mItemPriceTextField(nullptr),
mGPLabel(nullptr),
mItem(item),
+ mItemIcon(new Icon(item->getImage())),
mMax(maxRange),
mUsage(usage),
+ mItemPopup(new ItemPopup),
+ mItemAmountSlide(new Slider(1.0, mMax)),
mItemPriceSlide(nullptr),
+ mItemDropDown(nullptr),
mItemsModal(nullptr),
+ mEnabledKeyboard(keyboard.isEnabled()),
mPrice(0)
{
if (!mItem)
@@ -156,17 +164,14 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
mMax = mItem->getQuantity();
// Save keyboard state
- mEnabledKeyboard = keyboard.isEnabled();
keyboard.setEnabled(false);
// Integer field
- mItemAmountTextField = new IntTextField(1);
mItemAmountTextField->setRange(1, mMax);
mItemAmountTextField->setWidth(35);
mItemAmountTextField->addKeyListener(this);
// Slider
- mItemAmountSlide = new Slider(1.0, mMax);
mItemAmountSlide->setHeight(10);
mItemAmountSlide->setActionEventId("slide");
mItemAmountSlide->addActionListener(this);
@@ -196,9 +201,6 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
mItemDropDown->addActionListener(this);
}
- //Item icon
- Image *const image = item->getImage();
- mItemIcon = new Icon(image);
// Buttons
Button *const minusAmountButton = new Button(_("-"), "dec", this);
@@ -284,7 +286,6 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
setLocationRelativeTo(getParentWindow());
setVisible(true);
- mItemPopup = new ItemPopup;
mItemIcon->addMouseListener(this);
}