00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium. 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 #ifndef HOME_H_ 00008 #define HOME_H_ 00009 00010 #include <Wt/WApplication> 00011 00012 namespace Wt { 00013 class WMenu; 00014 class WStackedWidget; 00015 class WTabWidget; 00016 class WTreeNode; 00017 class WTable; 00018 } 00019 00020 using namespace Wt; 00021 00022 class Home : public WApplication 00023 { 00024 public: 00025 Home(const WEnvironment& env); 00026 00027 void refresh(); 00028 00029 private: 00030 WStackedWidget *contents_; 00031 00032 WWidget *introduction(); 00033 WWidget *news(); 00034 WWidget *status(); 00035 WWidget *features(); 00036 WWidget *documentation(); 00037 WWidget *examples(); 00038 WWidget *download(); 00039 WWidget *community(); 00040 00041 WTable *recentNews_; 00042 WTable *historicalNews_; 00043 WTable *releases_; 00044 00045 WMenu *mainMenu_; 00046 WTabWidget *examplesMenu_; 00047 00048 int language_; 00049 00050 void readNews(WTable *newsTable, const std::string newsfile); 00051 void readReleases(WTable *releaseTable, const std::string releasefile); 00052 static std::string href(const std::string url, 00053 const std::string description); 00054 00055 WTreeNode *makeTreeMap(const std::string name, WTreeNode *parent); 00056 WTreeNode *makeTreeFile(const std::string name, WTreeNode *parent); 00057 00058 WWidget *helloWorldExample(); 00059 WWidget *chartExample(); 00060 WWidget *homepageExample(); 00061 WWidget *treelistExample(); 00062 WWidget *hangmanExample(); 00063 WWidget *styleExample(); 00064 WWidget *composerExample(); 00065 WWidget *dragdropExample(); 00066 WWidget *fileExplorerExample(); 00067 WWidget *calendarExample(); 00068 WWidget *chatExample(); 00069 00070 WWidget *wrapViewOrDefer(WWidget *(Home::*createFunction)()); 00071 00072 void updateTitle(); 00073 void logInternalPath(); 00074 void changeLanguage(int language); 00075 void setLanguage(int language); 00076 void setLanguageFromPath(std::string prefix); 00077 00078 static WString tr(const char *key); 00079 00080 WContainerWidget *sideBarContent_; 00081 }; 00082 00083 #endif // HOME_H_