Project

General

Profile

Bug #798 » main.cpp

main.cpp - Marco Poletti, 04/20/2011 04:43 PM

 

#include <Wt/WApplication>
#include <Wt/WPushButton>
#include <Wt/WContainerWidget>
#include <Wt/WDialog>

using namespace Wt;

class MyApplication : public WApplication {
public:
MyApplication(const WEnvironment& environment)
: WApplication(environment) {

WPushButton* button = new WPushButton("Open dialog");
button->clicked().connect(this, &MyApplication::openDialog);
root()->addWidget(button);
}
void openDialog() {
WDialog dialog("AAA");
dialog.rejectWhenEscapePressed();

WPushButton* abortButton = new WPushButton("Abort");
abortButton->clicked().connect(&dialog, &WDialog::reject);
dialog.contents()->addWidget(abortButton);

dialog.exec();
}
};

WApplication *createApplication(const WEnvironment& environment) {
return new MyApplication(environment);
}

int main(int argc, char *argv[]) {
return WRun(argc, argv, &createApplication);
}
(1-1/3)