Mana
Loading...
Searching...
No Matches
inventorywindow.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 "inventory.h"
25#include "eventlistener.h"
26
27#include "gui/widgets/window.h"
29
30#include <guichan/actionlistener.hpp>
31#include <guichan/keylistener.hpp>
32#include <guichan/selectionlistener.hpp>
33
34class Item;
35class ItemContainer;
36class ProgressBar;
37class TextBox;
38
44class InventoryWindow final : public Window,
45 public gcn::ActionListener,
46 public gcn::KeyListener,
47 public gcn::SelectionListener,
48 public InventoryListener,
49 public EventListener
50{
51 public:
52 InventoryWindow(Inventory *inventory);
53
54 ~InventoryWindow() override;
55
59 void action(const gcn::ActionEvent &event) override;
60
64 Item *getSelectedItem() const;
65
69 void widgetHidden(const gcn::Event &event) override;
70
74 void mouseClicked(gcn::MouseEvent &event) override;
75
79 void keyReleased(gcn::KeyEvent &event) override;
80
84 void valueChanged(const gcn::SelectionEvent &event) override;
85
90 void close() override;
91
95 void updateButtons();
96
97 bool isInputFocused() const;
98
99 static bool isAnyInputFocused();
100
101 void slotsChanged(Inventory *inventory) override;
102
103 bool isMainInventory() const { return mInventory->isMainInventory(); }
104
105 void event(Event::Channel channel, const Event &event) override;
106
107 private:
111 void updateWeight();
112
113
114 using WindowList = std::list<InventoryWindow *>;
116
119
121
122 std::string mWeight, mSlots;
123
126
128
130};
131
Definition event.h:42
Channel
Definition event.h:45
Inventory dialog.
gcn::Button * mRetrieveButton
void updateButtons()
Updates the buttons.
void mouseClicked(gcn::MouseEvent &event) override
Handles the mouse clicks.
gcn::Label * mSlotsLabel
static WindowList instances
gcn::Label * mWeightLabel
void keyReleased(gcn::KeyEvent &event) override
Handles the key releases.
~InventoryWindow() override
gcn::Button * mStoreButton
ItemContainer * mItems
gcn::Button * mEquipButton
void valueChanged(const gcn::SelectionEvent &event) override
Updates labels to currently selected item.
void widgetHidden(const gcn::Event &event) override
Handles closing of the window.
bool isMainInventory() const
bool isInputFocused() const
static bool isAnyInputFocused()
void event(Event::Channel channel, const Event &event) override
gcn::Button * mDropButton
ProgressBar * mSlotsBar
gcn::Button * mOutfitButton
Inventory * mInventory
void updateWeight()
Updates the weight bar.
void action(const gcn::ActionEvent &event) override
Called when receiving actions from the widgets.
std::string mWeight
void slotsChanged(Inventory *inventory) override
std::list< InventoryWindow * > WindowList
gcn::Label * mFilterLabel
void close() override
Closes the Storage Window, as well as telling the server that the window has been closed.
ProgressBar * mWeightBar
Item * getSelectedItem() const
Returns the selected item.
TextField * mFilterText
gcn::Button * mUseButton
bool isMainInventory() const
Definition inventory.h:129
An item container.
Represents one or more instances of a certain item type.
Definition item.h:35
A progress bar.
Definition progressbar.h:34
A text box, meant to be used inside a scroll area.
Definition textbox.h:36
A text field.
Definition textfield.h:72
A window.
Definition window.h:59
InventoryWindow * inventoryWindow
Definition game.cpp:96