FifeGUI 0.2.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#include "fifechan/point.hpp"
9#include "fifechan/widget.hpp"
10
11namespace fcn
12{
13 class Graphics;
14
20 class FIFEGUI_API LineGraph : public Widget
21 {
22 public:
24 LineGraph();
25
27 explicit LineGraph(PointVector data);
28
29 ~LineGraph() override = default;
30
31 LineGraph(LineGraph const &) = delete;
32 LineGraph& operator=(LineGraph const &) = delete;
33 LineGraph(LineGraph&&) = delete;
34 LineGraph& operator=(LineGraph&&) = delete;
35
37 void setPointVector(PointVector const & data);
38
40 PointVector const & getPointVector() const;
41
43 void resetPointVector();
44
46 void setThickness(unsigned int thickness);
47
49 unsigned int getThickness() const;
50
56 void setOpaque(bool opaque);
57
61 bool isOpaque() const;
62
66 void draw(Graphics* graphics) override;
67
68 protected:
71
73 unsigned int m_thickness;
74
76 PointVector m_data;
77 };
78}; // namespace fcn
79
80#endif // INCLUDE_FIFECHAN_WIDGETS_LINEGRAPH_HPP_
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57
LineGraph()
Default constructor.
Definition linegraph.cpp:15
bool m_opaque
True if the graph is drawn opaque.
Definition linegraph.hpp:70
PointVector const & getPointVector() const
Get the current point vector.
Definition linegraph.cpp:24
void setPointVector(PointVector const &data)
Set the raw point vector used to draw the graph.
Definition linegraph.cpp:19
bool isOpaque() const
Definition linegraph.cpp:49
void draw(Graphics *graphics) override
Draws this widget.
Definition linegraph.cpp:54
void resetPointVector()
Reset the stored data to an empty vector.
Definition linegraph.cpp:29
PointVector m_data
The point data used to draw the graph.
Definition linegraph.hpp:76
unsigned int m_thickness
Stroke thickness in pixels.
Definition linegraph.hpp:73
void setOpaque(bool opaque)
Sets the opacity of the graph.
Definition linegraph.cpp:44
unsigned int getThickness() const
Get stroke thickness in pixels.
Definition linegraph.cpp:39
void setThickness(unsigned int thickness)
Set stroke thickness in pixels.
Definition linegraph.cpp:34
Widget()
Constructor.
Definition widget.cpp:36