GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/ministatuswindow.h Lines: 0 1 0.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
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-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef GUI_WINDOWS_MINISTATUSWINDOW_H
24
#define GUI_WINDOWS_MINISTATUSWINDOW_H
25
26
#include "listeners/arrowslistener.h"
27
#include "listeners/attributelistener.h"
28
#include "listeners/inventorylistener.h"
29
#include "listeners/statlistener.h"
30
#include "listeners/updatestatuslistener.h"
31
32
#include "gui/widgets/window.h"
33
34
class AnimatedSprite;
35
class Graphics;
36
class Inventory;
37
class ProgressBar;
38
class StatusPopup;
39
40
/**
41
 * The player mini-status dialog.
42
 *
43
 * \ingroup Interface
44
 */
45
class MiniStatusWindow final : public Window,
46
                               public InventoryListener,
47
                               public AttributeListener,
48
                               public StatListener,
49
                               public ArrowsListener,
50
                               public UpdateStatusListener
51
{
52
    public:
53
        MiniStatusWindow();
54
55
        A_DELETE_COPY(MiniStatusWindow)
56
57
        ~MiniStatusWindow();
58
59
        /**
60
         * Sets one of the icons.
61
         */
62
        void setIcon(const int index, AnimatedSprite *const sprite);
63
64
        void eraseIcon(const int index);
65
66
        void drawIcons(Graphics *const graphics) A_NONNULL(2);
67
68
        void updateStatus() override final;
69
70
        void logic() override final;
71
72
        void draw(Graphics *const graphics) override final A_NONNULL(2);
73
74
        void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
75
76
        void mouseMoved(MouseEvent &event) override final;
77
78
        void mousePressed(MouseEvent &event) override final;
79
80
        void mouseExited(MouseEvent &event) override final;
81
82
        void showBar(const std::string &name, const Visible visible);
83
84
        void updateBars();
85
86
        void slotsChanged(const Inventory *const inventory) override final;
87
88
        STD_VECTOR <ProgressBar*> &getBars() A_WARN_UNUSED
89
        { return mBars; }
90
91
        Rect getChildrenArea() override final A_WARN_UNUSED;
92
93
        void attributeChanged(const AttributesT id,
94
                              const int64_t oldVal,
95
                              const int64_t newVal) override final;
96
97
        void statChanged(const AttributesT id,
98
                         const int oldVal1,
99
                         const int oldVal2) override final;
100
101
        void arrowsChanged() override final;
102
103
#ifdef USE_PROFILER
104
        void logicChildren();
105
#endif  // USE_PROFILER
106
107
    private:
108
        bool isInBar(ProgressBar *bar, int x, int y) const;
109
110
        ProgressBar *createBar(const float progress,
111
                               const int width,
112
                               const int height,
113
                               const ThemeColorIdT textColor,
114
                               const ProgressColorIdT backColor,
115
                               const std::string &restrict skin,
116
                               const std::string &restrict skinFill,
117
                               const std::string &restrict name,
118
                               const std::string &restrict description)
119
                               A_WARN_UNUSED;
120
121
        void loadBars();
122
123
        void saveBars() const;
124
125
        STD_VECTOR <ProgressBar*> mBars;
126
        std::map <std::string, ProgressBar*> mBarNames;
127
        STD_VECTOR<AnimatedSprite *> mIcons;
128
129
        /*
130
         * Mini Status Bars
131
         */
132
        ProgressBar *mHpBar;
133
        ProgressBar *mMpBar;
134
        ProgressBar *mXpBar;
135
        ProgressBar *mJobBar;
136
        ProgressBar *mWeightBar;
137
        ProgressBar *mInvSlotsBar;
138
        ProgressBar *mMoneyBar;
139
        ProgressBar *mArrowsBar;
140
        ProgressBar *mStatusBar;
141
        StatusPopup *mStatusPopup;
142
143
        int mSpacing;
144
        int mIconPadding;
145
        int mIconSpacing;
146
        int mMaxX;
147
};
148
149
extern MiniStatusWindow *miniStatusWindow;
150
151
#endif  // GUI_WINDOWS_MINISTATUSWINDOW_H