Mana
Loading...
Searching...
No Matches
equipmentwindow.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 "equipment.h"
25
26#include "gui/widgets/window.h"
27
28#include <guichan/actionlistener.hpp>
29
30class Inventory;
31class Item;
32class ItemPopup;
33
39class EquipmentWindow : public Window, public gcn::ActionListener
40{
41 public:
42 EquipmentWindow(Equipment *equipment);
43
44 ~EquipmentWindow() override;
45
49 void draw(gcn::Graphics *graphics) override;
50
51 void action(const gcn::ActionEvent &event) override;
52
53 void mousePressed(gcn::MouseEvent& mouseEvent) override;
54 void mouseMoved(gcn::MouseEvent &event) override;
55 void mouseExited(gcn::MouseEvent &event) override;
56
60 int getSelected() const
61 { return mSelected; }
62
63 protected:
64 int mSelected = -1;
66
67 private:
68 int getBoxIndex(int x, int y) const;
69 Item *getItem(int x, int y) const;
70 std::string getSlotName(int x, int y) const;
71
72 void setSelected(int index);
73
75 gcn::Button *mUnequip;
76};
77
Equipment dialog.
~EquipmentWindow() override
void setSelected(int index)
gcn::Button * mUnequip
void action(const gcn::ActionEvent &event) override
void mouseMoved(gcn::MouseEvent &event) override
int mSelected
Index of selected item.
Item * getItem(int x, int y) const
int getSelected() const
Returns the current selected slot or -1 if none.
void mouseExited(gcn::MouseEvent &event) override
Equipment * mEquipment
int getBoxIndex(int x, int y) const
Returns an index of an equipment box at the given position, or -1 if there is no box.
std::string getSlotName(int x, int y) const
void draw(gcn::Graphics *graphics) override
Draws the equipment window.
ItemPopup * mItemPopup
void mousePressed(gcn::MouseEvent &mouseEvent) override
A popup that displays information about an item.
Definition itempopup.h:39
Represents one or more instances of a certain item type.
Definition item.h:35
A window.
Definition window.h:59
Graphics * graphics
Definition client.cpp:104
EquipmentWindow * equipmentWindow
Definition game.cpp:100