5#include "fifechan/widgets/icon.hpp"
9#include "fifechan/graphics.hpp"
10#include "fifechan/image.hpp"
11#include "fifechan/rectangle.hpp"
15 Icon::Icon() : mImage(nullptr), mInternalImage(false)
99 static_cast<void>(recursion);
129 ((
getSelectionMode() & Widget::SelectionMode::Background) == Widget::SelectionMode::Background)) {
152 Rectangle rect(contentRect.
x, contentRect.
y, w, h);
155 while (rect.
x < tmpW) {
156 rect.
y = contentRect.
y;
157 while (rect.
y < tmpH) {
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
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 void setColor(Color const &color)=0
Sets the color to use when drawing.
virtual void fillRectangle(Rectangle const &rectangle)=0
Draws a filled rectangle.
bool mOpaque
True if opaque, otherwise false.
void setTiling(bool tile)
Sets if the image should be tiled to widget size.
void adjustSize() override
Resizes the widget's size to fit the content exactly.
bool mTile
True if tiling is enabled, otherwise false.
bool mInternalImage
True if the image has been loaded internally, false otherwise.
bool isTiling() const
Gets if the image is tiled to widget size.
bool isScaling() const
Gets if the image is scaled to widget size.
void resizeToContent()
Resizes the widget's size to fit the content exactly, calls recursively all childs.
Image const * getImage() const
Gets the current image.
bool mScale
True if scaling is enabled, otherwise false.
Image const * mImage
The image to display.
void draw(Graphics *graphics) override
Draws the widget.
void setOpaque(bool opaque)
Sets the opacity of the background.
void setScaling(bool scale)
Sets if the image should be scaled to widget size.
void adjustSizeImpl()
Adjusts the size of the icon to fit the image.
void setImage(std::string const &filename)
Sets the image to display.
Abstract holder for image data.
static Image * load(std::string const &filename, bool convertToDisplayFormat=true)
Loads an image by using the class' image loader.
Represents a rectangular area (X, Y, Width, Height).
int width
Holds the width of the rectangle.
int y
Holds the x coordinate of the rectangle.
int x
Holds the x coordinate of the rectangle.
int height
Holds the height of the rectangle.