Widget toolkit
From Wikipedia, the free encyclopedia
| This article does not cite any references or sources. (November 2007) Please help improve this article by adding citations to reliable sources. Unverifiable material may be challenged and removed. |
A widget toolkit, widget library, or GUI toolkit is a set of generic widgets for use in designing graphical user interfaces. Widgets that are part of a toolkit typically adhere to a unified design specification, including aesthetics and possibly an application framework to lend a sense of overall cohesion both for the program's designer and its users.
A widget toolkit API manages the creation and behavior of a graphical user interface:
- The graphical user interface is often created as a tree of widgets, some of them supporting interaction with the user (labels, buttons, check box, ...), others being containers that group the other widgets (windows, panels, ...).
- The content of the widgets tree, and the properties of the widgets, can often be modified at runtime (widgets can be added or removed from the tree).
- The toolkit handles the user events, as for example when clicking on a button. The action following the detection of the event is not the responsibility of the toolkit, but of the application. For example, if the user selects a file in a file dialog, the file dialog widget behavior and the detection of the user event are managed by the widget toolkit, but the actual action to perform on the file after selection must be performed by the application.
Widget toolkits must have a means to position the widgets in their containers. The simplest way to define their positions is by defining their absolute (on the screen) or relative (to the parent) position in pixels or common distance units, but it is also often possible to lay out the widgets by setting their relative positions without using distance units (see layout manager).
Also, the look and feel of the widgets can be hardcoded in the toolkit, but some widget toolkit APIs decouple the look and feel from the definition of the widgets, allowing the developer to define them at the initialisation of the application or even at runtime (see pluggable look and feel).