Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBScroller Class Reference

TBScroller handles panning while the pointer is down and measure the pan speed over time. More...

#include <tb_scroller.h>

Inheritance diagram for tb::TBScroller:
tb::TBMessageHandler

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...
 
TBWidgetGetTarget () 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...
 

Detailed Description

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.

Member Function Documentation

TBWidget* tb::TBScroller::GetTarget ( ) const
inline

Get the widget that will be panned/scrolled.

Any parent of this widget may also be panned/scrolled.

bool tb::TBScroller::IsStarted ( ) const
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.

void tb::TBScroller::SetSnapListener ( TBScrollerSnapListener listener)
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.


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