Wt examples: hangman/ImagesWidget.h Source File

Wt examples 4.10.4

Loading...
Searching...
No Matches
ImagesWidget.h
Go to the documentation of this file.
1// This may look like C code, but it's really -*- C++ -*-
2/*
3 * Copyright (C) 2011 Emweb bv, Herent, Belgium
4 *
5 * See the LICENSE file for terms of use.
6 */
7
8#ifndef IMAGES_WIDGET_H_
9#define IMAGES_WIDGET_H_
10
11#include <Wt/WContainerWidget.h>
12
13#include <vector>
14
15 class ImagesWidget : public Wt::WContainerWidget
16{
17public:
18 static const int HURRAY;
19
20 explicit ImagesWidget(int maxGuesses);
21
22 /*
23 * 0 - maxGuesses: corresponds to 0 up to maxGuesses guesses
24 * HURRAY: when won
25 */
26 void showImage(int index);
27 int currentImage() const { return image_; }
28
29private:
30 std::vector<Wt::WImage*> images_;
31 int image_;
32
33 Wt::WImage *image(int index) const;
34};
35
36#endif // IMAGES_WIDGET_H_
ImagesWidget
Definition ImagesWidget.h:16
ImagesWidget::currentImage
int currentImage() const
Definition ImagesWidget.h:27
ImagesWidget::image
Wt::WImage * image(int index) const
Definition ImagesWidget.C:43
ImagesWidget::showImage
void showImage(int index)
Definition ImagesWidget.C:36
ImagesWidget::HURRAY
static const int HURRAY
Definition ImagesWidget.h:18
ImagesWidget::image_
int image_
Definition ImagesWidget.h:31
ImagesWidget::images_
std::vector< Wt::WImage * > images_
Definition ImagesWidget.h:30
ImagesWidget::ImagesWidget
ImagesWidget(int maxGuesses)
Definition ImagesWidget.C:14