ImagesWidget.h 730 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // This may look like C code, but it's really -*- C++ -*-
  2. /*
  3. * Copyright (C) 2011 Emweb bvba, Heverlee, Belgium
  4. *
  5. * See the LICENSE file for terms of use.
  6. */
  7. #ifndef IMAGES_WIDGET_H_
  8. #define IMAGES_WIDGET_H_
  9. #include <vector>
  10. #include <Wt/WContainerWidget>
  11. class ImagesWidget : public Wt::WContainerWidget
  12. {
  13. public:
  14. static const int HURRAY;
  15. ImagesWidget(int maxGuesses, Wt::WContainerWidget *parent = 0);
  16. /*
  17. * 0 - maxGuesses: corresponds to 0 up to maxGuesses guesses
  18. * HURRAY: when won
  19. */
  20. void showImage(int index);
  21. int currentImage() const { return image_; }
  22. private:
  23. std::vector<Wt::WImage *> images_;
  24. int image_;
  25. Wt::WImage *image(int index) const;
  26. };
  27. #endif // IMAGES_WIDGET_H_