Wt (web toolkit)

Last updated
Wt
Original author(s) Emweb
Initial release1.0.0 / December 2005;17 years ago (2005-12)
Stable release
4.10.0 / May 30, 2023;8 days ago (2023-05-30) [1]
Repository Wt Repository
Written in C++
Operating system Cross-platform
Type Web framework
License Dual-licensed:
Website www.webtoolkit.eu/wt

Wt (pronounced "witty") is an open-source widget-centric web framework for the C++ programming language. It has an API resembling that of Qt framework (although it was developed with Boost, and is incompatible when mixed with Qt), also using a widget-tree and an event-driven signal/slot system. [2]

Contents

The Wt's design goal is to benefit from the stateful component model used in desktop-applications APIs, applied to web development—instead of the traditional MVC (model–view–controller) design pattern. So rather than using MVC at the level of a web page, it is pushed to the level of individual components. [3]

While the library uses a desktop software development process, it does support some web-specific features, including:

One of the unique features of Wt is its abstraction layer of the browser rendering model. The library uses Ajax for communicating with browsers compatible with it, while using plain HTML-form post-backs for other user agents. Using a progressive bootstrap-method, the user interface is rendered as a plain HTML document first, then, provided its support in browser, it is automatically upgraded to use Ajax for increased interactivity. In this way, Wt is by definition:

Because of the popularity of C/C++ in embedded system environments, Wt is often used in such devices and (as a consequence) has been highly optimized for performance.

Major features

For a more detailed overview, see the Features section of official website.

Code example

The "Hello, World!" program in Wt:

#include<Wt/WApplication.h>#include<Wt/WBreak.h>#include<Wt/WContainerWidget.h>#include<Wt/WLineEdit.h>#include<Wt/WPushButton.h>#include<Wt/WText.h>/* * A simple hello world application class which demonstrates how to react * to events, read input, and give feed-back. */classHelloApplication:publicWt::WApplication{public:HelloApplication(constWt::WEnvironment&env);private:Wt::WLineEdit*nameEdit_;Wt::WText*greeting_;voidgreet();};/* * The env argument contains information about the new session, and * the initial request. It must be passed to the WApplication * constructor so it is typically also an argument for your custom * application constructor.*/HelloApplication::HelloApplication(constWt::WEnvironment&env):WApplication(env){setTitle("Hello world");// application titleroot()->addNew<Wt::WText>("Your name, please ? ");// show some textnameEdit_=root()->addNew<Wt::WLineEdit>();// allow text inputnameEdit_->setFocus();// give focusautobutton=root()->addNew<Wt::WPushButton>("Greet me.");// create a buttonbutton->setMargin(5,Wt::Side::Left);// add 5 pixels marginroot()->addNew<Wt::WBreak>();// insert a line breakgreeting_=root()->addNew<Wt::WText>();// empty text/*   * Connect signals with slots   *   * - simple Wt-way: specify object and method   */button->clicked().connect(this,&HelloApplication::greet);/*   * - using an arbitrary function object, e.g. useful to bind   *   values with std::bind() to the resulting method call   */nameEdit_->enterPressed().connect(std::bind(&HelloApplication::greet,this));/*   * - using a lambda:   */button->clicked().connect([=](){std::cerr<<"Hello there, "<<nameEdit_->text()<<"\n";});}voidHelloApplication::greet(){/*   * Update the text, using text input into the nameEdit_ field.   */greeting_->setText("Hello there, "+nameEdit_->text());}intmain(intargc,char**argv){/*   * Your main method may set up some shared resources, but should then   * start the server application (FastCGI or httpd) that starts listening   * for requests, and handles all of the application life cycles.   *   * The last argument to WRun specifies the function that will instantiate   * new application objects. That function is executed when a new user surfs   * to the Wt application, and after the library has negotiated browser   * support. The function should return a newly instantiated application   * object.   */returnWt::WRun(argc,argv,[](constWt::WEnvironment&env){/*     * You could read information from the environment to decide whether     * the user has permission to start a new application     */returnstd::make_unique<HelloApplication>(env);});}

See also

Related Research Articles

<span class="mw-page-title-main">Swing (Java)</span> Java-based GUI toolkit

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.

<span class="mw-page-title-main">FLTK</span>

Fast Light Toolkit is a cross-platform widget library for graphical user interfaces (GUIs), developed by Bill Spitzak and others. Made to accommodate 3D graphics programming, it has an interface to OpenGL, but it is also suitable for general GUI programming.

<span class="mw-page-title-main">PyQt</span> Python GUI library

PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. It is available under similar terms to Qt versions older than 4.5; this means a variety of licenses including GNU General Public License (GPL) and commercial license, but not the GNU Lesser General Public License (LGPL). PyQt supports Microsoft Windows as well as various kinds of UNIX, including Linux and MacOS.

<span class="mw-page-title-main">Fox toolkit</span>

The FOX toolkit is an open-source, cross-platform widget toolkit, i.e. a library of basic elements for building a graphical user interface (GUI). FOX stands for Free Objects for X.

EGL, originally developed by IBM and now available as the EDT open source project under the Eclipse Public License (EPL), is a programming technology designed to meet the challenges of modern, multi-platform application development by providing a common language and programming model across languages, frameworks, and runtime platforms.

A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.

gtkmm is the official C++ interface for the popular GUI library GTK. gtkmm is free software distributed under the GNU Lesser General Public License (LGPL).

A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and deploy web applications on the World Wide Web. Web frameworks aim to automate the overhead associated with common activities performed in web development. For example, many web frameworks provide libraries for database access, templating frameworks, and session management, and they often promote code reuse. Although they often target development of dynamic web sites, they are also applicable to static websites.

XML Interface for Network Services (XINS) is an open-source technology for definition and implementation of internet applications, which enforces a specification-oriented approach.

Echo is a web application framework created by the company NextApp. The latest iteration, Echo3, allows writing applications in either server-side Java or client-side JavaScript. Server-side applications do not require developer knowledge of HTML, HTTP, or JavaScript. Client-side JavaScript-based applications do not require a server, but can communicate with one via AJAX.

Dialog Control Language (DCL) is a high-level description language and interpreter within AutoCAD for creating simple graphical dialogs. AutoLISP extensions use it to interact with the user in the AutoCAD environment.

qooxdoo Open-source Ajax web application framework

qooxdoo is an open-source Ajax web application framework. It is an LGPL- and/or EPL-licensed client-side and server-agnostic solution, and includes support for professional JavaScript development, a graphical user interface (GUI) toolkit and high-level client-server communication.

ZK is an open-source Ajax Web application framework, written in Java, that enables creation of graphical user interfaces for Web applications with little required programming knowledge.

<span class="mw-page-title-main">Vaadin</span>

Vaadin is an open-source web application development platform for Java. Vaadin includes a set of Web Components, a Java web framework, and a set of tools that enable developers to implement modern web graphical user interfaces (GUI) using the Java programming language only, TypeScript only, or a combination of both.

<span class="mw-page-title-main">Abstract Window Toolkit</span> Java-based GUI toolkit

The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for Java program. AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support the Abstract Window Toolkit.

<span class="mw-page-title-main">Kivy (framework)</span> Free and multi-platform graphical library for Python

Kivy is a free and open source Python framework for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, macOS, and Windows.

JWt is an open-source widget-centric web application framework for the Java programming language developed by Emweb. It has an API that uses established GUI application development patterns. The programming model is component-based and event-driven, similar to Swing.

<span class="mw-page-title-main">React (software)</span> JavaScript library for building user interfaces

React is a free and open-source front-end JavaScript library for building user interfaces based on components. It is maintained by Meta and a community of individual developers and companies.

This is a list of articles related to the JavaScript programming language.

References

  1. "Wt: Release notes". www.webtoolkit.eu. Retrieved 2022-04-20.
  2. Dumon, Wim; Deforche, Koen (February 11, 2008). "Wt: A Web Toolkit". Dr. Dobb's Journal . Retrieved January 24, 2017.
  3. Volkman, Victor (June 6, 2008). "Wt: C++ Web Toolkit Library Lets You Write Scripting-Independent Web Apps". QuinStreet . Retrieved January 24, 2017.

Official website OOjs UI icon edit-ltr-progressive.svg