Solaris Common Desktop Environment: Motif Transition Guide

XView Libraries Versus Solaris Motif Libraries

This section compares the XView and Solaris Motif libraries.

Terminology

The XView toolkit and the Xt (OLIT and Motif) toolkits use the following terminology:

XView 

Xt (OLIT and Motif) 

Package 

Widget 

Attribute 

Resources 

Frame 

Shell 

XView is based directly on Xlib, whereas Motif is based on the Intrinsics (Xt) toolkit and the Intrinsics toolkit is based on Xlib.

XView 

OLIT 

Motif 

XLib 

Xt 

Xt 

 

XLib 

XLib 

Because of this fundamental difference, the basic library functions to initialize the environment and create, modify and destroy graphical objects, are different, as shown in the following examples:

XView 

Motif/Xt 

xv_init()

XtAppInitialize()

xv_create()

XtCreateWidget()

xv_set()

XtSetValues()

xv_destroy()

XtDestroyWidget()

Functions that deal with event handling callbacks, and internationalization features, for example, get more complicated. For these features, simple one-to-one correspondence does not exist.

OPEN LOOK Versus Motif Toolkit Architecture

OLIT and Motif have very similar architectures whereas XView and Motif do not. When migrating from XView to Motif, you should note these toolkit differences.

The XView toolkit implements both the user interface objects, called packages, and the routines and processes that hold the interface together (creation routines, event processing, and so on), while Motif and OLIT implement basically just the user interface object, widgets, leaving the routines and processes to the Intrinsics library. For example, xv_init() is a function that is in the XView library. The corresponding function to use for OLIT or Motif programming, XtAppInitialize(), is in the Xt Intrinsics library.

The three toolkits represent two different GUIs. The appearance of the XView and OLIT toolkits are similar, whereas the appearance of Solaris Motif is noticeably different. Although there is a rough one-to-one correspondence between the function calls in the libraries, the behavior of parallel programs is different. That is, even after an OLIT (or XView) program has been converted to use the Solaris Motif library, it still to some degree has an OPEN LOOK appearance. A program in such a state does not adhere to either style completely.

Programming Model

Although the APIs are different, both XView and Motif are based on the same object-oriented methodology for programming a user interface:

The overall structure of a program being ported from XView to Motif can remain intact even though all the function calls must be converted from one API to the other.

Common Types of User Interface Objects

Both XView and Motif are user interface toolkits that support some common types of user interface objects. However, XView implements many of these objects at a higher level that requires more than one Motif widget to produce the equivalent of a single XView object.

Table 5-3 lists the basic mapping of common objects for XView and its equivalent Solaris Motif widget:

Table 5-3 Basic Mapping of Common Objects.

XView Package

Equivalent Solaris Motif Widget 

Base Frame 

XmTopLevelShell + XmMainWindow

Command Frame 

XmDialogShell + XmBulletinBoard

Notice 

XmDialogShell + XmMessageBox (MessageDialog)

Canvas 

XmScrolledWindow + XmDrawingArea

Panel 

XmBulletinBoard or XmForm

Panel Button 

XmPushButton

Menu Button 

DtMenuButton (not accessible in OpenWindows environment)

Abbrev Menu Button 

XmRowColumn (Option Menu)

Checkbox 

XmRowColumn + XmToggleButtons (CheckBox)

Exclusive Choice 

XmRowColumn + XmToggleButtons (Radio Box)

Scrolling List 

XmScrolledWindow + XmList

Message 

XmLabel

Slider 

XmScale

Text Field 

XmTextField

Numeric Text Field 

DtSpinBox (not accessible in OpenWindows environment)

Text SubWindow 

XmScrolledWindow + XmText (ScrolledText)

TTY SubWindow 

XmScrolledWindow + XmTermPane;

DtTerm (not accessible in OpenWindows environment)

Scrollbar 

XmScrollBar

Popup Menu 

XmMenuShell + XmRowColumn (Popup Menu)

Pulldown Menu 

XmMenuShell + XmRowColumn (Pulldown Menu)

Pullright Menu 

XmMenuShell + XmRowColumn (Pulldown Menu)

File Chooser 

XmDialogShell + XmFileSelectionBox

Differences Between XView and Solaris Motif

XView abstracts a number of other X11 functions that Motif (Xt) does not. In order to get equivalent functionality in Motif, these must be re-coded with direct Xlib calls.

The XView packages with no Motif equivalents are:

Additionally, no Solaris Motif equivalent exists for the OPEN LOOK user interface functionality that splits windows into different views. To implement this function, you must subclass one of the Motif Manager widgets.

Some XView functions can be coded with the Motif/Xt API; however, these APIs are significantly different, and require complete redesign and recoding. These functions are:

XView API 

Motif/Xt 

Selection service 

Xt selection API 

Drop target package 

Motif drag-and-drop API [If you are porting to CDE, use the CDE drag-and-drop API. It is an extension of the Motif 1.2 drag-and-drop API and is easier to use.]

Notifier 

Xt event management API 

X Resources

The X resources that control the behavior and appearance of XView and Motif applications are different. XView objects may not necessarily have instance names attached to them, unlike Motif/Xt objects. XView resources are independent of instance names. For example, Window.Foreground.Color affects all relevant XView objects.

Motif/Xt resources contain either class or instance names, for example, mainframe.control_panel.button1.foreground. To make Xt resources affect more than one object, use wildcards and class names.

External Files

XView reads in several files at start-up time ranging from message files to application specific default files containing X resources. The content and location of some of these files are different from Motif. (For example, Motif/Xt does not read in a message domain file (.mo file) under $OPENWINHOME.) The internationalization messaging scheme is completely different for Motif.