Carousel is only used within TouchGFX.
 
Symbols
loading...
Files
loading...

Carousel class

@class Carousel This widget is part of the TouchGFX Open Repository. https://github.com/draupnergraphics/touchgfx-open-repository Carousel for visually navigating through a set of graphical elements. The current implementation displays five elements at a time. The carousel has one invisible element before and one after the visible elements. These are used when fading out the visible end elements. The visible elements are there for indexed from 1-5 and the invisible 0 and 6. The implementation can easily be extended to hold more visible elements. To set up the carousel call setPositionOfCarouselElement for all the elements including the end invisible elements. With this method you specify the position and sizes of the images in the carousel. The carousel will animate the elements between these position and sizes. You can add more elements than there are visible carousel elements. See MAX_NUMBER_OF_ELEMENTS. For performance reasons the elements uses an ExtendedZoomAnimationImage that holds three sizes of the images of the elements. So you have to supply each element in the carousel with three bitmaps of the element. One for each size of the visible elements. Use addElement(...) for this. @sa Container

Syntax

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(); };

Fields

zoomAnimationCallback

No summary provided. Read more...

NUMBER_OF_VISIBLE_ELEMENTS

No summary provided. Read more...

MAX_NUMBER_OF_ELEMENTS

No summary provided. Read more...

currentAnimation

No summary provided. Read more...

carouselAnimationDuration

No summary provided. Read more...

visibleElements

No summary provided. Read more...

visibleElementPositions

No summary provided. Read more...

elements

No summary provided. Read more...

currentNumberOfElements

No summary provided. Read more...

selectedElement

No summary provided. Read more...

carouselAnimationEndedAction

No summary provided. Read more...

Methods

handleZoomAnimationEvent()

@fn virtual void Carousel::handleZoomAnimationEvent(const ZoomAnimationImage& element); Handles the zoom animation event described by element. Read more...

updateVisibleElements()

@fn virtual void Carousel::updateVisibleElements(); Reset the elements after an animation has ended. Set the elements back to their original position with the new image for that position. Read more...

setPositionOfCarouselElement()

@fn virtual void Carousel::setPositionOfCarouselElement(uint8_t index, int16_t x, int16_t y, uint16_t width, uint16_t height); Setup a carousel graphical element. This is what defines the position and sizes of all the graphical elements in the carousel, so must be called for all visible elements and the two invisible end elements in the carousel. Read more...

addElement()

@fn virtual void Carousel::addElement(const Bitmap& smallBitmap, const Bitmap& mediumBitmap, const Bitmap& largeBitmap); Add an element to the carousel. Read more...

setDuration()

@fn virtual void Carousel::setDuration(uint16_t duration); Set the durations of the carousel animations. Read more...

getSelectedElement()

@fn virtual ExtendedZoomAnimationImage* Carousel::getSelectedElement() const Gets selected element. Read more...

getSelectedElementIndex() const

@fn virtual uint8_t Carousel::getSelectedElementIndex() const Gets selected element index. Read more...

getSelectedElementBitmaps() const

@fn virtual Bitmaps Carousel::getSelectedElementBitmaps() const Gets selected element bitmaps. Read more...

getXPositionOfVisibleElement()

@fn virtual int16_t Carousel::getXPositionOfVisibleElement(uint8_t index); Get x coordinate position of visible element. Read more...

getYPositionOfVisibleElement()

@fn virtual int16_t Carousel::getYPositionOfVisibleElement(uint8_t index); Get y coordinate position of visible element. Read more...

setSelectedElement()

@fn virtual void Carousel::setSelectedElement(uint8_t index); Set the selected element. Read more...

selectedNext()

@fn virtual void Carousel::selectedNext(); Animates the carousel to the left. Changing the selected element accordingly. Read more...

selectedPrevious()

@fn virtual void Carousel::selectedPrevious(); Animates the carousel to the right. Changing the selected element accordingly. Read more...

highlightSelectedElement()

@fn virtual void Carousel::highlightSelectedElement(); Fade out all elements except the selected one. Read more...

cancelHighlightOfSelectedElement()

@fn virtual void Carousel::cancelHighlightOfSelectedElement(); Fade in all hidden elements. Read more...

setCarouselAnimationEndedCallback()

@fn void Carousel::setCarouselAnimationEndedCallback(touchgfx::GenericCallback& callback) Associates an action to be performed when an animation ends. @see GenericCallback. Read more...

setHighlightedNoAnimation()

@fn void Carousel::setHighlightedNoAnimation(); Sets highlighted with no animation or callback. Method not part of the carousel from the TouchGFX Open Widget Repository. Read more...

prevElement()

@fn virtual uint8_t Carousel::prevElement(uint8_t index); Gets the previous element index. Read more...

nextElement()

@fn virtual uint8_t Carousel::nextElement(uint8_t index); Gets the next element index. Read more...

References

LocationReferrerScopeText
Carousel.hpp:50
class Carousel : public Container
Carousel.cpp:21Carousel::Carousel()
Carousel::Carousel() :
Carousel.cpp:42Carousel::~Carousel()
Carousel::~Carousel()
Carousel.cpp:47Carousel::setHighlightedNoAnimation()
void Carousel::setHighlightedNoAnimation()
Carousel.cpp:58Carousel::setPositionOfCarouselElement()
void Carousel::setPositionOfCarouselElement(uint8_t index, int16_t x, int16_t y, uint16_t width, uint16_t height)
Carousel.cpp:70Carousel::getXPositionOfVisibleElement()
int16_t Carousel::getXPositionOfVisibleElement(uint8_t index)
Carousel.cpp:77Carousel::getYPositionOfVisibleElement()
int16_t Carousel::getYPositionOfVisibleElement(uint8_t index)
Carousel.cpp:84Carousel::addElement()
void Carousel::addElement(const Bitmap& smallBitmap, const Bitmap& mediumBitmap, const Bitmap& largeBitmap)
Carousel.cpp:92Carousel::setDuration()
void Carousel::setDuration(uint16_t duration)
Carousel.cpp:97Carousel::setSelectedElement()
void Carousel::setSelectedElement(uint8_t index)
Carousel.cpp:103Carousel::selectedNext()
void Carousel::selectedNext()
Carousel.cpp:126Carousel::selectedPrevious()
void Carousel::selectedPrevious()
Carousel.cpp:150Carousel::highlightSelectedElement()
void Carousel::highlightSelectedElement()
Carousel.cpp:167Carousel::cancelHighlightOfSelectedElement()
Carousel.cpp:184Carousel::prevElement()
uint8_t Carousel::prevElement(uint8_t index)
Carousel.cpp:189Carousel::nextElement()
uint8_t Carousel::nextElement(uint8_t index)
Carousel.cpp:194Carousel::handleZoomAnimationEvent()
Carousel.cpp:224Carousel::updateVisibleElements()
void Carousel::updateVisibleElements()
MainMenuCarouselView.cpp:225MainMenuCarouselView::carouselAnimationEndedhandler()
MainMenuCarouselView.hpp:52MainMenuCarouselView::carouselMainMenuCarouselView
Carousel carousel;
MainMenuCarouselView.hpp:66MainMenuCarouselView::carouselAnimationEndedhandler()::cMainMenuCarouselView::carouselAnimationEndedhandler()
void carouselAnimationEndedhandler(const Carousel& c);

Class Tree

Child classes
Carousel
all items filtered out