ManaPlus
outfitwindow.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2007-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef GUI_WINDOWS_OUTFITWINDOW_H
25 #define GUI_WINDOWS_OUTFITWINDOW_H
26 
28 
29 #include "gui/widgets/window.h"
30 
32 
33 const unsigned int OUTFITS_COUNT = 100;
34 const unsigned int OUTFIT_ITEM_COUNT = 16;
35 
36 class Button;
37 class CheckBox;
38 class Label;
39 
40 class OutfitWindow final : public Window,
41  private ActionListener
42 {
43  public:
47  OutfitWindow();
48 
50 
51 
54  ~OutfitWindow() override final;
55 
56  void action(const ActionEvent &event) override final;
57 
58  void draw(Graphics *const graphics) override final A_NONNULL(2);
59 
60  void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
61 
62  void mousePressed(MouseEvent &event) override final;
63 
64  void mouseDragged(MouseEvent &event) override final;
65 
66  void mouseReleased(MouseEvent &event) override final;
67 
68  void load();
69 
70  void wearOutfit(const int outfit,
71  const bool unwearEmpty,
72  const bool select);
73 
74  void copyOutfit(const int outfit);
75 
76  void copyOutfit(const int src, const int dst);
77 
78  void copyFromEquiped();
79 
80  void copyFromEquiped(const int dst);
81 
82  void unequipNotInOutfit(const int outfit) const;
83 
84  void next();
85 
86  void previous();
87 
88  void wearNextOutfit(const bool all);
89 
90  void wearPreviousOutfit(const bool all);
91 
92  void wearAwayOutfit();
93 
94  void unwearAwayOutfit();
95 
96  void showCurrentOutfit();
97 
98  static std::string keyName(const int number) A_WARN_UNUSED;
99 
100  void clearCurrentOutfit();
101 
102  std::string getOutfitString() const;
103 
104  private:
105  int getIndexFromGrid(const int pointX,
106  const int pointY) const A_WARN_UNUSED;
107  void save() const;
108 
116 
118 
124 
127 
131 };
132 
133 extern OutfitWindow *outfitWindow;
134 
135 #endif // GUI_WINDOWS_OUTFITWINDOW_H
Definition: button.h:102
Definition: color.h:76
Definition: label.h:91
void wearNextOutfit(const bool all)
static std::string keyName(const int number)
void copyFromEquiped()
Label * mCurrentLabel
Definition: outfitwindow.h:112
ItemColor mItemColors[OUTFITS_COUNT+1][OUTFIT_ITEM_COUNT]
Definition: outfitwindow.h:128
CheckBox * mAwayOutfitCheck
Definition: outfitwindow.h:114
void action(const ActionEvent &event)
Color mBorderColor
Definition: outfitwindow.h:117
void clearCurrentOutfit()
void wearAwayOutfit()
int mItems[OUTFITS_COUNT+1][OUTFIT_ITEM_COUNT]
Definition: outfitwindow.h:125
void save() const
void mouseDragged(MouseEvent &event)
void safeDraw(Graphics *const graphics)
void showCurrentOutfit()
void unequipNotInOutfit(const int outfit) const
void wearPreviousOutfit(const bool all)
void wearOutfit(const int outfit, const bool unwearEmpty, const bool select)
void mousePressed(MouseEvent &event)
void unwearAwayOutfit()
Button * mPreviousButton
Definition: outfitwindow.h:109
CheckBox * mUnequipCheck
Definition: outfitwindow.h:113
void mouseReleased(MouseEvent &event)
Button * mEquipBottom
Definition: outfitwindow.h:111
Label * mKeyLabel
Definition: outfitwindow.h:115
int getIndexFromGrid(const int pointX, const int pointY) const
std::string getOutfitString() const
Button * mNextButton
Definition: outfitwindow.h:110
void draw(Graphics *const graphics)
bool mItemsUnequip[OUTFITS_COUNT]
Definition: outfitwindow.h:130
void copyOutfit(const int outfit)
Definition: window.h:102
uint16_t ItemColor
Definition: itemcolor.h:30
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULL(...)
Definition: localconsts.h:168
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
bool outfit(InputEvent &event)
Definition: actions.cpp:32
const unsigned int OUTFITS_COUNT
Definition: outfitwindow.h:33
OutfitWindow * outfitWindow
const unsigned int OUTFIT_ITEM_COUNT
Definition: outfitwindow.h:34