25#ifndef TGUI_BUTTON_BASE_HPP
26#define TGUI_BUTTON_BASE_HPP
28#include <TGUI/Renderers/ButtonRenderer.hpp>
29#include <TGUI/Widgets/ClickableWidget.hpp>
30#include <TGUI/Components.hpp>
34TGUI_MODULE_EXPORT
namespace tgui
39 class TGUI_API ButtonBase :
public ClickableWidget
43 using Ptr = std::shared_ptr<ButtonBase>;
44 using ConstPtr = std::shared_ptr<const ButtonBase>;
53 ButtonBase(
const char* typeName,
bool initRenderer);
68 ButtonBase& operator=(const ButtonBase&);
73 ButtonBase& operator=(ButtonBase&&) noexcept;
78 ~ButtonBase() override;
192 void leftMouseReleased(Vector2f pos) override;
197 void leftMouseButtonNoLongerDown() override;
230 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers) const override;
235 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
250 virtual
void updateSize();
255 virtual
void updateTextPosition();
260 virtual
void initComponents();
265 void addComponent(const std::shared_ptr<priv::dev::Component>& component);
270 TGUI_NODISCARD std::shared_ptr<priv::dev::Component> getComponent(const
String& name);
278 priv::dev::ComponentState m_state = priv::dev::ComponentState::Normal;
280 bool m_autoSize = true;
281 bool m_updatingTextSize = false;
282 bool m_ignoreKeyEvents = false;
285 Vector2f m_textOrigin;
287 priv::dev::StylePropertyBackground background;
288 priv::dev::StylePropertyText text;
290 std::uint64_t m_textStyleChangedCallbackId = 0;
293 std::map<
String, priv::dev::StylePropertyBase*> m_stylePropertiesNames;
294 std::map<
String, std::vector<priv::dev::StylePropertyBase*>> m_stylePropertiesGlobalNames;
295 std::map<
String, std::shared_ptr<priv::dev::Component>> m_namedComponents;
298 std::shared_ptr<priv::dev::BackgroundComponent> m_backgroundComponent;
299 std::shared_ptr<priv::dev::TextComponent> m_textComponent;
301 std::vector<std::shared_ptr<priv::dev::Component>> m_components;
Class to store the a value that is either a constant or a ratio.
Definition AbsoluteOrRelativeValue.hpp:45
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Class to store the position or size of a widget.
Definition Layout.hpp:323
Wrapper class to store strings.
Definition String.hpp:96
Definition Vector2.hpp:41
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
States used for drawing.
Definition RenderStates.hpp:38