Inventor includes a built-in event model for the scene database. This model is not based on any specific window system or toolkit. When writing an Inventor program, you can select the X window programming model and use the tools provided by the window system to open windows and pass events into Inventor. Inventor provides event translation from X events into the Inventor event classes. Event Processing in Inventor shows how X events are passed to the render area and then translated into Inventor events that are handled by the Inventor scene manager. Since Inventor is independent of any window system, you can also choose a different window system and then write your own event translator.
Inventor provides a set of Xt utilities for use with the X Window System. This set of utilities contains the following:
This chapter focuses on the aspects of Inventor that are independent of the window system:
The render-area widget provides a convenient object for creating a window and translating window-specific events into generic Inventor events. With the X Window System model, you create an SoXtRenderArea (see Event Processing in Inventor ). Window-specific events are passed into this render area and then automatically translated into a generic Inventor SoEvent.
The render area provides the following:
The class tree for SoEvent is shown in Event Classes .
Each SoEvent instance contains the following information:
See the Open Inventor C++ Reference Manual entry on SoEvent for a list of methods available for querying the event. In addition, you can use the following macros:
Using the SoKeyboardEvent::getKey() method is the same as using XLookupKeysym() on an X key event.
An SoLocation2Event is generated whenever the cursor moves. This event contains the absolute location of the cursor in window coordinates. (Window coordinates begin with (0, 0) at the lower left corner of the window.) An SoMotion3Event is generated whenever a 3D input device, such as the spaceball, moves. This event contains the rotation and translation relative to the device's previous position.
Inventor events are extensible. If you have a device that does not correspond to existing SoEvent classes, you can create your own. (See Touch and Gesture Events)
As shown in Event Processing in Inventor , SoSceneManager is a common class used to tie window-system–dependent render areas (such as SoXtRenderArea) to Inventor. The render area employs the scene manager to handle the scene graph. The scene manager handles both rendering and event processing and is independent of any particular window system.