|
GEOS SDK TechDocs
|
|
5.5 Menus and Dialog Boxes
|
5.7 Visible Object Classes
Although the basic generic objects provided by GEOS are powerful and useful in many situations, applications still need a way to display their own specific data. In most systems, this consists of allocating a window for the application's use and then implementing additional functionality for that window--scrolling, scaling, and document management.
The GenView generic object does all these things for an application. The application can allocate any number of views for its own use, and each view can display anything from regular graphics to hierarchies of visible objects.
Most applications will use at least one view. Its power and flexibility give programmers the opportunity to concentrate on their own application's functionality without having to worry about display issues such as scaling, clipping, and scrolling--they are all handled automatically. Some of the features of a view are listed below (see the GenView chapter for more detailed information):
-
Automatic clipping and updating
When an application uses a GenView, the programmer can forget the worries involved in figuring out which portions of his document need to be redrawn when. The GEOS Window Manager will automatically clip the document to the View's boundaries and will notify the application whenever a portion of the View has become invalid (whether by scrolling, sizing, moving, or being uncovered by movement of another object). The application simply must draw the document whenever notified that a portion has become invalid; it does not have to do any calculations regarding what is visible on the screen (though it might if the document is especially complex).
-
Automatic scrolling
By setting two attributes in a GenView's definition, an application can automatically make its view scrollable. The UI will automatically create scroller objects that will interact directly with the view--the application never has to know how far or in what direction the view has been scrolled. It simply will receive a message saying that the window has been invalidated and needs to be redrawn.
-
Automatic scaling
The view provides automatic scaling of the contents of its window. The application may request scalings or include a standard controller to let the user control this transparently to the application.
-
Automatic sizing
The Geometry Manager will automatically size the view to fit within its parent window. When the parent is resized, the view will follow. This process is transparent to applications. However, applications can customize this behavior by setting a fixed or desired size or by altering the sizing behavior of the view. They can also override this to make the parent window follow the view's size.
-
Comprehensive input management
Many applications will display objects within a view. In many cases, these objects will require input (e.g. the cards in Solitaire). The view gets input events from the User Interface and can pass them on to the proper objects in the hierarchy.
-
Flexibility
All the functions described above may be customized. Scrolling, for example, can be tracked and altered. Custom scroller objects can be defined in place of the automatically-generated scrollers. Sizing behavior can be adjusted. If necessary, you could get the view's bounds in order to draw only the visible portion of your document (though this often does not increase drawing performance significantly).
-
Customizable background color
Each view has a default background color determined by the specific UI. This can, however, be set to any RGB value or to any GEOS color index. This is used, for example, in Solitaire to create the green background (so the application does not have to draw green under all the other objects).
|
GEOS SDK TechDocs
|
|
5.5 Menus and Dialog Boxes
|
5.7 Visible Object Classes