Wt (web toolkit)

Last updated
Wt
Original author(s) Emweb
Initial release1.0.0 / December 2005;19 years ago (2005-12)
Stable release
4.10.4 / March 6, 2024;9 months ago (2024-03-06) [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. [3]

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. [4]

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> Widget library for GUIs

Fast Light Toolkit (FLTK) 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">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.

<span class="mw-page-title-main">Tkinter</span> Python binding to the Tk GUI toolkit

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and macOS installs of Python.

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.

<span class="mw-page-title-main">Dojo Toolkit</span> Open-source modular JavaScript library

Dojo Toolkit is an open-source modular JavaScript library designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites. It was started by Alex Russell, Dylan Schiemann, David Schontzler, and others in 2004 and is dual-licensed under the modified BSD license or the Academic Free License.

<span class="mw-page-title-main">Google Web Toolkit</span> Free Java library

Google Web Toolkit, or GWT Web Toolkit, is an open-source set of tools that allows web developers to create and maintain JavaScript front-end applications in Java. It is licensed under Apache License 2.0.

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.

The Simple API for Grid Applications (SAGA) is a family of related standards specified by the Open Grid Forum to define an application programming interface (API) for common distributed computing functionality.

<span class="mw-page-title-main">Vaadin</span> Web development platform written in Java

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 a 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.

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">RaftLib</span>

RaftLib is a portable parallel processing system that aims to provide extreme performance while increasing programmer productivity. It enables a programmer to assemble a massively parallel program using simple iostream-like operators. RaftLib handles threading, memory allocation, memory placement, and auto-parallelization of compute kernels. It enables applications to be constructed from chains of compute kernels forming a task and pipeline parallel compute graph. Programs are authored in C++.

References

  1. "Wt: Release notes". www.webtoolkit.eu. Retrieved 2024-07-10.
  2. "wt/LICENSE" . Retrieved 2024-12-30.
  3. Dumon, Wim; Deforche, Koen (February 11, 2008). "Wt: A Web Toolkit". Dr. Dobb's Journal . Retrieved January 24, 2017.
  4. 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