ExampleSourceViewer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // This may look like C code, but it's really -*- C++ -*-
  2. /*
  3. * Copyright (C) 2009 Emweb bvba
  4. *
  5. * See the LICENSE file for terms of use.
  6. */
  7. #include <iostream>
  8. #include <stdlib.h>
  9. #include <Wt/WContainerWidget>
  10. #include <Wt/WTreeView>
  11. #include <Wt/WStandardItemModel>
  12. #include "FileItem.h"
  13. #include "SourceView.h"
  14. /*! \class ExampleSourceViewer
  15. * \brief A simple widget to visualise a set of example source files.
  16. */
  17. class ExampleSourceViewer: public Wt::WContainerWidget
  18. {
  19. public:
  20. /*! \brief Constructor.
  21. */
  22. ExampleSourceViewer(const std::string& deployPath,
  23. const std::string& examplesRoot,
  24. const std::string& examplesType);
  25. private:
  26. Wt::WTreeView *exampleView_;
  27. SourceView *sourceView_;
  28. std::string deployPath_;
  29. std::string examplesRoot_;
  30. std::string examplesType_;
  31. Wt::WStandardItemModel *model_;
  32. void cppTraverseDir(Wt::WStandardItem* parent,
  33. const boost::filesystem::path& path);
  34. void javaTraverseDir(Wt::WStandardItem* parent,
  35. const boost::filesystem::path& path);
  36. void javaTraversePackages(Wt::WStandardItem *parent,
  37. const boost::filesystem::path& srcPath,
  38. const std::string packageName);
  39. /*! \brief Displayed the currently selected file.
  40. */
  41. void showFile();
  42. void handlePathChange();
  43. void setExample(const std::string& exampleDir,
  44. const std::string& example);
  45. };