Programming Environment

The Presentation Manager programming environment under OS/2 Version 2.0 has changed very little from that provided under OS/2 Version 1.3. Presentation Manager applications written for previous versions of OS/2 will execute without modification under Version 2.0.

A high degree of source code compatibility is also provided which allows such applications to be recompiled for execution in a 32-bit environment, providing enhanced performance, with only very minor modifications in most cases.

A number of new API functions have been added to Presentation Manager under OS/2 Version 2.0, providing additional function to applications. These include the WinPopUpMenu() function which allows the creation of context menus and a number of other functions to simplify tasks such as checking or unchecking menu items, that were previously achieved by means of PM messages, some enhancement to the Gpi graphical functions, and some other minor changes to function names etc.

A number of standard CUA-conforming dialogs for file and font manipulation have been included within the operating system, removing the need for application developers to write these commonly needed functions as part of their application code.

Presentation Manager applications under OS/2 Version 2.0 may also mix 16-bit and 32-bit executable modules, in the same way as other applications. The operating system provides a "thunk" layer for the PM APIs as it does for the kernel APIs. Some additional considerations arise, however, when registering windows between environments and when passing pointers as message parameters, due to the difference in addressing schemes; this is handled automatically for the standard message classes. Functions are provided to enable programmers to implement thunks for their user-defined messages classes. For a general explanation of thunks see OS/2 Version 2.0 - Volume 1: Control Program and for examples of their use see OS/2 Version 2.0 - Volume 4: Application Development.

In order to implement application objects that integrate fully with those provided with the Workplace Shell one must write parts of one's application in a new way, using the System Object Model. The System Object Model provides a language for defining object classes, their methods and instance data, known as Object Interface Definition Language (OIDL) and some utility programs to assist in the generation of the language source files that are needed to build those object classes. Although currently only implemented for the C language, the System Object Model has been designed to enable object classes to be written in a variety of both object-oriented and non-object-oriented languages.

All the object classes that the user sees when using Workplace Shell, such as folder, data file and printer, are implemented internally as SOM classes (wpFolder, wpDataFile, wpPrinter, etc.). By sub-classing these and other Workplace Shell classes, programmers can develop new classes for the particular needs of his users, inheriting all the useful instance data and methods while adding to or replacing them with those that their new objects require.

Programming for the Presentation Manager and Workplace Shell environments under OS/2 Version 2.0, including the use of the System Object Model and the Workplace Shell classes, is described in detail in OS/2 Version 2.0 - Volume 4: Application Development.


[Back: Information Presentation Facility Enhancements]
[Next: Summary]