4#ifndef MALENA_EDITABLELIST_H
5#define MALENA_EDITABLELIST_H
101 const std::vector<int>& selected = {});
103 [[nodiscard]] std::vector<std::string>
values()
const;
121 std::unique_ptr<Core> makeContent()
const;
123 void onSelectorClicked(Row* row);
124 void refreshSelectors();
125 int indexOf(
const Row* row)
const;
126 void fireChange()
const;
130 std::vector<std::unique_ptr<Row>> _rows;
132 SelectionMode _mode = SelectionMode::Single;
133 ContentFactory _contentFactory;
134 std::string _placeholder;
135 std::string _addLabel =
"+ Add";
136 bool _showActions =
true;
137 bool _showAdd =
true;
140 float _rowHeight = 34.f;
142 std::function<void()> _onChange;
Virtual base class for all Malena framework objects.
void onChange(std::function< void()> cb)
void removeRow(int index)
void setContentFactory(ContentFactory factory)
std::vector< int > selectedIndices() const
EditableList(const EditableList &)=delete
void setPosition(const sf::Vector2f &pos) override
Set the world-space position immediately (no animation).
void setSize(const sf::Vector2f &size)
std::vector< std::string > values() const
Text of every row, in order (includes empty rows — caller filters).
std::function< std::unique_ptr< Core >()> ContentFactory
void setSelected(int index, bool selected)
void setValues(const std::vector< std::string > &values, const std::vector< int > &selected={})
Replace all rows with one per value; selected marks the chosen rows.
void setPlaceholder(const std::string &text)
void setSelectionMode(SelectionMode mode)
void setShowAddButton(bool show)
void setShowActions(bool show)
void onEnabledChanged(bool enabled) override
void setAddButtonLabel(const std::string &label)
EditableList & operator=(const EditableList &)=delete
void setVisible(bool visible) override
void setRowHeight(float h)
Core * contentAt(int index) const
Vector2< float > Vector2f