Wt examples  3.3.0
LettersWidget.C
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Emweb bvba, Heverlee, Belgium
3  *
4  * See the LICENSE file for terms of use.
5  */
6 
7 #include "LettersWidget.h"
8 
9 #include <Wt/WPushButton>
10 #include <Wt/WTable>
11 
12 using namespace Wt;
13 
15  : WCompositeWidget(parent)
16 {
17  setImplementation(impl_ = new WTable());
18 
19  impl_->resize(13*30, WLength::Auto);
20 
21  for (unsigned int i = 0; i < 26; ++i) {
22  std::string c(1, 'A' + i);
23  WPushButton *character = new WPushButton(c,
24  impl_->elementAt(i / 13, i % 13));
25  letterButtons_.push_back(character);
26  character->resize(WLength(30), WLength::Auto);
27 
28  character->clicked().connect
29  (boost::bind(&LettersWidget::processButton, this, character));
30  }
31 }
32 
34 {
35  b->disable();
36  letterPushed_.emit(b->text().toUTF8()[0]);
37 }
38 
40 {
41  for (unsigned int i = 0; i < letterButtons_.size(); ++i)
42  letterButtons_[i]->enable();
43 
44  show();
45 }

Generated on Fri May 31 2013 for the C++ Web Toolkit (Wt) by doxygen 1.8.3.1