ManaPlus
statuswindow.h
Go to the documentation of this file.
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 
31 
32 class Button;
33 class Label;
34 class ProgressBar;
35 class StatsPage;
36 class StatsPageBasic;
37 class TabbedArea;
38 
44 class StatusWindow final : public Window,
45  public ActionListener,
46  public AttributeListener
47 {
48  public:
52  StatusWindow();
53 
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 
110 
114 
117 };
118 
119 extern StatusWindow *statusWindow;
120 
121 #endif // GUI_WINDOWS_STATUSWINDOW_H
Attributes ::T AttributesT
Definition: attributes.h:118
Definition: button.h:102
Definition: label.h:91
static void updateArrowsBar(ProgressBar *const bar)
static void updateXPBar(ProgressBar *const bar, const bool percent)
Label * mMpLabel
Definition: statuswindow.h:105
static void updateMoneyBar(ProgressBar *const bar)
void addTab(const std::string &name)
Label * mMoneyLabel
Definition: statuswindow.h:103
void updateMPBar(ProgressBar *bar, const bool showMax) const
static void updateProgressBar(ProgressBar *const bar, const int64_t value, const int64_t max, const bool percent)
void updateStatusBar(ProgressBar *const bar, const bool percent) const
static std::string translateLetter(const char *const letters)
void action(const ActionEvent &event)
StatsPageBasic * mBasicStatsPage
Definition: statuswindow.h:115
static std::string translateLetter2(const std::string &letters)
Button * mCopyButton
Definition: statuswindow.h:116
ProgressBar * mXpBar
Definition: statuswindow.h:109
Label * mJobLvlLabel
Definition: statuswindow.h:111
static void updateHPBar(ProgressBar *const bar, const bool showMax)
Label * mJobLabel
Definition: statuswindow.h:112
Label * mHpLabel
Definition: statuswindow.h:104
Label * mLvlLabel
Definition: statuswindow.h:102
ProgressBar * mJobBar
Definition: statuswindow.h:113
TabbedArea * mTabs
Definition: statuswindow.h:101
static void updateJobBar(ProgressBar *const bar, const bool percent)
Label * mXpLabel
Definition: statuswindow.h:106
void updateLevelLabel()
static void updateWeightBar(ProgressBar *const bar)
std::vector< StatsPage * > mPages
Definition: statuswindow.h:99
static void updateInvSlotsBar(ProgressBar *const bar)
void addTabBasic(const std::string &name)
ProgressBar * mHpBar
Definition: statuswindow.h:107
void setPointsNeeded(const AttributesT id, const int needed)
ProgressBar * mMpBar
Definition: statuswindow.h:108
void attributeChanged(const AttributesT id, const int64_t oldVal, const int64_t newVal)
Definition: window.h:102
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
StatusWindow * statusWindow