from Carousel.hpp:50
class Carousel : public Container
{
public:
struct Bitmaps
{
Bitmap smallBmp;
Bitmap mediumBmp;
Bitmap largeBmp;
};
Carousel();
virtual ~Carousel();
virtual void setPositionOfCarouselElement(uint8_t index, int16_t x, int16_t y, uint16_t width, uint16_t height);
virtual void addElement(const Bitmap& smallBitmap, const Bitmap& mediumBitmap, const Bitmap& largeBitmap);
virtual void setDuration(uint16_t duration);
virtual ExtendedZoomAnimationImage* getSelectedElement() { return static_cast<ExtendedZoomAnimationImage*> (&(visibleElements[selectedElement])); }
virtual uint8_t getSelectedElementIndex() const { return selectedElement; }
virtual Bitmaps getSelectedElementBitmaps() const { return elements[selectedElement]; }
virtual int16_t getXPositionOfVisibleElement(uint8_t index);
virtual int16_t getYPositionOfVisibleElement(uint8_t index);
virtual void setSelectedElement(uint8_t index);
virtual void selectedNext();
virtual void selectedPrevious();
virtual void highlightSelectedElement();
virtual void cancelHighlightOfSelectedElement();
void setCarouselAnimationEndedCallback(touchgfx::GenericCallback<const Carousel&>& callback) { carouselAnimationEndedAction = &callback; }
void setHighlightedNoAnimation();
protected:
static const uint8_t NUMBER_OF_VISIBLE_ELEMENTS = 5 + 2;
static const uint8_t MAX_NUMBER_OF_ELEMENTS = 20;
enum Animation
{
ANIMATE_LEFT,
ANIMATE_RIGHT,
ANIMATE_ELEMENT_SELECTED,
NO_ANIMATION
};
Animation currentAnimation;
uint16_t carouselAnimationDuration;
FadeAnimator<ExtendedZoomAnimationImage> visibleElements[NUMBER_OF_VISIBLE_ELEMENTS];
Rect visibleElementPositions[NUMBER_OF_VISIBLE_ELEMENTS];
Bitmaps elements[MAX_NUMBER_OF_ELEMENTS];
uint8_t currentNumberOfElements;
uint8_t selectedElement;
virtual uint8_t prevElement(uint8_t index);
virtual uint8_t nextElement(uint8_t index);
touchgfx::GenericCallback<const Carousel&>* carouselAnimationEndedAction;
Callback<Carousel, const ZoomAnimationImage&> zoomAnimationCallback;
virtual void handleZoomAnimationEvent(const ZoomAnimationImage& element);
virtual void updateVisibleElements();
};