FifeGUI 0.2.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#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 ImageProgressBar : public Widget
24 {
25 public:
27 enum class Orientation : uint8_t
28 {
29 Horizontal = 0,
30 Vertical
31 };
32
34
41 ImageProgressBar(Image* image, int maxValue);
42
50 ImageProgressBar(std::string const & filename, int maxValue);
51
52 ~ImageProgressBar() override;
53
54 ImageProgressBar(ImageProgressBar const &) = delete;
55 ImageProgressBar& operator=(ImageProgressBar const &) = delete;
57 ImageProgressBar& operator=(ImageProgressBar&&) = delete;
58
62 void draw(Graphics* graphics) override;
63
69 void setOpaque(bool opaque);
70
74 bool isOpaque() const;
75
82 void setBarImage(Image* image);
83
87 Image const * getBarImage() const;
88
95 void setForegroundImage(Image* image);
96
100 Image const * getForegroundImage() const;
101
107 void setOrientation(Orientation orientation);
108
112 Orientation getOrientation() const;
113
119 int getMaxValue() const;
120
126 void setMaxValue(int value);
127
133 int getValue() const;
134
140 void setValue(int value);
141
142 // Inherited from Widget
143
145
146 void resizeToContent(bool recursion) override;
147 void adjustSize() override;
148
149 protected:
159 void adjustSizeImpl();
160
165
170
177
182
187
192
197 };
198}; // namespace fcn
199
200#endif // INCLUDE_FIFECHAN_WIDGETS_IMAGEPROGRESSBAR_HPP_
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57
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: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