FifeGUI 0.2.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#include "fifechan/point.hpp"
9#include "fifechan/widget.hpp"
10
11namespace fcn
12{
13 class Graphics;
14
24 class FIFEGUI_API BarGraph : public Widget
25 {
26 public:
27 BarGraph();
28
32 BarGraph(int x, int y, int w, int h);
33
34 ~BarGraph() override = default;
35
36 BarGraph(BarGraph const &) = delete;
37 BarGraph& operator=(BarGraph const &) = delete;
38 BarGraph(BarGraph&&) = delete;
39 BarGraph& operator=(BarGraph&&) = delete;
40
44 void setBarX(int x);
45
49 int getBarX() const;
50
54 void setBarY(int y);
55
59 int getBarY() const;
60
64 void setBarPosition(int x, int y);
65
70 void setBarPosition(Point const & pos);
71
75 void setBarWidth(int w);
76
80 int getBarWidth() const;
81
85
86 void setBarHeight(int h);
87
91 int getBarHeight() const;
92
96 void setBarSize(int w, int h);
97
103 void setOpaque(bool opaque);
104
108 bool isOpaque() const;
109
113 void draw(Graphics* graphics) override;
114
115 protected:
119 bool m_opaque{false};
120
125 };
126}; // namespace fcn
127
128#endif // INCLUDE_FIFECHAN_WIDGETS_BARGRAPH_HPP_
void draw(Graphics *graphics) override
Draws this widget.
Definition bargraph.cpp:85
void setBarHeight(int h)
Sets the height of the bar.
Definition bargraph.cpp:59
int getBarWidth() const
Definition bargraph.cpp:54
void setBarWidth(int w)
Sets the width of the bar.
Definition bargraph.cpp:49
bool isOpaque() const
Definition bargraph.cpp:80
int getBarX() const
Definition bargraph.cpp:22
bool m_opaque
m_opaque is true if the graph is opaque, false otherwise.
Definition bargraph.hpp:119
void setBarPosition(int x, int y)
Sets the position of the bar.
Definition bargraph.cpp:37
void setBarSize(int w, int h)
Sets the size of the bar.
Definition bargraph.cpp:69
Rectangle m_rec
m_rec is the rectangle that represents the bar.
Definition bargraph.hpp:124
int getBarY() const
Definition bargraph.cpp:32
void setBarY(int y)
Sets the y position of the bar.
Definition bargraph.cpp:27
void setBarX(int x)
Sets the x position of the bar.
Definition bargraph.cpp:17
void setOpaque(bool opaque)
Sets the opacity of the graph.
Definition bargraph.cpp:75
int getBarHeight() const
Definition bargraph.cpp:64
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57
Represents a 2D coordinate (X, Y).
Definition point.hpp:29
Represents a rectangular area (X, Y, Width, Height).
Definition rectangle.hpp:20
Widget()
Constructor.
Definition widget.cpp:36