5#include <fifechan/widgets/imageprogressbar.hpp>
7#include <fifechan/exception.hpp>
8#include <fifechan/graphics.hpp>
9#include <fifechan/image.hpp>
10#include <fifechan/rectangle.hpp>
16 ImageProgressBar::ImageProgressBar() :
18 mForegroundImage(nullptr),
19 mInternalImage(false),
22 mOrientation(Orientation::Horizontal),
27 ImageProgressBar::ImageProgressBar(
Image* image,
int maxValue) :
39 ImageProgressBar::ImageProgressBar(std::string
const & filename,
int maxValue) :
52 ImageProgressBar::~ImageProgressBar()
66 ((
getSelectionMode() & Widget::SelectionMode::Background) == Widget::SelectionMode::Background)) {
79 if (active && (
getSelectionMode() & Widget::SelectionMode::Border) == Widget::SelectionMode::Border) {
156 if (orientation != Orientation::Horizontal && orientation != Orientation::Vertical) {
157 throwException(
"Unknown orientation type in ImageProgressBar object");
183 }
else if (value < 0) {
197 static_cast<void>(recursion);
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual void popClipArea()
Removes the top most clip area from the stack.
virtual void drawImage(Image const *image, int srcX, int srcY, int dstX, int dstY, int width, int height)=0
Draws a part of an image.
virtual bool pushClipArea(Rectangle area)
Pushes a clip area onto the stack.
virtual void setColor(Color const &color)=0
Sets the color to use when drawing.
virtual void fillRectangle(Rectangle const &rectangle)=0
Draws a filled rectangle.
int mValue
Holds the current progress bar value.
void setOrientation(Orientation orientation)
Sets the ImageProgressBar's orientation.
void setValue(int value)
Sets the value of the bar.
int mMaxValue
Value when progress bar is full.
Image const * getBarImage() const
void draw(Graphics *graphics) override
Draws this ImageProgressBar.
void setMaxValue(int value)
Sets the max value of the bar.
void setOpaque(bool opaque)
Sets the opacity of the ImageProgressBar.
Orientation
Orientation of the progress bar (horizontal or vertical).
bool mInternalImage
True if the image has been loaded internally, false otherwise.
void adjustSize() override
Resizes the widget's size to fit the content exactly.
void resizeToContent()
Resizes the widget's size to fit the content exactly, calls recursively all childs.
void setForegroundImage(Image *image)
Sets the foreground image.
Image const * getForegroundImage() const
void adjustSizeImpl()
Adjusts the size of the progress bar to fit the content.
Orientation mOrientation
ImageProgressBar's orientation.
void setBarImage(Image *image)
Sets the Bar image.
Image const * mForegroundImage
Foreground image.
int getMaxValue() const
Gets the max value of the bar.
Image const * mBarImage
Bar image.
bool mOpaque
True if the widget is opaque, false otherwise.
Orientation getOrientation() const
int getValue() const
Gets the value of the bar.
Abstract holder for image data.
Represents a rectangular area (X, Y, Width, Height).