50 int item_count()
const {
return static_cast<int>(items_.size()); }
63 float pitch()
const {
return item_extent_ + gap_; }
83 float main_of(
Point p)
const {
88 void position_item(
int display_index)
const;
90 std::vector<View*> items_;
92 float item_extent_ = 40.0f;
97 float drag_start_main_ = 0;
98 float drag_offset_ = 0;
99 ValueAnimation settle_{0.0f};
100 ValueAnimation glow_{0.0f};
101 int glow_index_ = -1;
Definition canvas.hpp:240
View * item_at(int i) const
Item at DISPLAY index i (reflects reorders), or nullptr out of range.
Definition reorder_list.hpp:52
int item_count() const
Definition reorder_list.hpp:50
float pitch() const
Distance between adjacent item origins along the main axis.
Definition reorder_list.hpp:63
bool wants_mouse_input() const override
True if this widget handles mouse down/drag through virtual methods even when it does not expose JS p...
Definition reorder_list.hpp:79
int drop_target_index() const
The index the dragged item would land on right now, or -1 when idle.
Definition reorder_list.hpp:68
std::function< void(int from, int to)> on_reorder
Fired once on a committed reorder (drop that changed the index).
Definition reorder_list.hpp:72
Orientation
Definition reorder_list.hpp:40
@ horizontal
Definition reorder_list.hpp:40
@ vertical
Definition reorder_list.hpp:40
int index_of(const View *v) const
Current display index of v, or -1 if not an item.
int dragging_index() const
The item currently being dragged (display index), or -1 when idle.
Definition reorder_list.hpp:66
void set_item_extent(float px)
height (vertical) / width (horizontal)
Definition reorder_list.hpp:60
void on_mouse_down(Point pos) override
void on_mouse_drag(Point pos) override
Orientation orientation() const
Definition reorder_list.hpp:59
void paint(canvas::Canvas &canvas) override
void on_mouse_up(Point pos) override
void add_item(std::unique_ptr< View > item)
Append an item (ownership moves in).
void set_gap(float px)
Definition reorder_list.hpp:61
void layout_children() override
void set_orientation(Orientation o)
Definition reorder_list.hpp:58
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ px
Absolute pixels.
Definition geometry.hpp:393
@ p
Definition input_events.hpp:40
@ i
Definition input_events.hpp:40
@ v
Definition input_events.hpp:41
@ o
Definition input_events.hpp:40
int reorder_target_index(int from, float offset, float pitch, int count)
Target index for a drag that started on item from, moved offset along the main axis,...
Definition geometry.hpp:20