5#include "fifechan/widgets/label.hpp"
10#include "fifechan/exception.hpp"
11#include "fifechan/font.hpp"
12#include "fifechan/graphics.hpp"
16 Label::Label() : mAlignment(
Graphics::Alignment::Left)
83 case Graphics::Alignment::Left:
86 case Graphics::Alignment::Center:
90 case Graphics::Alignment::Right:
94 throwException(
"Unknown alignment.");
virtual int getHeight() const =0
Gets the height of the glyphs in the font.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Alignment
Alignments for text drawing.
void drawText(std::string const &text, int x, int y)
Draws text with a default left alignment.
virtual void setFont(Font *font)
Sets the font to use when drawing text.
virtual void setColor(Color const &color)=0
Sets the color to use when drawing.
void draw(Graphics *graphics) override
Draws the widget.
void setAlignment(Graphics::Alignment alignment)
Sets the alignment of the caption.
void adjustSize() override
Resizes the widget's size to fit the content exactly.
std::string const & getCaption() const
Gets the caption of the label.
Graphics::Alignment getAlignment() const
Gets the alignment of the caption.
void setCaption(std::string const &caption)
Sets the caption of the label.
Graphics::Alignment mAlignment
Holds the alignment of the caption.
void resizeToContent()
Resizes the widget's size to fit the content exactly, calls recursively all childs.
std::string mCaption
Holds the caption of the label.
void adjustSizeImpl()
Adjusts the size of the label to fit the caption.
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.