FileTreeTableNode.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This may look like C code, but it's really -*- C++ -*-
  2. /*
  3. * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
  4. *
  5. * See the LICENSE file for terms of use.
  6. */
  7. #ifndef FILETREETABLENODE_H_
  8. #define FILETREETABLENODE_H_
  9. #include <Wt/WTreeTableNode>
  10. #include <boost/filesystem/path.hpp>
  11. /**
  12. * @addtogroup fileexplorer
  13. */
  14. /*@{*/
  15. /*! \brief A single node in a file tree table.
  16. *
  17. * The node manages the details about one file, and if the file is a
  18. * directory, populates a subtree with nodes for every directory item.
  19. *
  20. * The tree node reimplements Wt::WTreeTableNode::populate() to populate
  21. * a directory node only when the node is expanded. In this way, only
  22. * directories that are actually browsed are loaded from disk.
  23. */
  24. class FileTreeTableNode : public Wt::WTreeTableNode
  25. {
  26. public:
  27. /*! \brief Construct a new node for the given file.
  28. */
  29. FileTreeTableNode(const boost::filesystem::path& path);
  30. private:
  31. //! The path.
  32. boost::filesystem::path path_;
  33. //! Reimplements WTreeNode::populate to read files within a directory.
  34. virtual void populate();
  35. //! Reimplements WTreeNode::expandable
  36. virtual bool expandable();
  37. //! Create the iconpair for representing the path.
  38. static Wt::WIconPair *createIcon(const boost::filesystem::path& path);
  39. };
  40. /*@}*/
  41. #endif // FILETREETABLENODE_H_