Personal tools
You are here: Home / cmgui / Wiki / Coding Motif
Navigation
Log in


Forgot your password?
 

Coding Motif

Motif is the standard GUI for unix based systems. Cmgui uses motif but also provides support for gtk, wx widgets and carbon.

Eventually the motif based interface will be superceded by the more usable wx widgets version that Alan is developing. wx widgets has the advantage that it is supported on both windows and unix based platforms.

Changes to the motif user interfaced require a knowledge of motif application programming. A good resource is the motif programming manual: http://www.ist.co.uk/motif/books/vol6A/Preface.fm.html

For users with some experience of GUIs the following is useful to know.

A Motif user interface is created using both the Intrinsics' Xt library and the Motif Xm library . Xt provides functions for creating and setting resources on widgets (eg width, height colour). Xm provides the widgets themselves, along with utility routines and convenient functions for creating complicated widgets that are actually made up of a group of widgets.

Motif uses a parent-child hierachy for widgets. Whenever a widget is created, it is created as the child of another widget. The shell widget acts as the top-level window of the application and handles the application's interaction with the window manager. The shell has one child which could be a primitive widget (ie an actual user interface control) or a manager widgit. Manager widgets are essentially containers for other widgets which control the size and placement of their child widgets.

When creating an application, the widget heirachy is created before the user interface is actually drawn to the screen. A shell widget must be created and a managed child associated with the shell widget by calling XtManageChild.

The user interface is "realized" by a call to XtRealizeWidget which then draws the interface.