6#include <fifechan/widgets/pointgraph.hpp>
14#include "fifechan/exception.hpp"
15#include "fifechan/graphics.hpp"
65 assert(
"graphics must not be null" && graphics !=
nullptr);
71 ((
getSelectionMode() & Widget::SelectionMode::Background) == Widget::SelectionMode::Background)) {
84 if (active && (
getSelectionMode() & Widget::SelectionMode::Border) == Widget::SelectionMode::Border) {
100 auto pit =
m_data.begin();
106 for (; pit !=
m_data.end(); ++pit) {
107 int const x2 = (*pit).x;
108 int const y2 = (*pit).y;
114 for (; pit !=
m_data.end(); ++pit) {
115 int const x2 = (*pit).x;
116 int const y2 = (*pit).y;
125 unsigned int const markerRadius = std::max(4U,
m_thickness);
127 for (; pit !=
m_data.end(); ++pit) {
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual void drawLine(int x1, int y1, int x2, int y2)=0
Draws a line.
virtual void drawFillCircle(Point const &p, unsigned int radius)=0
Draws a filled circle.
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.
virtual void drawRoundStroke(int x1, int y1, int x2, int y2, unsigned int width)
Draws a round brush stroke along the line segment.
unsigned int m_thickness
Line thickness in pixels.
PointVector m_data
The point data used to draw the graph.
PointGraph()
Default constructor.
unsigned int getThickness() const
Get the thickness of the lines drawn between points.
void draw(Graphics *graphics) override
Draws this widget.
PointVector const & getPointVector() const
void setOpaque(bool opaque)
Sets the opacity of the graph.
void resetPointVector()
Resets the data to draw.
bool m_opaque
True if the graph is drawn opaque.
void setThickness(unsigned int thickness)
Set the thickness of the lines drawn between points.
void setPointVector(PointVector const &data)
Sets the data to draw.
Used replacement tokens by configure_file():
std::vector< Point > PointVector
A list of points.