Wt examples: ImagesWidget Class Reference

Wt examples 3.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
ImagesWidget Class Reference

`#include <ImagesWidget.h>`

Inheritance diagram for ImagesWidget:
[legend]

List of all members.

## 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_

## Detailed Description

Definition at line 15 of file ImagesWidget.h.

## Constructor & Destructor Documentation

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

## Member Function Documentation

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.

    {
      return index == HURRAY ? images_.back() : images_[index];
    }

void ImagesWidget::showImage | ( | int | index | ) |

Definition at line 38 of file ImagesWidget.C.

    {
      image(image_)->hide();
      image_ = index;
      image(image_)->show();
    }

## Member Data Documentation

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.

The documentation for this class was generated from the following files:

- /home/koen/project/wt/public-git/wt/examples/hangman/ImagesWidget.h
- /home/koen/project/wt/public-git/wt/examples/hangman/ImagesWidget.C