Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

WtHome Class Reference

#include <WtHome.h>

Inheritance diagram for WtHome:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WtHome (const WEnvironment &env)

Protected Member Functions

virtual WWidgetexamples ()
virtual WWidgetdownload ()
virtual WWidgetsourceViewer (const std::string &internalPath)
virtual std::string filePrefix () const

Private Member Functions

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

Private Attributes

std::string wtExamplePath_

Detailed Description

Definition at line 16 of file WtHome.h.


Constructor & Destructor Documentation

WtHome::WtHome ( const WEnvironment env )

Definition at line 22 of file WtHome.C.

  : Home(env, "Wt, C++ Web Toolkit", "wt-home", "css/wt")
{
  addLanguage(Lang("en", "/", "en", "English"));
  addLanguage(Lang("cn", "/cn/", "汉语", "中文 (Chinese)"));

  char* wtExamplePath  = getenv("WT_EXAMPLE_PATH");
  if (wtExamplePath)
    wtExamplePath_ = wtExamplePath;
  else
    wtExamplePath_ = "../";

  init();
}

Member Function Documentation

WWidget * WtHome::chartExample (  ) [private]

Definition at line 50 of file WtHome.C.

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

Definition at line 70 of file WtHome.C.

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

Definition at line 75 of file WtHome.C.

{
  return example("home.examples.composer", "composer");
}
WWidget * WtHome::download (  ) [protected, virtual]

Implements Home.

Definition at line 132 of file WtHome.C.

{
  WContainerWidget *result = new WContainerWidget();
  result->addWidget(new WText(tr("home.download")));
  result->addWidget(new WText(tr("home.download.license")));
  result->addWidget(new WText(tr("home.download.requirements")));
  result->addWidget(new WText(tr("home.download.cvs")));
  result->addWidget(new WText(tr("home.download.packages")));

  releases_ = new WTable();
  readReleases(releases_);
  result->addWidget(releases_);

  result->addWidget
    (new WText("<p>Older releases are still available at "
               + href("http://sourceforge.net/project/showfiles.php?"
                      "group_id=153710#files",
                      "sourceforge.net")
               + "</p>"));

  return result;
}
WWidget * WtHome::example ( const char *  textKey,
const std::string &  sourceDir 
) [private]

Definition at line 37 of file WtHome.C.

{
  WContainerWidget *result = new WContainerWidget();
  new WText(tr(textKey), result);
  result->addWidget(linkSourceBrowser(sourceDir));
  return result;
}
WWidget * WtHome::examples (  ) [protected, virtual]

Implements Home.

Definition at line 85 of file WtHome.C.

{
  WContainerWidget *result = new WContainerWidget();

  result->addWidget(new WText(tr("home.examples")));

  examplesMenu_ = new WTabWidget(AlignTop | AlignJustify, result);

  /*
   * 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::widgetGalleryExample),
                        tr("widget-gallery"));

  // Enable internal paths for the example menu
  examplesMenu_->setInternalPathEnabled("/examples");
  examplesMenu_->currentChanged().connect(SLOT(this, Home::googleAnalyticsLogger));

  return result;
}
virtual std::string WtHome::filePrefix (  ) const [inline, protected, virtual]

Implements Home.

Definition at line 25 of file WtHome.h.

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

Definition at line 65 of file WtHome.C.

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

Definition at line 45 of file WtHome.C.

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

Definition at line 55 of file WtHome.C.

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

Implements Home.

Definition at line 155 of file WtHome.C.

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

Definition at line 60 of file WtHome.C.

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

Definition at line 80 of file WtHome.C.

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

Definition at line 160 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 Dec 4 2010 06:32:32 for Wt by doxygen 1.7.2