114 std::unique_ptr<ListItem> owned;
117 std::vector<Row> _rows;
118 std::vector<sf::RectangleShape> _dividers;
123 float _width = 300.f;
128 void rebuildDividers();
129 void applyThemeToOwnedItems();
130 void applySettingsToOwnedItems();
147 static_assert(std::is_base_of_v<ListSettings, S>,
148 "applySettings() requires a type derived from ListSettings");
150 applySettingsToOwnedItems();
157 static_assert(std::is_base_of_v<ListTheme, T>,
158 "applyTheme() requires a type derived from ListTheme");
160 applyThemeToOwnedItems();
164 template<
typename St>
167 static_assert(std::is_base_of_v<ListSettings, St> &&
168 std::is_base_of_v<ListTheme, St>,
169 "applyStyle() requires ListSettings and ListTheme");
172 applyThemeToOwnedItems();
173 applySettingsToOwnedItems();
191 const std::string& description =
"");
208 [[nodiscard]] std::size_t
rowCount()
const {
return _rows.size(); }
221 [[nodiscard]]
float getWidth()
const {
return _width; }
241 template<
typename MANIFEST>
Virtual base class for all Malena framework objects.
static const sf::Font & getDefault()
Return the built-in Arial font.
sf::Vector2f getPosition() const override
void applyTheme(const T &t)
std::size_t rowCount() const
Return the number of rows.
float getTotalHeight() const
void applyStyle(const St &s)
void setIndentOffset(float offset)
Set the current indentation offset in pixels. Called automatically by a parent List when nesting.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
void clear()
Remove all rows. Owned ListItem objects are destroyed.
void setPosition(const sf::Vector2f &position) override
List & operator=(const List &)=delete
void setWidth(float width)
Set the total width of the list.
sf::FloatRect getGlobalBounds() const override
void add(ml::Core &component)
Add any ml::Core component as a row.
List(const List &)=delete
ListManifest::State State
void applySettings(const S &s)
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
ListItem & addItem(const std::string &label, const std::string &description="")
Create and own a ListItem with a label.
List(const sf::Font &font=FontManager<>::getDefault())
A single row in a List with start, content and end slots.
List(const sf::Font &font=FontManager<>::getDefault())
Base class for all Malena manifests.
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
Vector2< float > Vector2f
Layout and behaviour settings for List.
Universal design token set applied across all Themeable components.