56 event.setItem(
"item", item);
57 event.setInt(
"amount", amount);
66 event.setItem(
"item", item);
67 event.setInt(
"amount", amount);
80 Window(std::string(), true, parent),
108 auto *minusButton =
new Button(
_(
"-"),
"dec",
this);
109 auto *plusButton =
new Button(
_(
"+"),
"inc",
this);
110 auto *okButton =
new Button(
_(
"OK"),
"ok",
this);
111 auto *cancelButton =
new Button(
_(
"Cancel"),
"cancel",
this);
112 auto *addAllButton =
new Button(
_(
"All"),
"all",
this);
114 minusButton->adjustSize();
115 minusButton->setWidth(plusButton->getWidth());
120 place(1, 0, minusButton);
122 place(3, 0, plusButton);
123 place(4, 0, addAllButton);
128 place(4, 2, cancelButton);
129 place(5, 2, okButton);
138 setCaption(
_(
"Select amount of items to trade."));
141 setCaption(
_(
"Select amount of items to drop."));
144 setCaption(
_(
"Select amount of items to store."));
147 setCaption(
_(
"Select amount of items to retrieve."));
188 if (event.getId() ==
"cancel")
192 else if (event.getId() ==
"inc" && amount <
mMax)
196 else if (event.getId() ==
"dec" && amount > 1)
200 else if (event.getId() ==
"all")
204 else if (event.getId() ==
"slide")
208 else if (event.getId() ==
"ok")
237 finish(item, maxRange, usage);
This class is a helper for adding widgets to nested tables in a window.
TextBox which only accepts numbers as input.
void setRange(int minimum, int maximum)
Sets the minimum and maximum values of the text box.
int getValue()
Returns the value in the text box.
void setValue(int value)
Set the value of the text box to the specified value.
Window used for selecting the amount of items to drop, trade or store.
~ItemAmountWindow() override
gcn::Slider * mItemAmountSlide
Item Amount buttons.
void close() override
Schedules the Item Amount window for deletion.
void keyReleased(gcn::KeyEvent &keyEvent) override
void mouseExited(gcn::MouseEvent &event) override
ItemAmountWindow(Usage usage, Window *parent, Item *item, int maxRange=0)
static void finish(Item *item, int amount, Usage usage)
void mouseMoved(gcn::MouseEvent &event) override
IntTextField * mItemAmountTextField
Item amount caption.
void resetAmount()
Sets default amount value.
void action(const gcn::ActionEvent &event) override
Called when receiving actions from widget.
static void showWindow(Usage usage, Window *parent, Item *item, int maxRange=0)
Creates the dialog, or bypass it if there aren't enough items.
Represents one or more instances of a certain item type.
void doEvent(Event::Type eventType)
int getQuantity() const
Returns the number of items.
Image * getImage() const
Returns the item image.
const ItemInfo & getInfo() const
Returns information about this item type.
bool isEnabled() const
Get the enable flag, which will stop the user from doing actions.
void setEnabled(bool flag)
Set the enable flag, which will stop the user from doing actions.
virtual void addItem(Item *item, int amount)
int getMouseY() const
Returns mouse y in pixels.
int getMouseX() const
Returns mouse x in pixels.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
Window * getParentWindow() const
Returns the parent window.
ContainerPlacer getPlacer(int x, int y)
Returns a proxy for adding widgets in an inner table of the layout.
void reflowLayout(int w=0, int h=0)
Computes the position of the widgets according to the current layout.
LayoutCell & place(int x, int y, gcn::Widget *, int w=1, int h=1)
Adds a widget to the window and sets it at given cell.
void scheduleDelete()
Schedule this window for deletion.
void setLocationRelativeTo(gcn::Widget *widget)
Sets the location relative to the given widget.
Viewport * viewport
Viewport on the map.
TradeHandler * getTradeHandler()