Wt examples  4.9.2
Loading...
Searching...
No Matches
FileTreeExample.C
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008 Emweb bv, Herent, Belgium.
3 *
4 * See the LICENSE file for terms of use.
5 */
6
7#include <Wt/WApplication.h>
8#include <Wt/WContainerWidget.h>
9#include <Wt/WTree.h>
10#include <Wt/WTreeTableNode.h>
11
12#include "FileTreeTable.h"
13
14using namespace Wt;
15
16std::unique_ptr<WApplication> createApplication(const WEnvironment& env)
17{
18 auto app = std::make_unique<WApplication>(env);
19 app->setTitle("File explorer example");
20 app->useStyleSheet("filetree.css");
21
22 std::unique_ptr<FileTreeTable> treeTable
23 = std::make_unique<FileTreeTable>(".");
24 treeTable->resize(500, 300);
25 treeTable->tree()->setSelectionMode(SelectionMode::Extended);
26 treeTable->treeRoot()->setNodeVisible(false);
27 treeTable->treeRoot()->setChildCountPolicy(ChildCountPolicy::Enabled);
28
29 app->root()->addWidget(std::move(treeTable));
30
31 return app;
32}
33
34int main(int argc, char **argv)
35{
36 return WRun(argc, argv, &createApplication);
37}
38
int main(int argc, char **argv)
std::unique_ptr< WApplication > createApplication(const WEnvironment &env)