18#ifndef MALENA_DYNAMICPANEL_H
19#define MALENA_DYNAMICPANEL_H
57 Text&
text(
const std::string& s,
float x,
float y,
unsigned size,
63 int style, std::function<
void()>
onClick);
72 float x,
float y,
float w,
float h,
const std::string& value,
73 std::function<
void(
const std::string&)> onChange);
100 std::function<void(
Builder&)> _build;
103 std::vector<std::unique_ptr<RectangleButton>> _buttons;
104 std::vector<std::unique_ptr<Text>> _texts;
105 std::map<std::string, std::unique_ptr<TextInput>> _inputs;
107 std::size_t _btnUsed = 0, _txtUsed = 0;
108 std::set<std::string> _usedInputs;
void onClick(std::function< void()> callback, bool overwrite=true)
friend class DynamicPanel
RectangleButton & rect(float x, float y, float w, float h, const sf::Color &fill)
A non-interactive coloured rectangle (decor / background / divider).
TextInput & input(const std::string &id, const std::string &placeholder, float x, float y, float w, float h, const std::string &value, std::function< void(const std::string &)> onChange)
Text & text(const std::string &s, float x, float y, unsigned size, const sf::Color &color, bool center=false)
A label. Pass center=true to horizontally centre it on x.
RectangleButton & button(const std::string &label, float x, float y, float w, float h, int style, std::function< void()> onClick)
void setButtonStyler(std::function< void(RectangleButton &, int, float, float)> styler)
void onBuild(std::function< void(Builder &)> fn)
Declare the panel's content. Runs on the next rebuild.
DynamicPanel & operator=(const DynamicPanel &)=delete
bool isRebuildPending() const
DynamicPanel(const DynamicPanel &)=delete
A framework-integrated text object with word-wrap support.
Single-line rich text input with horizontal scrolling.