Graphics Reference
In-Depth Information
concepts. When reading this topic, remember that the programming and APIs
are there to help us learn the concepts and knowledge. In general, the skills in
working with an API should be readily transferable to new APIs.
2.2
GUI Elements
As we saw in Chapter 1, after the initialization, event-driven programs are simply
a collection of routines that are driven by asynchronous external events. For this
reason, facilitating the generation of appropriate events is key to implementing
event-driven programs. In our case, since our programs are built to interact with
users, our users are the main source of asynchronous events. Modern GUI APIs
are designed to facilitate users in triggering appropriate events for our applica-
tions.
Modern GUI APIs define an elaborate set of GUI elements and associate ex-
tensive event structures with these GUI elements to support interactivity with the
users and programmability of event service routines. For example, a GUI API
would define a button GUI element and associate events such as mouse over
(no click), clicked, double clicked, and so on with the button GUI element. The
GUI API would then allow application programmers to register and service these
events.
Recall that GUI elements are virtual input/output devices, typically repre-
sented as graphical icons. Other examples of common GUI elements include
slider bars, checkboxes, radio buttons, combo boxes, text boxes, and so on. A
window, or an area with fancy borders, is also an example of a GUI element. A
window GUI element is special because it serves as a container for other GUI
elements. In general, a GUI-based application has at least one GUI element—the
main application window. From the user's perspective, GUI elements should be
the following.
Visually pleasing. For example, representing a button with a 3D-looking
icon.
Semantically meaningful. For example, the button should be properly
labeled, so that users understand to move the mouse pointer over the icon
and click the left mouse button to activate (depress) the button.
On the opposite end, from the programmer's perspective, a GUI element should
have the following.
Search WWH ::




Custom Search