FifeGUI 0.2.0
A C++ GUI library designed for games.
iconprogressbar.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_WIDGETS_ICONPROGRESSBAR_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_ICONPROGRESSBAR_HPP_
7
8#include <fifechan/widget.hpp>
9
10#include <string>
11#include <vector>
12
13namespace fcn
14{
15 class Graphics;
16 class Image;
17
23 class FIFEGUI_API IconProgressBar : public Widget
24 {
25 public:
27 enum class Orientation : uint8_t
28 {
29 Horizontal = 0,
30 Vertical
31 };
32
37
44 IconProgressBar(Image* image, int maxIcons);
45
53 IconProgressBar(std::string const & filename, int maxIcons);
54
55 ~IconProgressBar() override;
56
57 IconProgressBar(IconProgressBar const &) = delete;
58 IconProgressBar& operator=(IconProgressBar const &) = delete;
60 IconProgressBar& operator=(IconProgressBar&&) = delete;
61
65 void draw(Graphics* graphics) override;
66
72 void setOpaque(bool opaque);
73
77 bool isOpaque() const;
78
86 void setImage(Image* image);
87
91 Image const * getImage() const;
92
99 void setMaxIcons(int maxIcons);
100
104 int getMaxIcons() const;
105
111 void setOrientation(Orientation orientation);
112
116 Orientation getOrientation() const;
117
123 void advance();
124
128 void reset();
129
134 void setIconCount(int icons);
135
139 int getIconCount() const;
140
141 // Inherited from Widget
142
144
145 void resizeToContent(bool recursion) override;
146 void adjustSize() override;
147
148 protected:
158 void adjustSizeImpl();
159
163 Image const * mImage;
164
170 bool mInternalImage{false};
171
175 int mMaxIcons{0};
176
181
185 Orientation mOrientation{Orientation::Horizontal};
186
190 bool mOpaque{true};
191 };
192}; // namespace fcn
193
194#endif // INCLUDE_FIFECHAN_WIDGETS_ICONPROGRESSBAR_HPP_
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57
Displays progress using a sequence of icons.
IconProgressBar()
Default constructor.
Orientation mOrientation
IconProgressBar's orientation.
Image const * mImage
Image used by the progress bar.
int mMaxIcons
Count of icons when progress bar is full.
int mIconCounter
Holds how many icons are currently displayed.
bool mOpaque
True if the widget is opaque, false otherwise.
Orientation
Orientation of the IconProgressBar (horizontal or vertical).
bool mInternalImage
True if the image has been loaded internally, false otherwise.
Abstract holder for image data.
Definition image.hpp:32
Widget()
Constructor.
Definition widget.cpp:36
void resizeToContent()
Resizes the widget's size to fit the content exactly, calls recursively all childs.
Definition widget.hpp:1417