Project

General

Profile

Bug #3545 » closable.cpp

Koen Deforche, 10/15/2014 01:52 PM

 
#include <Wt/WApplication>
#include <Wt/WMenuItem>
#include <Wt/WTabWidget>
#include <Wt/WTextArea>

#include <iostream>

using namespace Wt;

class Test : public WApplication
{
public:
Test(const WEnvironment& env)
: WApplication(env)
{
WContainerWidget *box = new WContainerWidget(root());
WTabWidget *tabW = new WTabWidget(box);
WMenuItem *tab = tabW->addTab(new WTextArea("Recap"), "General");
WMenuItem *tab1 = tabW->addTab(new WTextArea("Port 1"), "Port 1");
tab1->setCloseable(true);
WMenuItem *tab2 = tabW->addTab(new WTextArea("Port 2"), "Port 2");
tab2->setCloseable(true);
WMenuItem *tab3 = tabW->addTab(new WTextArea("Port 3"), "Port 3");
tab3->setCloseable(true);
tabW->setTabCloseable(1, true);
tabW->setTabCloseable(2, true);
tabW->setTabCloseable(3, true);
}

void foo() {
std::cerr << "Got click" << std::endl;
}
};

WApplication *createApplication(const WEnvironment& env){
return new Test(env);
}

int main(int argc, char *argv[]){
return WRun(argc, argv, createApplication);
}

(2-2/2)