Solaris Common Desktop Environment: Motif Transition Guide

Chapter 5 Toolkit Transition Issues

This chapter describes toolkit terminology, common widgets, CDE exclusive widgets, and high-level widgets, and provides information about the different libraries.

OPEN LOOK Versus Solaris Motif Toolkits

When you compare an OPEN LOOK application with its Solaris Motif counterpart, a few contrasting visual elements are immediately apparent. For example, the OPEN LOOK buttons are round whereas the Solaris Motif buttons are square. The shading applied to buttons and other objects for a three-dimensional appearance are also different. Although such cosmetic elements do not affect a program's behavior, and can often be disregarded when porting, your application will not be CDE style-guide compliant if you deviate from the CDE look.

Several differences are often significant in a conversion effort. The most critical of these features and other GUI elements are summarized in three sections:

See the Preface for a list of style guides and other references that describe the OPEN LOOK and Solaris Motif GUIs.

See Appendix A, User Interaction Changes for a more detailed list of the user interaction changes from OPEN LOOK to CDE.

Features Only in the OPEN LOOK User Interface

The following features are found in the OPEN LOOK user interface and are implemented in XView or OLIT (or both) but do not appear in Solaris Motif:

Features Only in the Solaris Motif User Interface

The following features are found in Solaris Motif and not in the OPEN LOOK user interface:

Notable Implementation Differences Between Toolkits

Many features are roughly equivalent in the OPEN LOOK user interface and Solaris Motif but have significant implementation differences. The following are the most important differences:

Other significant differences include the following:

The remainder of this section provides information on some of these features.

Tear-off Menus

In Solaris Motif, tear-off menus replace the pinned menus of the OPEN LOOK user interface. Selecting the dashed line on the top of the menu "tears-off" the menu.

Secondary Text Selection

The OPEN LOOK secondary text selection is roughly analogous to the Motif quick transfer mechanism.

Window Controls

One of the most critical implementation differences involves window controls. When the Motif user presses the Window menu button in the upper left corner of the title bar, or the OPEN LOOK user presses the MENU button anywhere on the window background (including the header), a menu is displayed. The options offered under the two GUIs introduce a key contrast.

The Motif Window menu offers a choice of Restore, Move, Size, Minimize, Maximize, Lower, and Close. The OPEN LOOK base Window menu offers Close, Full Size, Properties, Back, Refresh, and Quit. The two lists are fundamentally the same, but have very different effects.

In the OPEN LOOK user interface, the Close option minimizes (iconifies) the window, and Quit terminates the application.

In Motif, the Minimize option minimizes the window, and the Close option terminates the application. Many users familiar with the OPEN LOOK user interface have found themselves exiting a Motif program when their intent was to close its window to an icon.

Mouse Button Behavior

The structure of the mouse buttons is very similar in both specifications; however, the difference is significant enough to cause some confusion.

Table 5-1 shows the default left-to-right mapping of the three OPEN LOOK mouse buttons.

Table 5-1 OPEN LOOK Mouse Buttons

BUTTON 

Description 

SELECT 

Specifies an object or manipulates objects and controls, drag 

ADJUST 

Extends or reduces the number of selected objects 

MENU 

Displays a menu associated with the pointer location or 

specified object 

The three Motif mouse button assignments, described in Table 5-2 , also start by default with the left mouse button.

Table 5-2 Motif Mouse Buttons

Button 

Description 

BSelect 

Selects, activates, and sets the location cursor, drag 

BTransfer 

Moves and copies elements, drag and drop transfer. Can be customized to be the OPEN LOOK Adjust button. 

BMenu 

Displays menus 

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.

OLIT Libraries Versus Solaris Motif Libraries

Solaris Motif and OLIT support a number of convenience routines that are useful in manipulating objects in the user interface.

Routines Only in OLIT Library

These features are unique to the OLIT library.

Routines Only in Solaris Motif Libraries

These features are unique to the Solaris Motif libraries.

Widgets

Both the OLIT and Solaris Motif toolkits support a number of common widgets and gadgets with similar functionality, and each supports a number of more exclusive widgets. If a widget is implemented in one toolkit but not in the other, you can often build an equivalent object using multiple widgets in the other toolkit.

Table 5-4 matches the common widget name to the actual class name of the widget in each toolkit.

Table 5-4 Common Widget Mapping

OLIT Class Name 

Solaris Motif Class Name 

BulletinBoard

XmBulletinBoard 

DrawArea

XmDrawingArea

ExclusiveChoice + RectButtons

XmRowColumn + XmToggleButtons (Radio Box)

Form

XmForm

Manager

XmManager

MenuButton

DtMenuButton (not accessible in OpenWindows environment)

NoticeShell

XmDialogShell + XmMessageBox

AbbrevMenuButton

XmRowColumn (Option Menu)

PopupWindowShell

XmDialogShell

NonExclusiveRectButton

XmRowColumn + XmToggleButtons (Check Box)

PopupMenuShell

XmMenuShell

Primitive

XmPrimitive

OblongButton

XmPushButton

ControlArea

XmRowColumn

Scrollbar

XmScrollBar

ScrollingList

XmList + XmScrolledWindow

ScrolledWindow

XmScrolledWindow

Slider

XmScale

StaticText

XmLabel

TextEdit

XmText

TextField

XmTextField

RectButton

XmToggleButton

Widgets Exclusive to Solaris Motif

This section briefly describes the widgets that are exclusive to Solaris Motif.


Note -

These widgets are also available for Motif development in the OpenWindows environment, except for the DtTerm, DtEditor, DtComboBox, DtSpinBox, and DtMenuButton widgets.


The libDtWidget library, which contains the DtComboBox, DtSpinBox, DtMenuButton and DtEditor widgets, depends directly on the following libraries:

Widgets Exclusive to OLIT

This section briefly describes the widgets that are exclusive to OLIT.