Wt examples  4.12.0
FileTreeTable.C
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 
8 #include "FileTreeTable.h"
9 #include "FileTreeTableNode.h"
10 
11 #include <Wt/WText.h>
12 
13 #include <Wt/cpp17/filesystem.hpp>
14 
15 using namespace Wt;
16 
17 FileTreeTable::FileTreeTable(const cpp17::filesystem::path& path)
18  : WTreeTable()
19 {
20  addColumn("Size", 80);
21  addColumn("Modified", 110);
22 
23  header(1)->setStyleClass("fsize");
24  header(2)->setStyleClass("date");
25 
26  auto tableNode
27  = std::make_unique<FileTreeTableNode>(path);
28  setTreeRoot(std::move(tableNode), "File");
29 
30  //treeRoot()->setImagePack("icons/");
31  treeRoot()->expand();
32 }
FileTreeTable(const Wt::cpp17::filesystem::path &path)
Construct a new FileTreeTable.
Definition: FileTreeTable.C:17
void addColumn(const WString &header, const WLength &width)
WTreeTableNode * treeRoot()
WText * header(int column) const
void setTreeRoot(std::unique_ptr< WTreeTableNode > root, const WString &header)
virtual void setStyleClass(const WString &styleClass) override