Graphics Reference
In-Depth Information
A unique identifier. The application must be able to uniquely identify
each GUI element to differentiate the actual triggering source of individual
events.
Default behaviors. GUI elements should define default behaviors for mun-
dane situations. For example, a depressed GUI button should look different
from an unactivated button. As application programmers, we expect GUI
elements to behave appropriately for these types of typical situations.
Customizable behaviors. As application developers, we want to have the
option of customizing the behaviors of GUI elements. For example, our
application may demand a depressed button to have a special color.
State information. Certain types of interactions with the users require the
corresponding GUI element types to retain state information. For example,
a slider bar should record the knob position, a checkbox should record if
it is currently checked (true) or unchecked (false). When servicing events
generated by these types of GUI elements, our application must poll the
corresponding state information.
Abstract representation. Customizable behaviors and polling of state in-
Control variables. Va r i a b l e s
in our program code that are
associated with and represent
GUI elements.
formation imply that our program must have variables referencing the cor-
responding GUI elements. These types of variables are referred to as con-
trol variables, where through a control variable, our program code can con-
trol a GUI element. To properly reflect the different functionality, control
variables for different GUI element types should be of different data types.
For example, there should be a CButton class for buttons and CSliderBar
class for representing slider bar GUI elements.
Event service registration mechanisms. As we have seen many times,
this is probably the single most important functionality we expect from
GUI elements.
It is interesting to note that sometimes it is desirable to have GUI elements con-
trolled by the application. For example, in the ball-shooting program, as the Hero
Ball free falls under gravitational force, the slider bar GUI elements are con-
trolled by the application to correctly reflect the HeroBall velocity.
Search WWH ::




Custom Search