TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::DoubleClickTracker Struct Reference

Click-gesture tracker, owned per widget instance so instances (and tests) don't share it. More...

#include <gui_controls/gui_widget_state_types.h>

Classes

struct  Result
 Whether this click hit the same item as the previous one, and the time since it. More...

Public Member Functions

Result Update (tachyon::ID id)
 Records a click on id and compares it with the previous click.
bool IsDoubleClick (tachyon::ID id)
 Records a click on id: true when it is the second click of a double-click (the same item, within DoubleClickMilliseconds()).
void Reset ()
 Forgets the previous click, so the next one never counts as a repeat.

Public Attributes

tachyon::ID lastID = tachyon::ID::Invalid()
 item of the previous click
int64_t lastTimeNanos = 0
 steady-clock ns; see SteadyClockNowNanos()

Detailed Description

Click-gesture tracker, owned per widget instance so instances (and tests) don't share it.

Member Function Documentation

◆ Update()

Result tachyon::DoubleClickTracker::Update ( tachyon::ID id)
inline

Records a click on id and compares it with the previous click.

◆ IsDoubleClick()

bool tachyon::DoubleClickTracker::IsDoubleClick ( tachyon::ID id)
inline

Records a click on id: true when it is the second click of a double-click (the same item, within DoubleClickMilliseconds()).

A double-click is forgotten, so a third click starts over.

◆ Reset()

void tachyon::DoubleClickTracker::Reset ( )
inline

Forgets the previous click, so the next one never counts as a repeat.

Member Data Documentation

◆ lastID

tachyon::ID tachyon::DoubleClickTracker::lastID = tachyon::ID::Invalid()

item of the previous click

◆ lastTimeNanos

int64_t tachyon::DoubleClickTracker::lastTimeNanos = 0

steady-clock ns; see SteadyClockNowNanos()


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