class SwipeContainer : public touchgfx::Container
{
public:
SwipeContainer();
virtual ~SwipeContainer();
virtual void handleTickEvent();
virtual void handleClickEvent(const touchgfx::ClickEvent& evt);
virtual void handleDragEvent(const touchgfx::DragEvent& evt);
virtual void handleGestureEvent(const touchgfx::GestureEvent& evt);
virtual void add(touchgfx::Drawable& screen);
virtual void setSwipeCutoff(uint16_t cutoff);
void setDotIndicatorXY(uint16_t x, uint16_t y);
void setDotIndicatorXYWithCenteredX(uint16_t x, uint16_t y);
void setDotIndicatorBitmaps(const touchgfx::Bitmap& normalDot, const touchgfx::Bitmap& highlightedDot);
void setEndSwipeElasticWidth(uint16_t width);
uint8_t getNumberOfScreens() { return numberOfScreens; }
void setSelectedScreen(uint8_t screenIndex);
uint8_t getSelectedScreen() { return currentScreen; }
private:
enum States
{
ANIMATE_SWIPE_CANCELLED_LEFT,
ANIMATE_SWIPE_CANCELLED_RIGHT,
ANIMATE_LEFT,
ANIMATE_RIGHT,
NO_ANIMATION
} currentState;
uint8_t numberOfScreens;
uint8_t animationCounter;
uint16_t swipeCutoff;
int16_t dragX;
int16_t animateDistance;
int16_t startX;
uint8_t currentScreen;
uint16_t endElasticWidth;
DotIndicator dotIndicator;
touchgfx::ListLayout screens;
void adjustScreens();
void animateSwipeCancelledLeft();
void animateSwipeCancelledRight();
void animateLeft();
void animateRight();
};