10 #include "QuoteForm.h" 11 #endif // WT_EMWEB_BUILD 13 #include <Wt/WAnchor.h> 14 #include <Wt/WEnvironment.h> 15 #include <Wt/WLogger.h> 16 #include <Wt/WMenuItem.h> 17 #include <Wt/WStackedWidget.h> 18 #include <Wt/WTable.h> 19 #include <Wt/WTabWidget.h> 21 #include <Wt/WTreeNode.h> 22 #include <Wt/WViewWidget.h> 23 #include <Wt/WWidget.h> 30 :
Home(env, blogDb,
"Wt, C++ Web Toolkit",
"wt-home",
"css/wt")
36 char* wtExamplePath = getenv(
"WT_EXAMPLE_PATH");
45 std::unique_ptr<WWidget>
WtHome::example(
const char *textKey,
const std::string& sourceDir)
47 auto result = cpp14::make_unique<WContainerWidget>();
48 WText *w = result->addWidget(cpp14::make_unique<WText>(
tr(textKey)));
51 return std::move(result);
56 return example(
"home.examples.hello",
"hello");
61 return example(
"home.examples.chart",
"charts");
66 return example(
"home.examples.wt",
"wt-homepage");
71 return example(
"home.examples.treeview",
"treeview-dragdrop");
76 return example(
"home.examples.git",
"gitmodel");
81 return example(
"home.examples.chat",
"simplechat");
86 return example(
"home.examples.composer",
"composer");
91 return example(
"home.examples.widgetgallery",
"widgetgallery");
96 return example(
"home.examples.hangman",
"hangman");
101 auto result = cpp14::make_unique<WContainerWidget>();
103 auto intro = cpp14::make_unique<WText>(
tr(
"home.examples"));
104 intro->setInternalPathEncoding(
true);
105 result->addWidget(std::move(intro));
107 examplesMenu_ = result->addWidget(cpp14::make_unique<WTabWidget>());
109 WAnimation animation(AnimationEffect::SlideInFromRight, TimingFunction::EaseIn);
130 tr(
"widget-gallery"));
142 tr(
"mail-composer"));
150 return std::move(result);
155 #ifdef WT_EMWEB_BUILD 156 return cpp14::make_unique<QuoteForm>(QuoteForm::Wt);
164 return cpp14::make_unique<ExampleSourceViewer>(deployPath,
wtExamplePath_ +
"/",
"CPP");
169 return makeStaticModel(std::bind(createWidget,
this));
175 return cpp14::make_unique<WtHome>(env, *blogDb);
WtHome(const WEnvironment &env, Dbo::SqlConnectionPool &blogDb)
virtual std::unique_ptr< WWidget > createQuoteForm() override
std::unique_ptr< WWidget > chatExample()
std::unique_ptr< WWidget > helloWorldExample()
std::unique_ptr< WWidget > gitExample()
std::unique_ptr< WWidget > linkSourceBrowser(const std::string &examplePath)
std::unique_ptr< WWidget > widgetGalleryExample()
virtual std::unique_ptr< WWidget > sourceViewer(const std::string &internalPath) override
virtual std::unique_ptr< WWidget > examples() override
std::unique_ptr< WWidget > wrapView(std::unique_ptr< WWidget >(WtHome::*createFunction)())
WString tr(const char *key)
std::unique_ptr< WWidget > example(const char *textKey, const std::string &sourceDir)
std::unique_ptr< WWidget > chartExample()
void setInternalPathEncoding(bool enabled)
WTabWidget * examplesMenu_
std::unique_ptr< WWidget > composerExample()
std::unique_ptr< WWidget > treeviewExample()
std::unique_ptr< Wt::WApplication > createWidget(const Wt::WEnvironment &env, SimpleChatServer &server)
std::string wtExamplePath_
std::unique_ptr< WApplication > createWtHomeApplication(const WEnvironment &env, Dbo::SqlConnectionPool *blogDb)
void addLanguage(const Lang &l)
std::unique_ptr< WWidget > homepageExample()
virtual Wt::Signals::connection connect(WObject *target, WObject::Method method) override
std::unique_ptr< WWidget > hangmanExample()
void googleAnalyticsLogger()