Mana
Loading...
Searching...
No Matches
src
gui
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
"
28
#include "
gui/widgets/textfield.h
"
29
30
#include <guichan/actionlistener.hpp>
31
#include <guichan/keylistener.hpp>
32
#include <guichan/selectionlistener.hpp>
33
34
class
Item
;
35
class
ItemContainer
;
36
class
ProgressBar
;
37
class
TextBox
;
38
44
class
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 *>;
115
static
WindowList
instances
;
116
117
Inventory
*
mInventory
;
118
ItemContainer
*
mItems
;
119
120
TextField
*
mFilterText
;
121
122
std::string
mWeight
,
mSlots
;
123
124
gcn::Button *
mUseButton
, *
mEquipButton
, *
mDropButton
,
125
*
mOutfitButton
, *
mStoreButton
, *
mRetrieveButton
;
126
127
gcn::Label *
mWeightLabel
, *
mSlotsLabel
, *
mFilterLabel
;
128
129
ProgressBar
*
mWeightBar
, *
mSlotsBar
;
130
};
131
132
extern
InventoryWindow
*
inventoryWindow
;
EventListener
Definition
eventlistener.h:26
Event
Definition
event.h:42
Event::Channel
Channel
Definition
event.h:45
InventoryListener
Definition
inventory.h:32
InventoryWindow
Inventory dialog.
Definition
inventorywindow.h:50
InventoryWindow::mRetrieveButton
gcn::Button * mRetrieveButton
Definition
inventorywindow.h:125
InventoryWindow::mSlots
std::string mSlots
Definition
inventorywindow.h:122
InventoryWindow::updateButtons
void updateButtons()
Updates the buttons.
Definition
inventorywindow.cpp:307
InventoryWindow::mouseClicked
void mouseClicked(gcn::MouseEvent &event) override
Handles the mouse clicks.
Definition
inventorywindow.cpp:233
InventoryWindow::mSlotsLabel
gcn::Label * mSlotsLabel
Definition
inventorywindow.h:127
InventoryWindow::instances
static WindowList instances
Definition
inventorywindow.h:115
InventoryWindow::mWeightLabel
gcn::Label * mWeightLabel
Definition
inventorywindow.h:127
InventoryWindow::keyReleased
void keyReleased(gcn::KeyEvent &event) override
Handles the key releases.
Definition
inventorywindow.cpp:293
InventoryWindow::~InventoryWindow
~InventoryWindow() override
Definition
inventorywindow.cpp:154
InventoryWindow::mStoreButton
gcn::Button * mStoreButton
Definition
inventorywindow.h:125
InventoryWindow::mItems
ItemContainer * mItems
Definition
inventorywindow.h:118
InventoryWindow::mEquipButton
gcn::Button * mEquipButton
Definition
inventorywindow.h:124
InventoryWindow::valueChanged
void valueChanged(const gcn::SelectionEvent &event) override
Updates labels to currently selected item.
Definition
inventorywindow.cpp:299
InventoryWindow::widgetHidden
void widgetHidden(const gcn::Event &event) override
Handles closing of the window.
Definition
inventorywindow.cpp:227
InventoryWindow::isMainInventory
bool isMainInventory() const
Definition
inventorywindow.h:103
InventoryWindow::isInputFocused
bool isInputFocused() const
Definition
inventorywindow.cpp:373
InventoryWindow::isAnyInputFocused
static bool isAnyInputFocused()
Definition
inventorywindow.cpp:378
InventoryWindow::event
void event(Event::Channel channel, const Event &event) override
Definition
inventorywindow.cpp:346
InventoryWindow::mDropButton
gcn::Button * mDropButton
Definition
inventorywindow.h:124
InventoryWindow::mSlotsBar
ProgressBar * mSlotsBar
Definition
inventorywindow.h:129
InventoryWindow::mOutfitButton
gcn::Button * mOutfitButton
Definition
inventorywindow.h:125
InventoryWindow::mInventory
Inventory * mInventory
Definition
inventorywindow.h:117
InventoryWindow::updateWeight
void updateWeight()
Updates the weight bar.
Definition
inventorywindow.cpp:356
InventoryWindow::action
void action(const gcn::ActionEvent &event) override
Called when receiving actions from the widgets.
Definition
inventorywindow.cpp:163
InventoryWindow::mWeight
std::string mWeight
Definition
inventorywindow.h:122
InventoryWindow::slotsChanged
void slotsChanged(Inventory *inventory) override
Definition
inventorywindow.cpp:387
InventoryWindow::WindowList
std::list< InventoryWindow * > WindowList
Definition
inventorywindow.h:114
InventoryWindow::mFilterLabel
gcn::Label * mFilterLabel
Definition
inventorywindow.h:127
InventoryWindow::close
void close() override
Closes the Storage Window, as well as telling the server that the window has been closed.
Definition
inventorywindow.cpp:331
InventoryWindow::mWeightBar
ProgressBar * mWeightBar
Definition
inventorywindow.h:129
InventoryWindow::getSelectedItem
Item * getSelectedItem() const
Returns the selected item.
Definition
inventorywindow.cpp:222
InventoryWindow::mFilterText
TextField * mFilterText
Definition
inventorywindow.h:120
InventoryWindow::mUseButton
gcn::Button * mUseButton
Definition
inventorywindow.h:124
Inventory
Definition
inventory.h:43
Inventory::isMainInventory
bool isMainInventory() const
Definition
inventory.h:129
ItemContainer
An item container.
Definition
itemcontainer.h:50
Item
Represents one or more instances of a certain item type.
Definition
item.h:35
ProgressBar
A progress bar.
Definition
progressbar.h:34
TextBox
A text box, meant to be used inside a scroll area.
Definition
textbox.h:36
TextField
A text field.
Definition
textfield.h:72
Window
A window.
Definition
window.h:59
eventlistener.h
inventory.h
inventoryWindow
InventoryWindow * inventoryWindow
Definition
game.cpp:96
textfield.h
window.h
Generated by
1.9.8