4#ifndef MALENA_COLORPICKER_H
5#define MALENA_COLORPICKER_H
40 [[nodiscard]]
const std::vector<sf::Color>&
palette()
const {
return _palette; }
76 std::vector<sf::Color> _palette;
78 std::function<void(
const sf::Color&)> _onColorSelected;
79 std::function<void(
const sf::Color&)> _onColorRemoved;
80 std::function<void(std::size_t,
const sf::Vector2f&)> _onSwatchRightClick;
88 bool _prevMouseDown =
false;
89 bool _prevRightDown =
false;
90 mutable int _hoverIndex = -1;
void setSwatchGap(float px)
sf::FloatRect getGlobalBounds() const override
Return the axis-aligned bounding box in world space.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
void removeColor(std::size_t index)
void onColorRemoved(std::function< void(const sf::Color &)> cb)
void setColumns(int columns)
void addColor(const sf::Color &c)
void setSwatchSize(float px)
sf::Vector2f getPosition() const override
Return the current world-space position.
void onColorSelected(std::function< void(const sf::Color &)> cb)
void setMaxColors(int max)
const std::vector< sf::Color > & palette() const
void setPosition(const sf::Vector2f &pos) override
Set the world-space position immediately (no animation).
void onSwatchRightClick(std::function< void(std::size_t, const sf::Vector2f &)> cb)
void setPalette(const std::vector< sf::Color > &colors)
Vector2< float > Vector2f