Wt examples
3.3.0
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
build
buildd
witty-3.3.0
examples
charts
PanelList.C
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
3
*
4
* See the LICENSE file for terms of use.
5
*/
6
7
#include <Wt/WPanel>
8
9
#include "
PanelList.h
"
10
11
using namespace
Wt;
12
13
PanelList::PanelList
(
WContainerWidget
*parent)
14
:
WContainerWidget
(parent)
15
{ }
16
17
WPanel
*
PanelList::addWidget
(
const
WString
& text,
WWidget
*w)
18
{
19
WPanel
*p =
new
WPanel
();
20
p->
setTitle
(text);
21
p->
setCentralWidget
(w);
22
23
addPanel
(p);
24
25
return
p;
26
}
27
28
void
PanelList::addPanel
(
WPanel
*panel)
29
{
30
panel->
setCollapsible
(
true
);
31
panel->
collapse
();
32
33
panel->expandedSS().connect(
this
, &
PanelList::onExpand
);
34
35
WContainerWidget::addWidget(panel);
36
}
37
38
void
PanelList::onExpand
(
bool
notUndo)
39
{
40
WPanel
*panel =
dynamic_cast<
WPanel
*
>
(sender());
41
42
if
(notUndo) {
43
wasExpanded_
= -1;
44
45
for
(
unsigned
i = 0; i < children().size(); ++i) {
46
WPanel
*p =
dynamic_cast<
WPanel
*
>
(children()[i]);
47
if
(p != panel) {
48
if
(!p->
isCollapsed
())
49
wasExpanded_
= i;
50
p->
collapse
();
51
}
52
}
53
}
else
{
54
if
(
wasExpanded_
!= -1) {
55
WPanel
*p =
dynamic_cast<
WPanel
*
>
(children()[
wasExpanded_
]);
56
p->
expand
();
57
}
58
}
59
}
Generated on Fri May 31 2013 for
the C++ Web Toolkit (Wt)
by
1.8.3.1