Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBScroller handles panning while the pointer is down and measure the pan speed over time. More...
#include <tb_scroller.h>
Public Member Functions | |
TBScroller (TBWidget *target) | |
void | SetSnapListener (TBScrollerSnapListener *listener) |
Set the listener that may override the target scroll position. More... | |
void | Start () |
Start tracking pan movement from calls to OnPan. More... | |
void | Stop () |
Stop tracking pan movement from calls to OnPan, or stop any ongoing scrolling. More... | |
bool | IsStarted () const |
Return true if the pan tracking is started or. More... | |
TBWidget * | GetTarget () const |
Get the widget that will be panned/scrolled. More... | |
bool | OnPan (int dx, int dy) |
Pan the target widget (or any parent) with the given deltas. More... | |
void | OnPanReleased () |
The panning ends and the scroller should start scrolling. More... | |
void | OnScrollBy (int dx, int dy, bool accumulative) |
Start the scroller based on the given delta. More... | |
TBScroller handles panning while the pointer is down and measure the pan speed over time.
It also handles continued scrolling when the pointer has been released with a flick.
|
inline |
Get the widget that will be panned/scrolled.
Any parent of this widget may also be panned/scrolled.
|
inline |
Return true if the pan tracking is started or.
bool tb::TBScroller::OnPan | ( | int | dx, |
int | dy | ||
) |
Pan the target widget (or any parent) with the given deltas.
Should be called while the pointer is down. This will track the pan speed over time.
void tb::TBScroller::OnPanReleased | ( | ) |
The panning ends and the scroller should start scrolling.
Should be called when the pointer is released.
void tb::TBScroller::OnScrollBy | ( | int | dx, |
int | dy, | ||
bool | accumulative | ||
) |
Start the scroller based on the given delta.
Doesn't require previous calls to OnPan or OnPanReleased.
If accumulative is true, the given delta will be added to any on going scroll. If it's false, any ongoing scroll will be canceled.
|
inline |
Set the listener that may override the target scroll position.
void tb::TBScroller::Start | ( | ) |
Start tracking pan movement from calls to OnPan.
void tb::TBScroller::Stop | ( | ) |
Stop tracking pan movement from calls to OnPan, or stop any ongoing scrolling.