next up previous contents
Next: vgui_Foo_adaptor Up: Adaptors Previous: Using a particular GUI

Adding a new GUI toolkit

One of the key ideas of VGUI is that it can be used with any widget set or user interface that can embed a GL drawing area. If the GUI toolkit you wish to use is not supported by VGUI then you can either: just go ahead and write your application in that that toolkit, or provide a new class derived from vgui that interfaces your toolkit to VGUI. The advantage of this second option is that the code you write will be portable to any other supported toolkit and you will be able to compile other people's VGUI applications on your favourite GUI toolkit. In order to port VGUI to a new interface there are several areas where the underlying interface must implement VGUI functionality. These are:

Events for the OpenGL drawing area must be translated into vgui_event's that will be used by the tableaux for that drawing area. This will be done by a subclass of vgui_adaptor e.g. vgui_Xm_adaptor.
Functions for manipulating a window should be provided. This will normally be done by a subclass of vgui_window e.g. vgui_Xm_window.
VGUI functions for controlling the event loop should be implemented. These functions include running the event loop, running one event at a time, flushing the event loop and adding user produced events. This will be provided in a class derived from vgui e.g. vgui_Xm. The vgui class also has factory methods for producing vgui_windows and vgui_dialog_impls that will need to be overridden
If the interface supports menus then it should be able to build a menu bar or popup menu from the vgui_menu description. Popup menus are handled in the vgui_adaptor subclass while a menubar is handled in the vgui_window subclass.
If the interface has text entry fields, option menus and checkboxes then it should be able to build a popup dialog from a vgui_dialog description. The class that provides the base for dialog implementations is vgui_dialog_impl.

Lets suppose that the GUI toolkit you want to use is the (fictitious) ``Foo'' toolkit. The following is a step-by-step guide to all the classes and functions you will need to make in order to implement VGUI in the new interface system.

next up previous contents
Next: vgui_Foo_adaptor Up: Adaptors Previous: Using a particular GUI
Target Junior User