FifeGUI 0.3.0
A C++ GUI library designed for games.
bargraph.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_BARGRAPH_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_BARGRAPH_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
25 class FIFEGUI_API BarGraph : public Widget
26 {
27 public:
28 BarGraph();
29
33 BarGraph(int x, int y, int w, int h);
34
35 ~BarGraph() override = default;
36
37 BarGraph(BarGraph const &) = delete;
38 BarGraph& operator=(BarGraph const &) = delete;
39 BarGraph(BarGraph&&) = delete;
40 BarGraph& operator=(BarGraph&&) = delete;
41
45 void setBarX(int x);
46
50 int getBarX() const;
51
57 void setBarY(int y);
58
62 int getBarY() const;
63
70 void setBarPosition(int x, int y);
71
77 void setBarPosition(Point const & pos);
78
84 void setBarWidth(int w);
85
89 int getBarWidth() const;
90
95 void setBarHeight(int h);
96
100 int getBarHeight() const;
101
108 void setBarSize(int w, int h);
109
115 void setOpaque(bool opaque);
116
120 bool isOpaque() const;
121
125 void draw(Graphics* graphics) override;
126
127 protected:
131 bool m_opaque{false};
132
137 };
138}; // namespace fcn
139
140#endif // INCLUDE_FIFECHAN_WIDGETS_BARGRAPH_HPP_
void draw(Graphics *graphics) override
Draws this widget.
Definition bargraph.cpp:89
void setBarHeight(int h)
Sets the height of the bar.
Definition bargraph.cpp:63
int getBarWidth() const
Definition bargraph.cpp:58
void setBarWidth(int w)
Sets the width of the bar.
Definition bargraph.cpp:53
bool isOpaque() const
Definition bargraph.cpp:84
int getBarX() const
Definition bargraph.cpp:26
bool m_opaque
m_opaque is true if the graph is opaque, false otherwise.
Definition bargraph.hpp:131
void setBarPosition(int x, int y)
Sets the position of the bar.
Definition bargraph.cpp:41
void setBarSize(int w, int h)
Sets the size of the bar.
Definition bargraph.cpp:73
Rectangle m_rec
m_rec is the rectangle that represents the bar.
Definition bargraph.hpp:136
int getBarY() const
Definition bargraph.cpp:36
void setBarY(int y)
Sets the y position of the bar.
Definition bargraph.cpp:31
void setBarX(int x)
Sets the x position of the bar.
Definition bargraph.cpp:21
void setOpaque(bool opaque)
Sets the opacity of the graph.
Definition bargraph.cpp:79
int getBarHeight() const
Definition bargraph.cpp:68
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
Represents a 2D coordinate (X, Y).
Definition point.hpp:34
Represents a rectangular area (X, Y, Width, Height).
Definition rectangle.hpp:22
Widget()
Constructor.
Definition widget.cpp:52
Used replacement tokens by configure_file():