Mana
Loading...
Searching...
No Matches
outfitwindow.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2007-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
28constexpr int OUTFITS_COUNT = 15;
29constexpr int OUTFIT_ITEM_COUNT = 9;
30
31class Button;
32class CheckBox;
33class Item;
34class Label;
35
36class OutfitWindow : public Window, gcn::ActionListener
37{
38 public:
40 ~OutfitWindow() override;
41
42 void action(const gcn::ActionEvent &event) override;
43
44 void draw(gcn::Graphics *graphics) override;
45 void mouseDragged(gcn::MouseEvent &event) override;
46 void mousePressed(gcn::MouseEvent &event) override;
47 void mouseReleased(gcn::MouseEvent &event) override;
48
49 void load();
50
51 void setItemSelected(int itemId)
52 { mItemSelected = itemId; }
53
54 bool isItemSelected() const
55 { return mItemSelected > -1; }
56
57 void wearOutfit(int outfit);
58 void copyOutfit(int outfit);
59
60 void unequipNotInOutfit(int outfit);
61
62 private:
67
68 int getIndexFromGrid(int pointX, int pointY) const;
69
70 int mBoxWidth = 33;
71 int mBoxHeight = 33;
73 int mGridWidth = 3;
74 int mGridHeight = 3;
75 bool mItemClicked = false;
76 Item *mItemMoved = nullptr;
77
78 void save();
79
80 struct Outfit
81 {
83 bool unequip = true;
84 };
85
87 int mItemSelected = -1;
88
90};
91
Button widget.
Definition button.h:38
Check box widget.
Definition checkbox.h:32
Represents one or more instances of a certain item type.
Definition item.h:35
Label widget.
Definition label.h:34
Label * mCurrentLabel
int getIndexFromGrid(int pointX, int pointY) const
void unequipNotInOutfit(int outfit)
void mouseReleased(gcn::MouseEvent &event) override
bool isItemSelected() const
void mouseDragged(gcn::MouseEvent &event) override
void wearOutfit(int outfit)
void mousePressed(gcn::MouseEvent &event) override
Button * mPreviousButton
CheckBox * mUnequipCheck
~OutfitWindow() override
Outfit mOutfits[OUTFITS_COUNT]
void action(const gcn::ActionEvent &event) override
void setItemSelected(int itemId)
void copyOutfit(int outfit)
Button * mNextButton
Item * mItemMoved
void draw(gcn::Graphics *graphics) override
A window.
Definition window.h:59
Graphics * graphics
Definition client.cpp:104
constexpr int OUTFIT_ITEM_COUNT
constexpr int OUTFITS_COUNT
OutfitWindow * outfitWindow
Definition game.cpp:106
int items[OUTFIT_ITEM_COUNT]