Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "GUI Programming"
Steven Solie (talk | contribs) |
Steven Solie (talk | contribs) |
||
Line 5: | Line 5: | ||
Intuition’s functionality is further extended by a number of auxiliary system components, or [[#GUI toolkits|toolkits]]. Like most AmigaOS subsystems, Intuition and its extensions are implemented as libraries of functions that can be accessed from a higher-level programming language like C, C++, Modula-2 or AmigaE. |
Intuition’s functionality is further extended by a number of auxiliary system components, or [[#GUI toolkits|toolkits]]. Like most AmigaOS subsystems, Intuition and its extensions are implemented as libraries of functions that can be accessed from a higher-level programming language like C, C++, Modula-2 or AmigaE. |
||
− | == GUI |
+ | == GUI Elements == |
Amiga programs do not look or behave very differently from, say, Mac or Windows applications because their user interface is based on shared metaphors and familiar elements. There may be differences in naming conventions or programming techniques but the building blocks are similar. The following table summarizes the building blocks (GUI elements) that are provided by Intuition and its various extensions: |
Amiga programs do not look or behave very differently from, say, Mac or Windows applications because their user interface is based on shared metaphors and familiar elements. There may be differences in naming conventions or programming techniques but the building blocks are similar. The following table summarizes the building blocks (GUI elements) that are provided by Intuition and its various extensions: |
Revision as of 03:19, 30 September 2012
Contents
Background
In AmigaOS, the face a program shows you – its graphical user interface (GUI) – is created through a subsystem called Intuition. Older literature sometimes used to refer to Intuition as “the Amiga user interface” but this is really not the case. Despite being responsible for much of what you can see in the OS (including its windowing desktop environment, the Workbench), Intuition itself remains invisible to the user. It is merely a system component providing ready-made elements to build GUIs from, and a set of functions through which these elements are manipulated. Intuition also interconnects GUIs with the operating system and handles various communications that underlie application usage and control.
Intuition’s functionality is further extended by a number of auxiliary system components, or toolkits. Like most AmigaOS subsystems, Intuition and its extensions are implemented as libraries of functions that can be accessed from a higher-level programming language like C, C++, Modula-2 or AmigaE.
GUI Elements
Amiga programs do not look or behave very differently from, say, Mac or Windows applications because their user interface is based on shared metaphors and familiar elements. There may be differences in naming conventions or programming techniques but the building blocks are similar. The following table summarizes the building blocks (GUI elements) that are provided by Intuition and its various extensions:
GUI element types | Description | System component or toolkit providing this functionality |
---|---|---|
screens | Virtual desktops on which windows are opened. | Intuition Library |
windows | Rectangular areas containing an interface through which a program communicates with the user, and vice versa. | Intuition Library |
menus | Programmable sets of commands displayed as a pull-down list of options. | Intuition Library, GadTools Library |
gadgets | Various-purpose GUI controls (buttons, toolbars, gauges, text fields...) with a standardized look and behaviour. Often called “widgets” in other operating systems. | Intuition Library, GadTools Library, ReAction, MUI |
images | Non-selectable elements showing graphics or text. | Intuition Library, ReAction, MUI |
requesters | Means for displaying information and for requesting input from the user. They would be called “dialogs”, “dialog boxes” or “dialog windows” in other OSes. | Intuition Library, ASL Library, ReAction, MUI |
alerts | A method of emergency communication (such as system errors). | Exec Library, Intuition Library |
pop-up notifications | Automatic messages informing the user when things happen. Unlike requesters, notifications are “unobtrusive” and do not require any input from the user. | Application Library |
IntuiText | Formatted text to be placed at a specific position inside an Intuition element (screen, window, menu, gadget or requester). | Intuition Library |
borders | Graphical structures made of lines that connect a series of defined points.. | Intuition Library |
The Two Frameworks
GUI programming in AmigaOS does not have to done within a single framework or API. This fact can be confusing to newcomers. There are two frameworks in Intuition representing fundamentally different approaches to GUI programming:
- The data structure-oriented framework is the original Intuition API. Within this framework, if you want to create a GUI element, you have to provide dedicated data structures for it; if you want to manipulate the element, you have to use a function designed for the particular action and type of element.
- The object-oriented framework (called BOOPSI: Basic Object-Oriented Programming System for Intuition) is the extendable API. Within this framework, if you want to create a GUI element, you have to instantiate an object based upon a particular class. Objects are manipulated through a small set of methods which are really just functions.
Modern AmigaOS programmers generally do not directly use either of these frameworks. Although it is still possible to do so it also requires a lot more code to achieve even a simple GUI.
Instead, programmers are encouraged to use one or more of the various toolkits provided.
GUI toolkits
The Intuition Library itself does not provide all the necessary tools for modern user interface programming. Much of the GUI-related functionality is now provided through various extensions, or toolkits. The following toolkits are installed by default in AmigaOS:
GadTools
The original (Release 1) Intuition only provided a fixed set of GUI elements limited in functionality and with practically no standardized look. To remedy this, GadTools was introduced in AmigaOS 2.x as a ready-made toolkit for easier, faster and more consistent GUI design. GadTools extended the original Intuition set with fancy new controls such as the cycle gadget, the radiobutton, or the listview. The gadgets shared similar imagery, thus giving Amiga GUIs a more uniform, standardized look. Apart from improving the gadget set, GadTools also greatly simplified the creation of menus.
GadTools is a datastructure-based toolkit. It is implemented as a single library, and is not extensible.
ASL
ASL, for Amiga Standard Library, is a toolkit designed to ease the programming of requesters. There are three types of requester created through ASL: the file requester, the font requester, and the screenmode requester.
ASL is a datastructure-based toolkit. It is implemented as a single library, and is not extensible.
ReAction
ReAction is a comprehensive toolkit for application GUI design. It covers all the functionality of GadTools and ASL, and extends the original BOOPSI class set as provided by Intuition. Originally a third-party product, ReAction is now part of AmigaOS and is considered the standard Amiga GUI toolkit.
ReAction is an object-oriented toolkit based on the BOOPSI philosophy. It is implemented as a set of classes. It is extensible: new classes can be written according to the BOOPSI specification.
MUI
MUI, for Magic User Interface, is a comprehensive third-party toolkit for application GUI design.
MUI is an object-oriented toolkit based on the BOOPSI philosophy, with proprietary extensions. It is implemented as a set of classes and support libraries. It is extensible: new classes can be written according to the BOOPSI/MUI specification.
The use of the toolkits
- Choose the toolkit that works best for your application and your end customers.
- Note that GadTools provides no automatic layouting system. Gadgets are not scalable: they are programmed to specific dimensions and positions. You’ll need to implement your own layouting mechanism to account for different window sizes, user-configured fonts and variant languages. If this sounds like too much work, go the object-oriented way and use either ReAction or MUI.
- The original BOOPSI set built in Intuition is somewhat limited. You may be better off using one of the extended BOOPSI toolkits, ReAction or MUI.
- Prefer not to mix datastructure-oriented and object-oriented GUI programming (unless there is no other way). GadTools gadgets cannot be placed inside ReAction or MUI layouts. You can use ASL together with the BOOPSI-based toolkits but there is no need, as both ReAction and MUI already cover the functionality of ASL.
- Despite both being based on BOOPSI, MUI and ReAction classes are not interchangeable. You cannot extend the functionality of ReAction with MUI classes, and vice versa.
- If you intend to make your program available for AmigaOS as well as for its clones, MUI is the better choice. Unlike ReAction, an implementation of MUI is available in all Amiga-like systems.