4#ifndef MALENA_EDITABLELIST_H
5#define MALENA_EDITABLELIST_H
92 const std::vector<int>& selected = {});
94 [[nodiscard]] std::vector<std::string>
values()
const;
112 std::unique_ptr<Core> makeContent()
const;
114 void onSelectorClicked(Row* row);
115 void refreshSelectors();
116 int indexOf(
const Row* row)
const;
117 void fireChange()
const;
121 std::vector<std::unique_ptr<Row>> _rows;
123 SelectionMode _mode = SelectionMode::Single;
124 ContentFactory _contentFactory;
125 std::string _placeholder;
126 std::string _addLabel =
"+ Add";
127 bool _showActions =
true;
128 bool _showAdd =
true;
131 float _rowHeight = 34.f;
133 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
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)
void setVisible(bool visible) override
void setRowHeight(float h)
Core * contentAt(int index) const
Vector2< float > Vector2f