25#ifndef TGUI_BUTTON_BASE_HPP
26#define TGUI_BUTTON_BASE_HPP
28#include <TGUI/Components.hpp>
29#include <TGUI/Renderers/ButtonRenderer.hpp>
30#include <TGUI/Widgets/ClickableWidget.hpp>
39 class TGUI_API ButtonBase :
public ClickableWidget
42 using Ptr = std::shared_ptr<ButtonBase>;
43 using ConstPtr = std::shared_ptr<const ButtonBase>;
52 ButtonBase(
const char* typeName,
bool initRenderer);
191 void leftMouseReleased(Vector2f pos)
override;
196 void leftMouseButtonNoLongerDown()
override;
229 [[nodiscard]] std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
234 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
249 virtual void updateSize();
254 virtual void updateTextPosition();
259 virtual void initComponents();
264 void addComponent(
const std::shared_ptr<priv::dev::Component>& component);
269 [[nodiscard]] std::shared_ptr<priv::dev::Component> getComponent(
const String& name);
277 priv::dev::ComponentState m_state = priv::dev::ComponentState::Normal;
279 bool m_autoSize =
true;
280 bool m_updatingTextSize =
false;
281 bool m_ignoreKeyEvents =
false;
284 Vector2f m_textOrigin;
286 priv::dev::StylePropertyBackground background;
287 priv::dev::StylePropertyText text;
289 std::uint64_t m_textStyleChangedCallbackId = 0;
292 std::map<String, priv::dev::StylePropertyBase*> m_stylePropertiesNames;
293 std::map<String, std::vector<priv::dev::StylePropertyBase*>> m_stylePropertiesGlobalNames;
294 std::map<String, std::shared_ptr<priv::dev::Component>> m_namedComponents;
297 std::shared_ptr<priv::dev::BackgroundComponent> m_backgroundComponent;
298 std::shared_ptr<priv::dev::TextComponent> m_textComponent;
300 std::vector<std::shared_ptr<priv::dev::Component>> m_components;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Class to store the position or size of a widget.
Definition Layout.hpp:320
Wrapper class to store strings.
Definition String.hpp:94
Definition Vector2.hpp:42
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
States used for drawing.
Definition RenderStates.hpp:38