25#ifndef TGUI_COLOR_PICKER_HPP
26#define TGUI_COLOR_PICKER_HPP
29#include <TGUI/Widgets/ChildWindow.hpp>
30#include <TGUI/Widgets/Slider.hpp>
31#include <TGUI/Widgets/Panel.hpp>
32#include <TGUI/Renderers/ColorPickerRenderer.hpp>
45 using Ptr = std::shared_ptr<ColorPicker>;
46 using ConstPtr = std::shared_ptr<const ColorPicker>;
48 static constexpr const char StaticWidgetType[] =
"ColorPicker";
58 ColorPicker(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
141 void leftMousePressed(
Vector2f pos)
override;
146 void leftMouseButtonNoLongerDown()
override;
151 void mouseMoved(
Vector2f pos)
override;
196 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
202 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
217 void identifyButtonsAndConnect();
231 Sprite m_colorWheelSprite;
241 Panel::Ptr m_current = Panel::create({60, 30});
243 bool m_colorRead =
false;
Base class for render targets.
Definition: BackendRenderTarget.hpp:48
Child window widget.
Definition: ChildWindow.hpp:44
Definition: ColorPickerRenderer.hpp:37
Color picker widget.
Definition: ColorPicker.hpp:42
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.
ColorPickerRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
Signal & getSignal(String signalName) override
Retrieves a signal based on its name.
ColorPickerRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
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:45
Color getColor() const
Returns the picked color.
std::shared_ptr< const ColorPicker > ConstPtr
Shared constant widget pointer.
Definition: ColorPicker.hpp:46
ColorPicker & operator=(ColorPicker &&right) noexcept
Overload of move assignment operator.
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.
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:63
std::shared_ptr< Panel > Ptr
Shared widget pointer.
Definition: Panel.hpp:44
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:58
std::shared_ptr< Slider > Ptr
Shared widget pointer.
Definition: Slider.hpp:44
Definition: Sprite.hpp:45
Wrapper class to store strings.
Definition: String.hpp:79
Definition: Texture.hpp:52
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
States used for drawing.
Definition: RenderStates.hpp:39