1 /* 2 * The ManaPlus Client 3 * Copyright (C) 2004-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_STATUSWINDOW_H 25 #define GUI_WINDOWS_STATUSWINDOW_H 26 27 #include "gui/widgets/window.h" 28 29 #include "listeners/actionlistener.h" 30 #include "listeners/attributelistener.h" 31 32 class Button; 33 class Label; 34 class ProgressBar; 35 class StatsPage; 36 class StatsPageBasic; 37 class TabbedArea; 38 39 /** 40 * The player status dialog. 41 * 42 * \ingroup Interface 43 */ 44 class StatusWindow final : public Window, 45 public ActionListener, 46 public AttributeListener 47 { 48 public: 49 /** 50 * Constructor. 51 */ 52 StatusWindow(); 53 54 A_DELETE_COPY(StatusWindow) 55 56 ~StatusWindow() override final; 57 58 void setPointsNeeded(const AttributesT id, 59 const int needed); 60 61 static void updateHPBar(ProgressBar *const bar, 62 const bool showMax); 63 void updateMPBar(ProgressBar *bar, 64 const bool showMax) const; 65 static void updateJobBar(ProgressBar *const bar, 66 const bool percent); 67 static void updateXPBar(ProgressBar *const bar, 68 const bool percent); 69 static void updateWeightBar(ProgressBar *const bar); 70 static void updateInvSlotsBar(ProgressBar *const bar); 71 static void updateMoneyBar(ProgressBar *const bar); 72 static void updateArrowsBar(ProgressBar *const bar); 73 void updateStatusBar(ProgressBar *const bar, 74 const bool percent) const; 75 static void updateProgressBar(ProgressBar *const bar, 76 const int64_t value, 77 const int64_t max, 78 const bool percent); 79 static void updateProgressBar(ProgressBar *const bar, 80 const AttributesT id, 81 const bool percent); 82 83 void action(const ActionEvent &event) override; 84 85 void attributeChanged(const AttributesT id, 86 const int64_t oldVal, 87 const int64_t newVal) override final; 88 89 void updateLevelLabel(); 90 91 private: 92 void addTabs(); 93 void addTab(const std::string &name); 94 void addTabBasic(const std::string &name); 95 96 static std::string translateLetter(const char *const letters); 97 static std::string translateLetter2(const std::string &letters); 98 99 STD_VECTOR<StatsPage*> mPages; 100 101 TabbedArea *mTabs A_NONNULLPOINTER; 102 Label *mLvlLabel A_NONNULLPOINTER; 103 Label *mMoneyLabel A_NONNULLPOINTER; 104 Label *mHpLabel A_NONNULLPOINTER; 105 Label *mMpLabel A_NONNULLPOINTER; 106 Label *mXpLabel A_NONNULLPOINTER; 107 ProgressBar *mHpBar A_NONNULLPOINTER; 108 ProgressBar *mMpBar A_NONNULLPOINTER; 109 ProgressBar *mXpBar A_NONNULLPOINTER; 110 111 Label *mJobLvlLabel; 112 Label *mJobLabel; 113 ProgressBar *mJobBar; 114 115 StatsPageBasic *mBasicStatsPage; 116 Button *mCopyButton; 117 }; 118 119 extern StatusWindow *statusWindow; 120 121 #endif // GUI_WINDOWS_STATUSWINDOW_H 122