FifeGUI 0.3.0
A C++ GUI library designed for games.
imageprogressbar.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_IMAGEPROGRESSBAR_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_IMAGEPROGRESSBAR_HPP_
7
8// Standard library includes
9#include <string>
10#include <vector>
11
12// Project headers (subdirs before local)
13#include <fifechan/widget.hpp>
14
15namespace fcn
16{
17 class Graphics;
18 class Image;
19
25 class FIFEGUI_API ImageProgressBar : public Widget
26 {
27 public:
29 enum class Orientation : uint8_t
30 {
31 Horizontal = 0,
32 Vertical
33 };
34
36
43 ImageProgressBar(Image* image, int maxValue);
44
52 ImageProgressBar(std::string const & filename, int maxValue);
53
54 ~ImageProgressBar() override;
55
56 ImageProgressBar(ImageProgressBar const &) = delete;
57 ImageProgressBar& operator=(ImageProgressBar const &) = delete;
59 ImageProgressBar& operator=(ImageProgressBar&&) = delete;
60
64 void draw(Graphics* graphics) override;
65
71 void setOpaque(bool opaque);
72
76 bool isOpaque() const;
77
85 void setBarImage(Image* image);
86
90 Image const * getBarImage() const;
91
99 void setForegroundImage(Image* image);
100
104 Image const * getForegroundImage() const;
105
111 void setOrientation(Orientation orientation);
112
116 Orientation getOrientation() const;
117
123 int getMaxValue() const;
124
130 void setMaxValue(int value);
131
137 int getValue() const;
138
144 void setValue(int value);
145
146 // Inherited from Widget
147
149
150 void resizeToContent(bool recursion = true) override;
151 void adjustSize() override;
152
153 protected:
163 void adjustSizeImpl();
164
169
174
181
186
191
196
201 };
202}; // namespace fcn
203
204#endif // INCLUDE_FIFECHAN_WIDGETS_IMAGEPROGRESSBAR_HPP_
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
Displays progress using images.
int mValue
Holds the current progress bar value.
int mMaxValue
Value when progress bar is full.
Orientation
Orientation of the progress bar (horizontal or vertical).
bool mInternalImage
True if the image has been loaded internally, false otherwise.
Orientation mOrientation
ImageProgressBar's orientation.
Image const * mForegroundImage
Foreground image.
Image const * mBarImage
Bar image.
bool mOpaque
True if the widget is opaque, false otherwise.
Abstract holder for image data.
Definition image.hpp:34
Widget()
Constructor.
Definition widget.cpp:52
virtual void resizeToContent(bool recursion=true)
Resizes the widget's size to fit the content exactly, calls recursively all childs.
Definition widget.hpp:1580
Used replacement tokens by configure_file():