Mana
Loading...
Searching...
No Matches
selldialog.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "gui/widgets/window.h"
25
26#include <guichan/actionlistener.hpp>
27#include <guichan/selectionlistener.hpp>
28
29class Item;
30class ShopItems;
31class ShopListBox;
32
38class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener
39{
40 public:
41 SellDialog(int npcId);
42
43 ~SellDialog() override;
44
48 void reset();
49
53 void addItem(const Item *item, int price);
54
58 void action(const gcn::ActionEvent &event) override;
59
65 void valueChanged(const gcn::SelectionEvent &event) override;
66
70 void mouseClicked(gcn::MouseEvent &mouseEvent) override;
71
75 void setMoney(int amount);
76
80 void setVisible(bool visible) override;
81
85 static void closeAll();
86
87 private:
88 using DialogList = std::list<SellDialog *>;
90
95
96 int mNpcId;
97
98 gcn::Button *mSellButton;
99 gcn::Button *mQuitButton;
100 gcn::Button *mAddMaxButton;
101 gcn::Button *mIncreaseButton;
102 gcn::Button *mDecreaseButton;
104 gcn::ScrollArea *mScrollArea;
105 gcn::Label *mMoneyLabel;
106 gcn::Label *mQuantityLabel;
107 gcn::Slider *mSlider;
108
111
112 int mMaxItems = 0;
114};
Represents one or more instances of a certain item type.
Definition item.h:35
The sell dialog.
Definition selldialog.h:39
void action(const gcn::ActionEvent &event) override
Called when receiving actions from the widgets.
gcn::Slider * mSlider
Definition selldialog.h:107
void mouseClicked(gcn::MouseEvent &mouseEvent) override
Allows for quick-selling by extending double-click events.
std::list< SellDialog * > DialogList
Definition selldialog.h:88
void updateButtonsAndLabels()
Updates the state of buttons and labels.
void addItem(const Item *item, int price)
Adds an item to the inventory.
void reset()
Resets the dialog, clearing inventory.
ShopItems * mShopItems
Definition selldialog.h:109
gcn::Button * mIncreaseButton
Definition selldialog.h:101
gcn::Button * mSellButton
Definition selldialog.h:98
gcn::Label * mQuantityLabel
Definition selldialog.h:106
void setVisible(bool visible) override
Sets the visibility of this window.
gcn::ScrollArea * mScrollArea
Definition selldialog.h:104
void valueChanged(const gcn::SelectionEvent &event) override
Updates labels according to selected item.
static void closeAll()
Closes all instances.
int mAmountItems
Definition selldialog.h:113
static DialogList instances
Definition selldialog.h:89
~SellDialog() override
gcn::Button * mDecreaseButton
Definition selldialog.h:102
ShopListBox * mShopItemList
Definition selldialog.h:103
int mPlayerMoney
Definition selldialog.h:110
gcn::Button * mAddMaxButton
Definition selldialog.h:100
void setMoney(int amount)
Gives Player's Money amount.
gcn::Button * mQuitButton
Definition selldialog.h:99
gcn::Label * mMoneyLabel
Definition selldialog.h:105
This class handles the list of items available in a shop.
Definition shopitems.h:41
A list box, meant to be used inside a scroll area.
Definition shoplistbox.h:37
A window.
Definition window.h:59