User Interface |
This section contains information regarding details of the User Interface Kit that will help programmers who are developing applications that require GUI consistency.
Achieving such consistency across all supported UNIX-based platforms is relatively straightforward because they all use X11/Motif widgets. However, moving user interfaces developed on these systems to a PC/Windows system requires knowledge of the incompatibilities of the behavior of certain modules in the different environments.
This section also describes how to import third-party widgets into AVS/Express.
When designing a User Interface for an application that is to be implemented on multiple platforms, you must aim to achieve consistency of
Functional consistency means that the set of user operations with the GUI are consistent on all platforms. Look and feel consistency means that the appearance of the GUI and the flow of user interactions with the GUI are the same on all platforms. Both aspects must be present for the product to be cross-platform compatible.
Functional differences are fewer than look and feel differences between the PC/Windows and X11/Motif systems but may have a greater affect and are more difficult to work around for the developer/end-user. This section details the functional differences between the widget sets.
The following table summarizes the behavior differences in the current UI widget sets for the PC/Windows and X11/Motif systems. If a User Interface Kit module is not listed in the table, assume that its function is the same across PC/Windows and X11/Motif systems.
The following lists the functionality that is missing from AVS/Express or that differs on the PC/Windows and X11/Motif platforms.
The following lists the widgets that are missing from the implementation.
Differences in look and feel are the most obvious between the PC/Windows and X11/Motif versions of the User Interface Kit. The following table summarizes these inconsistencies. If a User Interface Kit module is not listed in the table, assume that its function is the same across PC/Windows and X11/Motif platforms.
Many widgets default to different sizes initially due in part to constraints of child widgets and the presence or absence of different window managers. Even across UNIX platforms, each system tends to run its own window manager.
Specifying color text names does not result in the generation of the same color on screen. This is especially true from X11/Motif to PC/Windows systems but can also be subtly different across X11/Motif systems since AVS does not use the CMS color specifications.
There are physically different mouse buttons and keyboard controls, which force a difference in the look and feel between PC/Windows and X11/Motif systems. Also, style specifications in the Windows style guide differ from the Motif style guide.
The most commonly used solution to cross-platform compatibility is the conditional compilation of V-code files based on a defined platform type. This consists of defining code sections with different values for each platform type. This solution is straightforward but requires much prototyping, testing, and debugging.
A slightly more evolved solution is to define a library of cross-platform pre-tested objects for use in further development.
You can import third-party widgets into AVS/Express by performing the following steps:
This section illustrates how to integrate a specific widget into AVS/Express. Reading it will give you a general understanding of how to import widgets, but the exact steps of the example are only valid for X11/Motif and UNIX versions of AVS/Express. If you have FTP access to the internet, you can also download and try this example yourself from the AVS FTP server (ftp.avs.com). Here, the compressed tar file, matrix.tar.Z is located in /pub/express/training.
The widget that is to be imported is the XbaeMatrix table (matrix) widget. This widget, which is publicly available from the X Consortium FTP Site (ftp.x.org), is a useful addition to the native widget set. After importing it, you should be able to integrate any third-party widget (or other code) into AVS/Express.
Note: A compressed tar file of the AVS/Express Project directory matrix, which is available via either the AVS Web page or the AVS FTP server, contains all of the code required for this example. See the AVS/Express FTP site for the latest example files.
The V-code object represents the public interface to the widget from the AVS/Express Object Manager view. Various resources of the widget may be exposed for get and set operations. Synthetic resources that extend the basic widget functionality may be added.
The UImatrix object inherits its basic functionality from the UIprimitive class. The V code for the UImatrix class is as follows:
Note: The file UImatrix.v contains this source code. It is available via either the AVS Web page or the AVS FTP server.
The V code in UImatrix.v represents the UImatrix object in AVS/Express. You must also provide a representation of the class in the User Interface C++ class hierarchy. You can generate code that provides the virtual functions for this class either using the OMX code generator or by hand.
The UIimport class definition is located in the file unsupp/UIimport/ui/import.h in the installed AVS/Express directory. You can also download the import.h file via either the AVS Web page or the AVS FTP server.
All classes that inherit from UIimport must provide their own instances of the instanceObject() virtual function because this is a pure virtual function in the UIimport class. The UImatrix class also provides its own instances of the UIimport class virtual functions updateObject and destroyObject. Most derived classes will need to do this also. The following hand-generated code inherits from the UIimport class interface.
In order to implement methods for the new UIimport class, you provide code that "glues" them to the functions that create, update, and destroy the imported widget.
The functions that you must implement include three virtual functions, a callback function, and a number of private functions, as specified in the following table:
You use the AVS/Express Compile Project mechanism to add the widget code to the AVS/Express executable. After you create the V-code object and the C++ class and implementation files, you must compile and link them with the main AVS/Express executable so that you can instance and use the new object. To do this, perform the following steps:
Test the new widget as follows: