FifeGUI 0.2.0
A C++ GUI library designed for games.
horizontalbar.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2026 Fifengine contributors
3
4#ifndef INCLUDE_FIFECHAN_WIDGETS_HORIZONTALBAR_HPP_
5#define INCLUDE_FIFECHAN_WIDGETS_HORIZONTALBAR_HPP_
6
7// Platform config include
8#include "fifechan/platform.hpp"
9
10// Project headers (subdirs before local)
11#include "fifechan/widgets/container.hpp"
12
13namespace fcn
14{
23 class FIFEGUI_API HorizontalBar : public Container
24 {
25 public:
33 enum class Alignment
34 {
35 Start,
36 Center,
37 End
38 };
39
46
47 ~HorizontalBar() override = default;
48
49 HorizontalBar(HorizontalBar const &) = delete;
50 HorizontalBar& operator=(HorizontalBar const &) = delete;
51 HorizontalBar(HorizontalBar&&) = delete;
52 HorizontalBar& operator=(HorizontalBar&&) = delete;
53
60 void setSpacing(unsigned int spacing);
61
68 unsigned int getSpacing() const;
69
76 // cppcheck-suppress duplInheritedMember
77 void setPadding(unsigned int padding);
78
85 unsigned int getPadding() const;
86
93 void setFixedHeight(unsigned int height);
94
101 unsigned int getFixedHeight() const;
102
109 void setClipping(bool clip);
110
117 bool isClipping() const;
118
128 void setExpandChildren(bool expand);
129
136 bool isExpandChildren() const;
137
138 // Inherited from Container
139
140 void resizeToContent(bool recursion = true) override;
141 void adjustSize() override;
142 void draw(Graphics* graphics) override;
143
144 protected:
148 unsigned int mSpacing{4};
149
153 unsigned int mPadding{4};
154
158 unsigned int mFixedHeight{0};
159
163 bool mClipping{true};
164
168 bool mExpandChildren{false};
169 };
170} // namespace fcn
171
172#endif // INCLUDE_FIFECHAN_WIDGETS_HORIZONTALBAR_HPP_
Container()
Constructor.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
A horizontal bar container that arranges children from left to right.
unsigned int mFixedHeight
Fixed height (0 = content-driven).
HorizontalBar()
Constructor.
unsigned int mSpacing
Spacing between children.
unsigned int mPadding
Padding around the bar content.
bool mExpandChildren
Whether children should expand to fill width.
bool mClipping
Whether to clip overflowing content.
Alignment
Alignment options for children within the bar.
Used replacement tokens by configure_file():