5#include <fifechan/widgets/piegraph.hpp>
7#include <fifechan/exception.hpp>
8#include <fifechan/graphics.hpp>
71 segment.
color = color;
97 ((
getSelectionMode() & Widget::SelectionMode::Background) == Widget::SelectionMode::Background)) {
110 if (active && (
getSelectionMode() & Widget::SelectionMode::Border) == Widget::SelectionMode::Border) {
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual void drawFillCircleSegment(Point const &p, unsigned int radius, int sangle, int eangle)=0
Draws a filled circle segment.
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.
Point m_center
The center point of the pie graph.
int getCenterX() const
Get the center x-coordinate.
bool m_opaque
True if the pie graph is drawn opaque.
PieGraph()
Default constructor.
void addSegment(int startAngle, int stopAngle, Color const &color)
Add a segment to the pie graph.
void setRadius(int radius)
Set the radius of the pie graph.
void setCenterX(int x)
Set the center x-coordinate.
int getRadius() const
Get the radius of the pie graph.
int getCenterY() const
Get the center y-coordinate.
int m_radius
The radius of the pie graph in pixels.
Point const & getCenter() const
Get the center point.
std::vector< PieGraphSegment > m_segments
The list of segments that make up the pie graph.
void clearSegments()
Remove all segments from the pie graph.
void draw(Graphics *graphics) override
Draws this widget.
void setCenterY(int y)
Set the center y-coordinate.
void setOpaque(bool opaque)
Sets the opacity of the graph.
void setCenter(int x, int y)
Set the center coordinates.
Represents a 2D coordinate (X, Y).
Represents a single segment of a pie graph (angles and color).
int stopAngle
Stop angle in degrees.
Color color
Color of the segment.
int startAngle
Start angle in degrees.