Wt::WWidget* Tester::Result() { Wt::WContainerWidget* c = new Wt::WContainerWidget(); c->setStyleClass("result_container"); Wt::WText* t = new Wt::WText("Results", c); t->setStyleClass("area_title"); mResult = new Wt::WContainerWidget(c); mResult->setStyleClass("result_output"); return c; }
Tester::Tester(const Wt::WEnvironment& env) : Wt::WApplication(env) { setTheme(new Wt::WBootstrapTheme()); useStyleSheet("resources/lpeg_tester.css"); Wt::WContainerWidget* container = new Wt::WContainerWidget(); container->setStyleClass("page"); Wt::WVBoxLayout* vbox = new Wt::WVBoxLayout(); container->setLayout(vbox); vbox->addWidget(Title(), 1); Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout(); vbox->addLayout(hbox); hbox->addWidget(Input(), 1); hbox->addWidget(Result(), 1); root()->addWidget(container); HandleInternalPath(internalPath()); internalPathChanged().connect(this, &Tester::HandleInternalPath); }
Wt::WWidget* Tester::Input() { Wt::WContainerWidget* container = new Wt::WContainerWidget(); container->setStyleClass("input_container"); Wt::WText* t = new Wt::WText("Input", container); t->setStyleClass("area_title"); new Wt::WBreak(container); mInput = new Wt::WTextArea(container); mInput->setText("20131220T094700"); new Wt::WBreak(container); t = new Wt::WText("Grammar", container); t->setStyleClass("area_title"); new Wt::WBreak(container); mGrammar = new Wt::WTextArea(container); mGrammar->setRows(15); mGrammar->setText("local l = require 'lpeg'\nl.locale(l)\ngrammar = l.C(l.digit^-4)"); Wt::WPushButton* button = new Wt::WPushButton("Test Grammar", container); button->clicked().connect(this, &Tester::GrammarButton); button = new Wt::WPushButton("Benchmark Grammar", container); button->clicked().connect(this, &Tester::BenchmarkButton); button = new Wt::WPushButton("Share Grammar", container); button->clicked().connect(this, &Tester::ShareGrammar); return container; }
Wt::WContainerWidget *PopupChatWidget::createBar() { Wt::WContainerWidget *bar = new Wt::WContainerWidget(); bar->setStyleClass("chat-bar"); Wt::WText *toggleButton = new Wt::WText(); toggleButton->setInline(false); toggleButton->setStyleClass("chat-minmax"); bar->clicked().connect(this, &PopupChatWidget::toggleSize); bar->clicked().connect(this, &PopupChatWidget::goOnline); bar->addWidget(toggleButton); title_ = new Wt::WText(bar); bar_ = bar; return bar; }