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 27 #include "enums/simpletypes/itemcolor.h" 28 29 #include "gui/widgets/window.h" 30 31 #include "listeners/actionlistener.h" 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: 44 /** 45 * Constructor. 46 */ 47 OutfitWindow(); 48 49 A_DELETE_COPY(OutfitWindow) 50 51 /** 52 * Destructor. 53 */ 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 109 Button *mPreviousButton A_NONNULLPOINTER; 110 Button *mNextButton A_NONNULLPOINTER; 111 Button *mEquipBottom A_NONNULLPOINTER; 112 Label *mCurrentLabel A_NONNULLPOINTER; 113 CheckBox *mUnequipCheck A_NONNULLPOINTER; 114 CheckBox *mAwayOutfitCheck A_NONNULLPOINTER; 115 Label *mKeyLabel A_NONNULLPOINTER; 116 117 Color mBorderColor; 118 119 int mCurrentOutfit; 120 int mBoxWidth; 121 int mBoxHeight; 122 int mGridWidth; 123 int mGridHeight; 124 125 int mItems[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; 126 int mAwayOutfit; 127 128 ItemColor mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; 129 bool mItemClicked; 130 bool mItemsUnequip[OUTFITS_COUNT]; 131 }; 132 133 extern OutfitWindow *outfitWindow; 134 135 #endif // GUI_WINDOWS_OUTFITWINDOW_H 136