Wt examples: /home/koen/project/wt/public-git/wt/examples/mission/impossible.C Source File

Wt examples 3.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

/home/koen/project/wt/public-git/wt/examples/mission/impossible.C
Go to the documentation of this file.

    00001 /*
    00002  * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
    00003  *
    00004  * See the LICENSE file for terms of use.
    00005  */
    00006
    00007 #include <Wt/WApplication>
    00008 #include <Wt/WBreak>
    00009 #include <Wt/WContainerWidget>
    00010 #include <Wt/WPushButton>
    00011 #include <Wt/WText>
    00012
    00013 #include "CountDownWidget.h"
    00014
    00015 WApplication *createApplication(const WEnvironment& env)
    00016 {
    00017   WApplication *appl = new WApplication(env);
    00018
    00019   new WText("<h1>Your mission</h1>", appl->root());
    00020   WText *secret
    00021     = new WText("Your mission, Jim, should you accept, is to create solid "
    00022                 "web applications.",
    00023                 appl->root());
    00024
    00025   new WBreak(appl->root()); new WBreak(appl->root());
    00026
    00027   new WText("This program will quit in ", appl->root());
    00028   CountDownWidget *countdown = new CountDownWidget(10, 0, 1000, appl->root());
    00029   new WText(" seconds.", appl->root());
    00030
    00031   new WBreak(appl->root()); new WBreak(appl->root());
    00032
    00033   WPushButton *cancelButton = new WPushButton("Cancel!", appl->root());
    00034   WPushButton *quitButton = new WPushButton("Quit", appl->root());
    00035   quitButton->clicked().connect(appl, &WApplication::quit);
    00036
    00037   countdown->done().connect(appl, &WApplication::quit);
    00038   cancelButton->clicked().connect(countdown, &CountDownWidget::cancel);
    00039   cancelButton->clicked().connect(cancelButton, &WFormWidget::disable);
    00040   cancelButton->clicked().connect(secret, &WWidget::hide);
    00041
    00042   return appl;
    00043 }
    00044
    00045 int main(int argc, char **argv)
    00046 {
    00047    return WRun(argc, argv, &createApplication);
    00048 }