Wt examples
3.3.0
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
build
buildd
witty-3.3.0
examples
treelist
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
55
class
TreeNode
:
public
Wt::WCompositeWidget
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
97
TreeNode
*
parentNode_
;
98
100
Wt::WTable
*
layout_
;
101
103
IconPair
*
expandIcon_
;
104
106
Wt::WImage
*
noExpandIcon_
;
107
109
IconPair
*
labelIcon_
;
110
112
Wt::WText
*
labelText_
;
113
115
Wt::WText
*
childCountLabel_
;
116
118
Wt::WContainerWidget
*
expandedContent_
;
119
121
void
adjustExpandIcon
();
122
124
bool
isLastChildNode
()
const
;
125
127
void
childNodesChanged
();
128
130
bool
wasCollapsed_
;
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
1.8.3.1