WordWidget.h 654 B

123456789101112131415161718192021222324252627282930313233
  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 WORD_WIDGET_H_
  8. #define WORD_WIDGET_H_
  9. #include <Wt/WContainerWidget>
  10. class WordWidget : public Wt::WContainerWidget
  11. {
  12. public:
  13. WordWidget(Wt::WContainerWidget *parent = 0);
  14. std::wstring word() const { return word_; }
  15. void init(const std::wstring &word);
  16. bool guess(wchar_t c);
  17. bool won();
  18. private:
  19. std::vector<Wt::WText *> wordLetters_;
  20. std::wstring word_;
  21. unsigned displayedLetters_;
  22. };
  23. #endif //WORD_WIDGET_H_