Share this Page URL

Chapter 8. HAVi > Widgets - Pg. 275

HAVi 275 The HAVi implementation should only generate KEY_PRESSED events. Neither KEY_TYPED nor KEY_RELEASED events should be generated. Furthermore, the system should collapse combined events. For example, a usual JVM generates for the letter A three events: KEY_PRESSED for modifier key Shift, KEY_PRESSED for letter A, and KEY_TYPED for A. This should be collapsed into one single KEY_PRESSED event with the letter A and the Shift modifier set. This simplifies the key event handling of applications. HEventGroup represents a group of key codes. Groups do not keep a count of the number of times a particular key code is added or removed. Repeatedly adding an event to a group has no effect. Removing an event removes it regardless of the number of times it has been added. Groups are resolved when they are passed into the methods of HScene. Adding or removing events from the group after those method calls does not affect the subscription to those events. Listeners (callbacks) HBackgroundImageListener is used for receiving events related to HBackgroundImage ob- jects. HScreenConfigurationListener is used to monitor when the configuration of an HScreenDevice is modified. HScreenLocationModifiedListener is used to monitor when a component on-screen location is modified. The HActionListener interface enables the recep- tion of HActionEvent events, as generated by objects implementing HActionable. HFocus- Listener enables the reception of HFocusEvent events, as generated by objects implementing HNavigable. HItemListener enables the reception of HItemEvents, as generated by objects implementing HItemValue. HTextListener enables the reception of HTextEvents, as gener- ated by objects implementing HTextValue. HKeyListener enables the reception of HKeyE- vent events. HAdjustmentListener enables the reception of HAdjustmentEvents, as gen- erated by objects implementing HAdjustmentValue. Widgets Widget Look The flexibility of the HAVi widget framework is further enhanced by separating the look component from the component for feel . This allows easy construction of many styles of presentation associated with each of the abstract Component Behaviors defined previously. Content can be associated with each state of a widget. For each widget state, textual, graphical, and user defined content can be associated with the widget. The HLook interface defines the mechanism by which the content for the particular state of the widget can be rendered. The HLook.showLook() is used to provide the rendering of the content for the widget. This method should be called in response to a paint method call of the associated lightweight component. showLook() is similar to the lightweight component's paint method, however because this method is separated from the widget class, there is no need to subclass the widget to change its look. The showLook() method is responsible for repainting the entire component, including its background, subject to the clipRect of the Graphics object passed to it. The showLook() method should not modify the clipRect of the Graphics object that is passed to it.