Wt examples
3.2.0
|
#include <WtHome.h>
Public Member Functions | |
WtHome (const WEnvironment &env) | |
Protected Member Functions | |
virtual WWidget * | examples () |
virtual WWidget * | createQuoteForm () |
virtual WWidget * | sourceViewer (const std::string &internalPath) |
virtual std::string | filePrefix () const |
Private Member Functions | |
WWidget * | example (const char *textKey, const std::string &sourceDir) |
WWidget * | helloWorldExample () |
WWidget * | chartExample () |
WWidget * | homepageExample () |
WWidget * | treeviewExample () |
WWidget * | gitExample () |
WWidget * | chatExample () |
WWidget * | composerExample () |
WWidget * | widgetGalleryExample () |
WWidget * | hangmanExample () |
WWidget * | wrapView (WWidget *(WtHome::*createFunction)()) |
Private Attributes | |
std::string | wtExamplePath_ |
WtHome::WtHome | ( | const WEnvironment & | env | ) |
Definition at line 27 of file WtHome.C.
: Home(env, "Wt, C++ Web Toolkit", "wt-home", "css/wt") { addLanguage(Lang("en", "/", "en", "English")); addLanguage(Lang("cn", "/cn/", "汉语", "中文 (Chinese)")); addLanguage(Lang("ru", "/ru/", "ру", "Русский (Russian)")); char* wtExamplePath = getenv("WT_EXAMPLE_PATH"); if (wtExamplePath) wtExamplePath_ = wtExamplePath; else wtExamplePath_ = "../"; init(); }
WWidget * WtHome::chartExample | ( | ) | [private] |
WWidget * WtHome::chatExample | ( | ) | [private] |
WWidget * WtHome::composerExample | ( | ) | [private] |
WWidget * WtHome::createQuoteForm | ( | ) | [protected, virtual] |
WWidget * WtHome::example | ( | const char * | textKey, |
const std::string & | sourceDir | ||
) | [private] |
Definition at line 43 of file WtHome.C.
{ WContainerWidget *result = new WContainerWidget(); WText *w = new WText(tr(textKey), result); w->setInternalPathEncoding(true); result->addWidget(linkSourceBrowser(sourceDir)); return result; }
WWidget * WtHome::examples | ( | ) | [protected, virtual] |
Implements Home.
Definition at line 97 of file WtHome.C.
{ WContainerWidget *result = new WContainerWidget(); WText *intro = new WText(tr("home.examples")); intro->setInternalPathEncoding(true); result->addWidget(intro); examplesMenu_ = new WTabWidget(AlignTop | AlignJustify, result); WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn); examplesMenu_->contentsStack()->setTransitionAnimation(animation, true); /* * The following code is functionally equivalent to: * * examplesMenu_->addTab(helloWorldExample(), "Hello world"); * * However, we optimize here for memory consumption (it is a homepage * after all, and we hope to be slashdotted some day) * * Therefore, we wrap all the static content (including the tree * widgets), into WViewWidgets with static models. In this way the * widgets are not actually stored in memory on the server. */ // The call ->setPathComponent() is to use "/examples/" instead of // "/examples/hello_world" as internal path examplesMenu_->addTab(wrapView(&WtHome::helloWorldExample), tr("hello-world"))->setPathComponent(""); examplesMenu_->addTab(wrapView(&WtHome::chartExample), tr("charts")); examplesMenu_->addTab(wrapView(&WtHome::homepageExample), tr("wt-homepage")); examplesMenu_->addTab(wrapView(&WtHome::treeviewExample), tr("treeview")); examplesMenu_->addTab(wrapView(&WtHome::gitExample), tr("git")); examplesMenu_->addTab(wrapView(&WtHome::chatExample), tr("chat")); examplesMenu_->addTab(wrapView(&WtHome::composerExample), tr("mail-composer")); examplesMenu_->addTab(wrapView(&WtHome::hangmanExample), tr("hangman")); examplesMenu_->addTab(wrapView(&WtHome::widgetGalleryExample), tr("widget-gallery")); // Enable internal paths for the example menu examplesMenu_->setInternalPathEnabled("/examples"); examplesMenu_->currentChanged().connect(this, &Home::googleAnalyticsLogger); return result; }
virtual std::string WtHome::filePrefix | ( | ) | const [inline, protected, virtual] |
WWidget * WtHome::gitExample | ( | ) | [private] |
WWidget * WtHome::hangmanExample | ( | ) | [private] |
WWidget * WtHome::helloWorldExample | ( | ) | [private] |
WWidget * WtHome::homepageExample | ( | ) | [private] |
WWidget * WtHome::sourceViewer | ( | const std::string & | internalPath | ) | [protected, virtual] |
Implements Home.
Definition at line 160 of file WtHome.C.
{ return new ExampleSourceViewer(deployPath, wtExamplePath_ + "/", "CPP"); }
WWidget * WtHome::treeviewExample | ( | ) | [private] |
WWidget * WtHome::widgetGalleryExample | ( | ) | [private] |
Definition at line 165 of file WtHome.C.
{ return makeStaticModel(boost::bind(createWidget, this)); }
std::string WtHome::wtExamplePath_ [private] |