14#include <egt/detail/meta.h>
16#include <egt/signal.h>
18#include <egt/string.h>
20#include <egt/widget.h>
66 using ItemArray = std::vector<std::shared_ptr<StringItem>>;
112 auto carea = content_area();
115 m_view.box(to_subordinate(carea));
116 m_sizer.resize(carea.size());
136 EGT_NODISCARD
size_t item_count()
const {
return m_sizer.count_children(); }
141 void add_item(
const std::shared_ptr<StringItem>& item);
157 auto i = std::shared_ptr<StringItem>(&item, [](
StringItem*) {});
164 EGT_NODISCARD std::shared_ptr<StringItem>
item_at(
size_t index)
const;
226 void add_item_private(
const std::shared_ptr<StringItem>& item);
Positions and sizes widgets by Orientation.
Definition sizer.h:49
A Frame is a Widget that has children widgets.
Definition frame.h:45
ListBox that manages a selectable list of widgets.
Definition list.h:42
BoxSizer m_sizer
Internal sizer used to layout items.
Definition list.h:219
void scroll_top()
Scroll all the way to the top of the list.
void orient(Orientation orient)
Set the orientation of the list: either vertical or horizontal.
ScrolledView m_view
View used to contain the possible large sizer.
Definition list.h:216
Signal on_items_changed
Invoked when items are added or removed.
Definition list.h:62
Signal on_selected_changed
Event signal.
Definition list.h:52
Signal< size_t > on_selected
Invoked when an item is selected with the index of the item selected.
Definition list.h:57
EGT_NODISCARD size_t item_count() const
Return the number of items in the list.
Definition list.h:136
EGT_NODISCARD ssize_t selected() const
Get the currently selected index.
void scroll_beginning()
Scroll all the way to the beginning of the list, either horizontally or vertically.
ListBox(Serializer::Properties &props, bool is_derived) noexcept
void scroll_bottom()
Scroll all the way to the bottom of the list.
EGT_NODISCARD Orientation orient() const
Get the orientation of the list: either vertical or horizontal.
Definition list.h:206
std::vector< std::shared_ptr< StringItem > > ItemArray
Item array type.
Definition list.h:66
void selected(size_t index)
Select an item by index.
void resize(const Size &s) override
Resize the widget.
Definition list.h:107
void serialize(Serializer &serializer) const override
Serialize the widget to the specified serializer.
void scroll_end()
Scroll all the way to the end of the list, either horizontally or vertically.
void remove_item(StringItem *item)
Remove an item from the list.
ListBox(Serializer::Properties &props) noexcept
Definition list.h:94
ListBox(const ItemArray &items=ItemArray()) noexcept
void handle(Event &event) override
Handle an event.
void clear()
Remove all items from the list.
void add_item(const std::shared_ptr< StringItem > &item)
Add a new item to the end of the list.
void add_item(StringItem &item)
Add a new item to the end of the list.
Definition list.h:152
EGT_NODISCARD std::shared_ptr< StringItem > item_at(size_t index) const
Get the currently selected index item from list.
Abstract base serializer class.
Definition serialize.h:34
std::list< std::tuple< std::string, std::string, Serializer::Attributes > > Properties
Definition serialize.h:47
Signal class used for defining a signal and dispatching events.
Definition signal.h:30
Orientation
Generic orientation flags.
Definition widgetflags.h:652
EGT framework namespace.
Definition animation.h:24
A single event that has information about the event and state for the event.
Definition event.h:255
List string helper.
Definition string.h:34