Loading...
Searching...
No Matches
ml::DragList Class Reference

#include <Malena/Graphics/Controls/DragList.h>

Public Member Functions

std::vector< int > displayOrder (int count) const
int dragIndex () const
int dropIndex () const
float ghostY () const
 Clamped Y for the floating ghost row (owner draws the dragged row here).
bool isDragging () const
void onReorder (std::function< void(int from, int to)> cb)
void onTap (std::function< void(int index)> cb)
void setGeometry (float hitX0, float hitX1, float rowTop, int count, float rowHeight)
bool update (float localX, float localY, bool down, bool live)

Static Public Attributes

static constexpr float kDragThreshold = 6.f

Detailed Description

Definition at line 26 of file DragList.h.

Member Function Documentation

◆ displayOrder()

std::vector< int > ml::DragList::displayOrder ( int count) const
inline

Row indices in display order: the dragged row sits at its drop slot; identity order otherwise. The owner draws a gap where slot's index == dragIndex().

Definition at line 80 of file DragList.h.

◆ dragIndex()

int ml::DragList::dragIndex ( ) const
inline

Definition at line 94 of file DragList.h.

◆ dropIndex()

int ml::DragList::dropIndex ( ) const
inline

Definition at line 95 of file DragList.h.

◆ ghostY()

float ml::DragList::ghostY ( ) const
inline

Clamped Y for the floating ghost row (owner draws the dragged row here).

Definition at line 98 of file DragList.h.

◆ isDragging()

bool ml::DragList::isDragging ( ) const
inline

Definition at line 93 of file DragList.h.

◆ onReorder()

void ml::DragList::onReorder ( std::function< void(int from, int to)> cb)
inline

Definition at line 38 of file DragList.h.

◆ onTap()

void ml::DragList::onTap ( std::function< void(int index)> cb)
inline

Definition at line 39 of file DragList.h.

◆ setGeometry()

void ml::DragList::setGeometry ( float hitX0,
float hitX1,
float rowTop,
int count,
float rowHeight )
inline

Set the active list's geometry (all in the owner's local coords). hitX0..hitX1 is the horizontal band that starts a drag (exclude per-row buttons). count==0 disables dragging.

Definition at line 34 of file DragList.h.

◆ update()

bool ml::DragList::update ( float localX,
float localY,
bool down,
bool live )
inline

Feed once per frame with the cursor in the SAME local coords as setGeometry, the left-button state, and whether the list is currently interactive. Returns true when the visual state changed (owner should re-render).

Definition at line 44 of file DragList.h.

Member Data Documentation

◆ kDragThreshold

float ml::DragList::kDragThreshold = 6.f
staticconstexpr

Definition at line 29 of file DragList.h.


The documentation for this class was generated from the following file: