TreeViewExample.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 TREEVIEWEXAMPLE_H_
  8. #define TREEVIEWEXAMPLE_H_
  9. #include <Wt/WContainerWidget>
  10. #include <Wt/WString>
  11. #include <string>
  12. #include <vector>
  13. enum WeatherIcon {
  14. Sun,
  15. SunCloud,
  16. Cloud,
  17. Rain,
  18. Storm,
  19. Snow
  20. };
  21. namespace Wt {
  22. class WStandardItem;
  23. class WStandardItemModel;
  24. class WTreeView;
  25. class WText;
  26. }
  27. class TreeViewExample : public Wt::WContainerWidget
  28. {
  29. public:
  30. TreeViewExample(Wt::WStandardItemModel *model,
  31. const Wt::WString& titleText);
  32. Wt::WTreeView *treeView() const { return treeView_; }
  33. static Wt::WStandardItemModel *createModel(bool useInternalPath,
  34. WObject *parent);
  35. private:
  36. Wt::WStandardItem *belgium_;
  37. Wt::WStandardItemModel *model_;
  38. Wt::WTreeView *treeView_;
  39. static Wt::WStandardItem *continentItem(const std::string& continent);
  40. static Wt::WStandardItem *countryItem(const std::string& country,
  41. const std::string& code);
  42. static std::vector<Wt::WStandardItem *> cityItems(const std::string& city,
  43. WeatherIcon weather,
  44. const std::string& drink,
  45. bool useInternalPath,
  46. bool visited);
  47. void toggleRowHeight();
  48. void toggleStripes();
  49. void toggleRoot();
  50. void addRows();
  51. };
  52. #endif