Wt examples  3.2.1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
WtHome Class Reference

#include <WtHome.h>

Inheritance diagram for WtHome:
Inheritance graph
[legend]

Public Member Functions

 WtHome (const WEnvironment &env)
- Public Member Functions inherited from Home
 Home (const WEnvironment &env, const std::string &title, const std::string &resourceBundle, const std::string &cssPath)
virtual ~Home ()
void googleAnalyticsLogger ()
- Public Member Functions inherited from Wt::WApplication
 WApplication (const WEnvironment &environment)
 ~WApplication ()
const WEnvironmentenvironment () const
WContainerWidgetroot () const
WWidgetfindWidget (const std::string &name)
void setTitle (const WString &title)
const WStringtitle () const
const WStringcloseMessage () const
WLocalizedStringslocalizedStrings ()
void setLocalizedStrings (WLocalizedStrings *stringResolver)
WMessageResourceBundlemessageResourceBundle ()
void setLocale (const std::string &locale)
std::string locale () const
virtual void refresh ()
void bindWidget (WWidget *widget, const std::string &domId)
std::string docRoot () const
std::string sessionId () const
void changeSessionId ()
void processEvents ()
void setAjaxMethod (AjaxMethod method)
AjaxMethod ajaxMethod () const
virtual void initialize ()
virtual void finalize ()
void setTwoPhaseRenderingThreshold (int size)
void setCookie (const std::string &name, const std::string &value, int maxAge, const std::string &domain="", const std::string &path="", bool secure=false)
void addMetaLink (const std::string &href, const std::string &rel, const std::string &media, const std::string &hreflang, const std::string &type, const std::string &sizes, bool disabled)
void removeMetaLink (const std::string &href)
void addMetaHeader (const std::string &name, const WString &content, const std::string &lang="")
void addMetaHeader (MetaHeaderType type, const std::string &name, const WString &content, const std::string &lang="")
void removeMetaHeader (MetaHeaderType type, const std::string &name="")
WLogEntry log (const std::string &type) const
void setLoadingIndicator (WLoadingIndicator *indicator)
WLoadingIndicatorloadingIndicator () const
void quit ()
bool isQuited () const
::int64_t maximumRequestSize () const
Signal< ::int64_t > & requestTooLarge ()
void setConfirmCloseMessage (const WString &message)
void deferRendering ()
void resumeRendering ()
boost::function< void()> bind (const F &f)
WCssStyleSheetstyleSheet ()
void useStyleSheet (const std::string &url)
void useStyleSheet (const std::string &url, const std::string &condition, const std::string &media="all")
void setCssTheme (const std::string &theme)
std::string cssTheme () const
void setLayoutDirection (LayoutDirection direction)
LayoutDirection layoutDirection () const
void setBodyClass (const std::string &styleClass)
std::string bodyClass () const
void setHtmlClass (const std::string &styleClass)
std::string htmlClass () const
std::string url (const std::string &internalPath=std::string()) const
virtual std::string makeAbsoluteUrl (const std::string &url) const
std::string resolveRelativeUrl (const std::string &url) const
std::string bookmarkUrl () const
std::string bookmarkUrl (const std::string &internalPath) const
void setInternalPath (const std::string &path, bool emitChange=false)
std::string internalPath () const
std::string internalPathNextPart (const std::string &path) const
std::string internalSubPath (const std::string &path) const
bool internalPathMatches (const std::string &path) const
Signal< std::string > & internalPathChanged ()
void redirect (const std::string &url)
void enableUpdates (bool enabled=true)
bool updatesEnabled () const
void triggerUpdate ()
UpdateLock getUpdateLock ()
void attachThread (bool attach=true)
void doJavaScript (const std::string &javascript, bool afterLoaded=true)
void addAutoJavaScript (const std::string &javascript)
void declareJavaScriptFunction (const std::string &name, const std::string &function)
bool require (const std::string &url, const std::string &symbol=std::string())
void setJavaScriptClass (const std::string &className)
std::string javaScriptClass ()
EventSignal< WKeyEvent > & globalKeyWentDown ()
EventSignal< WKeyEvent > & globalKeyPressed ()
EventSignal< WKeyEvent > & globalKeyWentUp ()
EventSignalglobalEnterPressed ()
EventSignalglobalEscapePressed ()
 WObject (WObject *parent=0)
virtual ~WObject ()
virtual const std::string id () const
void setObjectName (const std::string &name)
virtual std::string objectName () const
void resetLearnedSlots ()
void resetLearnedSlot (void(T::*method)())
WStatelessSlot * implementStateless (void(T::*method)())
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
void addChild (WObject *child)
virtual void removeChild (WObject *child)
const std::vector< WObject * > & children () const
WObjectparent () const

Protected Member Functions

virtual WWidgetexamples ()
virtual WWidgetcreateQuoteForm ()
virtual WWidgetsourceViewer (const std::string &internalPath)
virtual std::string filePrefix () const
- Protected Member Functions inherited from Home
void init ()
void addLanguage (const Lang &l)
WWidgetlinkSourceBrowser (const std::string &examplePath)
WString tr (const char *key)
std::string href (const std::string &url, const std::string &description)
void readReleases (WTable *releaseTable)
- Protected Member Functions inherited from Wt::WApplication
virtual void notify (const WEvent &e)
virtual bool isExposed (WWidget *w) const
virtual void enableAjax ()
virtual void unload ()
virtual WStatelessSlot * getStateless (Method method)

Private Member Functions

WWidgetexample (const char *textKey, const std::string &sourceDir)
WWidgethelloWorldExample ()
WWidgetchartExample ()
WWidgethomepageExample ()
WWidgettreeviewExample ()
WWidgetgitExample ()
WWidgetchatExample ()
WWidgetcomposerExample ()
WWidgetwidgetGalleryExample ()
WWidgethangmanExample ()
WWidgetwrapView (WWidget *(WtHome::*createFunction)())

Private Attributes

std::string wtExamplePath_

Additional Inherited Members

- Public Types inherited from Wt::WApplication
enum  AjaxMethod
typedef Wt::ApplicationCreator ApplicationCreator
typedef void(WObject::* Method )()
typedef boost::function
< WApplication *(const
WEnvironment &)> 
ApplicationCreator
- Static Public Member Functions inherited from Wt::WApplication
static WApplicationinstance ()
static std::string resourcesUrl ()
static std::string appRoot ()
static bool readConfigurationProperty (const std::string &name, std::string &value)
- Public Attributes inherited from Wt::WApplication
 XMLHttpRequest
 DynamicScriptTag
- Static Protected Member Functions inherited from Wt::WApplication
static WObjectsender ()
- Protected Attributes inherited from Home
WTabWidgetexamplesMenu_
WTablereleases_

Detailed Description

Definition at line 16 of file WtHome.h.

Constructor & Destructor Documentation

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();
}

Member Function Documentation

WWidget * WtHome::chartExample ( )
private

Definition at line 57 of file WtHome.C.

{
return example("home.examples.chart", "charts");
}
WWidget * WtHome::chatExample ( )
private

Definition at line 77 of file WtHome.C.

{
return example("home.examples.chat", "simplechat");
}
WWidget * WtHome::composerExample ( )
private

Definition at line 82 of file WtHome.C.

{
return example("home.examples.composer", "composer");
}
WWidget * WtHome::createQuoteForm ( )
protectedvirtual

Implements Home.

Definition at line 151 of file WtHome.C.

{
#ifdef WT_EMWEB_BUILD
return new QuoteForm(QuoteForm::Wt);
#else
return 0;
#endif
}
WWidget * WtHome::example ( const char *  textKey,
const std::string &  sourceDir 
)
private

Definition at line 43 of file WtHome.C.

{
WText *w = new WText(tr(textKey), result);
result->addWidget(linkSourceBrowser(sourceDir));
return result;
}
WWidget * WtHome::examples ( )
protectedvirtual

Implements Home.

Definition at line 97 of file WtHome.C.

{
WText *intro = new WText(tr("home.examples"));
result->addWidget(intro);
examplesMenu_ = new WTabWidget(AlignTop | AlignJustify, result);
WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn);
/*
* 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
tr("hello-world"))->setPathComponent("");
tr("charts"));
tr("wt-homepage"));
tr("treeview"));
tr("git"));
tr("chat"));
tr("mail-composer"));
tr("hangman"));
tr("widget-gallery"));
// Enable internal paths for the example menu
return result;
}
virtual std::string WtHome::filePrefix ( ) const
inlineprotectedvirtual

Implements Home.

Definition at line 25 of file WtHome.h.

{ return "wt-"; }
WWidget * WtHome::gitExample ( )
private

Definition at line 72 of file WtHome.C.

{
return example("home.examples.git", "gitmodel");
}
WWidget * WtHome::hangmanExample ( )
private

Definition at line 92 of file WtHome.C.

{
return example("home.examples.hangman", "hangman");
}
WWidget * WtHome::helloWorldExample ( )
private

Definition at line 52 of file WtHome.C.

{
return example("home.examples.hello", "hello");
}
WWidget * WtHome::homepageExample ( )
private

Definition at line 62 of file WtHome.C.

{
return example("home.examples.wt", "wt-homepage");
}
WWidget * WtHome::sourceViewer ( const std::string &  internalPath)
protectedvirtual

Implements Home.

Definition at line 160 of file WtHome.C.

{
return new ExampleSourceViewer(deployPath, wtExamplePath_ + "/", "CPP");
}
WWidget * WtHome::treeviewExample ( )
private

Definition at line 67 of file WtHome.C.

{
return example("home.examples.treeview", "treeview-dragdrop");
}
WWidget * WtHome::widgetGalleryExample ( )
private

Definition at line 87 of file WtHome.C.

{
return example("home.examples.widgetgallery", "widgetgallery");
}
WWidget * WtHome::wrapView ( WWidget *(WtHome::*)()  createFunction)
private

Definition at line 165 of file WtHome.C.

{
return makeStaticModel(boost::bind(createWidget, this));
}

Member Data Documentation

std::string WtHome::wtExamplePath_
private

Definition at line 28 of file WtHome.h.


The documentation for this class was generated from the following files:

Generated on Sat Oct 18 2014 for the C++ Web Toolkit (Wt) by doxygen 1.8.1.2