|
#include <Wt/WApplication.h>
|
|
#include <Wt/WContainerWidget.h>
|
|
#include <Wt/WGridLayout.h>
|
|
#include <Wt/WText.h>
|
|
#include <Wt/WPanel.h>
|
|
|
|
class PanelApplication : public Wt::WApplication
|
|
{
|
|
public:
|
|
PanelApplication(const Wt::WEnvironment& env);
|
|
};
|
|
|
|
PanelApplication::PanelApplication(const Wt::WEnvironment& env)
|
|
: Wt::WApplication(env)
|
|
{
|
|
setTitle("Animated Panel Demo");
|
|
const Wt::WAnimation animation(Wt::AnimationEffect::SlideInFromTop, Wt::TimingFunction::Linear,
|
|
1000);
|
|
|
|
auto panelContents = std::make_unique<Wt::WContainerWidget>();
|
|
auto layout = panelContents->setLayout(std::make_unique<Wt::WGridLayout>());
|
|
|
|
layout->addWidget(std::make_unique<Wt::WText>("Text 0"), 0, 0);
|
|
layout->addWidget(std::make_unique<Wt::WText>("Text 1"), 0, 1);
|
|
layout->addWidget(std::make_unique<Wt::WText>("Text 2"), 0, 2);
|
|
layout->addWidget(std::make_unique<Wt::WText>("Text 3"), 0, 3);
|
|
layout->addWidget(std::make_unique<Wt::WText>("Text 4"), 0, 4);
|
|
|
|
auto thePanel = std::make_unique<Wt::WPanel>();
|
|
thePanel->setTitle("The Panel");
|
|
thePanel->setCentralWidget(std::move(panelContents));
|
|
thePanel->setCollapsible(true);
|
|
thePanel->setAnimation(animation);
|
|
thePanel->setCollapsed(true);
|
|
|
|
this->root()->addWidget(std::move(thePanel));
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
|
|
return std::make_unique<PanelApplication>(env);
|
|
});
|
|
}
|