Wt examples  3.3.0
TreeNode.h
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 bvba, Kessel-Lo, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef TREENODE_H_
8 #define TREENODE_H_
9 
10 #include <Wt/WCompositeWidget>
11 #include <Wt/WText>
12 
13 class IconPair;
14 
15 namespace Wt {
16  class WTable;
17  class WImage;
18 }
19 
24 
56 {
57 public:
68  TreeNode(const std::string labelText,
69  Wt::TextFormat labelFormat,
70  IconPair *labelIcon, Wt::WContainerWidget *parent = 0);
71 
74  void addChildNode(TreeNode *node);
75 
78  void removeChildNode(TreeNode *node);
79 
82  const std::vector<TreeNode *>& childNodes() const { return childNodes_; }
83 
86  void collapse();
87 
90  void expand();
91 
92 private:
94  std::vector<TreeNode *> childNodes_;
95 
98 
101 
104 
107 
110 
113 
116 
119 
121  void adjustExpandIcon();
122 
124  bool isLastChildNode() const;
125 
127  void childNodesChanged();
128 
131 
133  void undoCollapse();
134 
136  void undoExpand();
137 
139  enum ImageIndex { Middle = 0, Last = 1 };
140 
141  static std::string imageLine_[];
142  static std::string imagePlus_[];
143  static std::string imageMin_[];
144 }; //
145 
148 #endif // WTREENODE_H_

Generated on Fri May 31 2013 for the C++ Web Toolkit (Wt) by doxygen 1.8.3.1