25#ifndef TGUI_COLOR_PICKER_HPP
26#define TGUI_COLOR_PICKER_HPP
28#include <TGUI/Widgets/ChildWindow.hpp>
29#include <TGUI/Widgets/Slider.hpp>
30#include <TGUI/Widgets/Panel.hpp>
31#include <TGUI/Renderers/ColorPickerRenderer.hpp>
35TGUI_MODULE_EXPORT
namespace tgui
44 using Ptr = std::shared_ptr<ColorPicker>;
45 using ConstPtr = std::shared_ptr<const ColorPicker>;
47 static constexpr const char StaticWidgetType[] =
"ColorPicker";
56 ColorPicker(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
133 void leftMouseButtonNoLongerDown()
override;
138 void mouseMoved(
Vector2f pos)
override;
177 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
182 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
195 void identifyButtonsAndConnect();
207 Sprite m_colorWheelSprite;
217 Panel::Ptr m_current = Panel::create({60, 30});
219 bool m_colorRead =
false;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Child window widget.
Definition ChildWindow.hpp:45
Definition ColorPickerRenderer.hpp:35
Color picker widget.
Definition ColorPicker.hpp:41
static ColorPicker::Ptr copy(const ColorPicker::ConstPtr &colorPicker)
Makes a copy of another color picker.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
ColorPickerRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Signal & getSignal(String signalName) override
Retrieves a signal based on its name.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
static ColorPicker::Ptr create(const String &title="", Color color=Color::Black)
Creates a new color picker widget.
std::shared_ptr< ColorPicker > Ptr
Shared widget pointer.
Definition ColorPicker.hpp:44
Color getColor() const
Returns the picked color.
std::shared_ptr< const ColorPicker > ConstPtr
Shared constant widget pointer.
Definition ColorPicker.hpp:45
ColorPicker & operator=(ColorPicker &&right) noexcept
Overload of move assignment operator.
bool leftMousePressed(Vector2f pos) override
Called by the parent when the left mouse button goes down on top of the widget.
ColorPicker(ColorPicker &©) noexcept
Move constructor.
ColorPicker(const ColorPicker ©)
Copy constructor.
void setColor(const Color &color)
Changes the color of Color Picker.
ColorPicker & operator=(const ColorPicker &right)
Overload of copy assignment operator.
ColorPickerRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
Wrapper for colors.
Definition Color.hpp:73
std::shared_ptr< Panel > Ptr
Shared widget pointer.
Definition Panel.hpp:42
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
std::shared_ptr< Slider > Ptr
Shared widget pointer.
Definition Slider.hpp:42
Wrapper class to store strings.
Definition String.hpp:96
Texture wrapper that internally reuses resources when multiple Texture objects are loaded from the sa...
Definition Texture.hpp:57
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
States used for drawing.
Definition RenderStates.hpp:38