FifeGUI 0.3.0
A C++ GUI library designed for games.
linegraph.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_WIDGETS_LINEGRAPH_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_LINEGRAPH_HPP_
7
8// Project headers (subdirs before local)
9#include "fifechan/point.hpp"
10#include "fifechan/widget.hpp"
11
12namespace fcn
13{
14 class Graphics;
15
21 class FIFEGUI_API LineGraph : public Widget
22 {
23 public:
25 LineGraph();
26
28 explicit LineGraph(PointVector data);
29
30 ~LineGraph() override = default;
31
32 LineGraph(LineGraph const &) = delete;
33 LineGraph& operator=(LineGraph const &) = delete;
34 LineGraph(LineGraph&&) = delete;
35 LineGraph& operator=(LineGraph&&) = delete;
36
42 void setPointVector(PointVector const & data);
43
45 PointVector const & getPointVector() const;
46
48 void resetPointVector();
49
55 void setThickness(unsigned int thickness);
56
58 unsigned int getThickness() const;
59
65 void setOpaque(bool opaque);
66
70 bool isOpaque() const;
71
75 void draw(Graphics* graphics) override;
76
77 protected:
80
82 unsigned int m_thickness;
83
86 };
87}; // namespace fcn
88
89#endif // INCLUDE_FIFECHAN_WIDGETS_LINEGRAPH_HPP_
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
LineGraph()
Default constructor.
Definition linegraph.cpp:19
bool m_opaque
True if the graph is drawn opaque.
Definition linegraph.hpp:79
PointVector const & getPointVector() const
Get the current point vector.
Definition linegraph.cpp:32
void setPointVector(PointVector const &data)
Set the raw point vector used to draw the graph.
Definition linegraph.cpp:27
bool isOpaque() const
Definition linegraph.cpp:57
void draw(Graphics *graphics) override
Draws this widget.
Definition linegraph.cpp:62
void resetPointVector()
Reset the stored data to an empty vector.
Definition linegraph.cpp:37
PointVector m_data
The point data used to draw the graph.
Definition linegraph.hpp:85
unsigned int m_thickness
Stroke thickness in pixels.
Definition linegraph.hpp:82
void setOpaque(bool opaque)
Sets the opacity of the graph.
Definition linegraph.cpp:52
unsigned int getThickness() const
Get stroke thickness in pixels.
Definition linegraph.cpp:47
void setThickness(unsigned int thickness)
Set stroke thickness in pixels.
Definition linegraph.cpp:42
Widget()
Constructor.
Definition widget.cpp:52
Used replacement tokens by configure_file():
std::vector< Point > PointVector
A list of points.
Definition point.hpp:331