1 #ifndef LIBWTK_SDL2_LIST_VIEW_HPP 2 #define LIBWTK_SDL2_LIST_VIEW_HPP 8 #include "selectable.hpp" 13 list_view(std::vector<std::string>
const & values, std::size_t position, std::function<
void(std::size_t)> activate_callback);
19 void on_key_event(
key_event const & e)
override;
32 void set_position(std::size_t position);
33 void set_selected_position(std::size_t position);
34 void set_highlight_position(std::size_t position);
35 void set_list(std::vector<std::string>
const & values, std::size_t position = 0);
37 std::size_t get_visible_entries()
const;
39 void scroll_up(std::size_t amount);
40 void scroll_down(std::size_t amount);
48 int hit_entry(
int y)
const;
50 std::optional<point> _opt_pressed_point;
52 std::size_t _position;
54 std::size_t _selected_position;
56 std::size_t _highlight_position;
61 std::reference_wrapper<std::vector<std::string>
const> _values;
63 std::function<void(std::size_t)> _activate_callback;
Definition: mouse_event.hpp:19
Definition: mouse_event.hpp:8
Definition: selectable.hpp:6
Definition: draw_context.hpp:126
void on_draw(draw_context &dc, selection_context const &sc) const override
Definition: key_event.hpp:4
void on_box_allocated() override
Definition: list_view.hpp:11
Definition: selection_context.hpp:18
size_hint get_size_hint(int width, int height) const override
void on_activate() override
Definition: widget.hpp:35