|
Wt examples
3.3.5
|
#include <ImagesWidget.h>
Public Member Functions | |
| ImagesWidget (int maxGuesses, Wt::WContainerWidget *parent=0) | |
| void | showImage (int index) |
| int | currentImage () const |
Static Public Attributes | |
| static const int | HURRAY = -1 |
Private Member Functions | |
| Wt::WImage * | image (int index) const |
Private Attributes | |
| std::vector< Wt::WImage * > | images_ |
| int | image_ |
Definition at line 15 of file ImagesWidget.h.
| ImagesWidget::ImagesWidget | ( | int | maxGuesses, |
| Wt::WContainerWidget * | parent = 0 |
||
| ) |
Definition at line 15 of file ImagesWidget.C.
: WContainerWidget(parent)
{
for (int i = 0; i <= maxGuesses; ++i) {
std::string fname = "icons/hangman";
fname += boost::lexical_cast<std::string>(i) + ".jpg";
WImage *theImage = new WImage(fname, this);
images_.push_back(theImage);
// Although not necessary, we can avoid flicker (on konqueror)
// by presetting the image size.
theImage->resize(256, 256);
theImage->hide();
}
WImage *hurray = new WImage("icons/hangmanhurray.jpg", this);
hurray->hide();
images_.push_back(hurray);
image_ = 0;
showImage(maxGuesses);
}
| int ImagesWidget::currentImage | ( | ) | const [inline] |
Definition at line 27 of file ImagesWidget.h.
{ return image_; }
| WImage * ImagesWidget::image | ( | int | index | ) | const [private] |
Definition at line 45 of file ImagesWidget.C.
| void ImagesWidget::showImage | ( | int | index | ) |
const int ImagesWidget::HURRAY = -1 [static] |
Definition at line 18 of file ImagesWidget.h.
int ImagesWidget::image_ [private] |
Definition at line 31 of file ImagesWidget.h.
std::vector<Wt::WImage *> ImagesWidget::images_ [private] |
Definition at line 30 of file ImagesWidget.h.
1.7.6.1