Wt examples  4.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PanelList Class Reference

#include <PanelList.h>

Inheritance diagram for PanelList:
Inheritance graph
[legend]

Public Member Functions

 PanelList ()
 
Wt::WPanel * addWidget (const Wt::WString &text, std::unique_ptr< Wt::WWidget > w)
 
void addPanel (std::unique_ptr< Wt::WPanel > panel)
 
void removePanel (Wt::WPanel *panel)
 

Private Member Functions

void onExpand (bool notUndo, Wt::WPanel *panel)
 

Private Attributes

int wasExpanded_
 

Detailed Description

Definition at line 16 of file PanelList.h.

Constructor & Destructor Documentation

◆ PanelList()

PanelList::PanelList ( )

Definition at line 13 of file PanelList.C.

14  : WContainerWidget()
15 { }

Member Function Documentation

◆ addPanel()

void PanelList::addPanel ( std::unique_ptr< Wt::WPanel >  panel)

Definition at line 30 of file PanelList.C.

31 {
32  panel->setCollapsible(true);
33  panel->collapse();
34 
35  panel->expandedSS().connect(std::bind(&PanelList::onExpand, this, std::placeholders::_1, panel.get()));
36 
37  WContainerWidget::addWidget(std::move(panel));
38 }
void onExpand(bool notUndo, Wt::WPanel *panel)
Definition: PanelList.C:41

◆ addWidget()

WPanel * PanelList::addWidget ( const Wt::WString &  text,
std::unique_ptr< Wt::WWidget >  w 
)

Definition at line 17 of file PanelList.C.

18 {
19  std::unique_ptr<WPanel> p
20  = cpp14::make_unique<WPanel>();
21  WPanel *result = p.get();
22  p->setTitle(text);
23  p->setCentralWidget(std::move(w));
24 
25  addPanel(std::move(p));
26 
27  return result;
28 }
void addPanel(std::unique_ptr< Wt::WPanel > panel)
Definition: PanelList.C:30

◆ onExpand()

void PanelList::onExpand ( bool  notUndo,
Wt::WPanel *  panel 
)
private

Definition at line 41 of file PanelList.C.

42 {
43  if (notUndo) {
44  wasExpanded_ = -1;
45 
46  for (unsigned i = 0; i < children().size(); ++i) {
47  WPanel *p = dynamic_cast<WPanel *>(children()[i]);
48  if (p != panel) {
49  if (!p->isCollapsed())
50  wasExpanded_ = i;
51  p->collapse();
52  }
53  }
54  } else {
55  if (wasExpanded_ != -1) {
56  WPanel *p = dynamic_cast<WPanel *>(children()[wasExpanded_]);
57  p->expand();
58  }
59  }
60 }
int wasExpanded_
Definition: PanelList.h:31

◆ removePanel()

void PanelList::removePanel ( Wt::WPanel *  panel)

Member Data Documentation

◆ wasExpanded_

int PanelList::wasExpanded_
private

Definition at line 31 of file PanelList.h.


The documentation for this class was generated from the following files:

Generated on Mon Jul 23 2018 for the C++ Web Toolkit (Wt) by doxygen 1.8.14