Programmer Reference : Common Widgets : OSF/Motif compatibility
OSF/Motif compatibility
The Common Widgets subsystem is based on the OSF/Motif C programming interface standard. This section is of interest to developers familiar with Motif. It describes the strategy used to translate Motif C types and functions to Smalltalk classes and methods. Experienced Motif developers will be able to apply their knowledge of the C programming interface directly when programming Common Widgets.
Smalltalk classes have been created for most C data types. These classes are named by prefixing the Motif data structure name with 'Cw' (after first removing any X, Xt, or Xm prefix). For example, the Motif data structure Widget is represented by the Smalltalk class CwWidget.
Motif functions have corresponding Smalltalk methods. To understand this mapping, consider the following function XmListSelectItem:
void XmListSelectItem (widget, item, notify)
Widget widget;
XmString item;
Boolean notify;
In the Common Widgets subsystem, the XmListSelectItem call has been mapped to an instance method of the class CwList:
selectItem:  item  notify: notify
The C type Widget, in this case, is mapped to the Smalltalk class CwList because the XmListSelectItem function applies only to list widgets. The XmList prefix has been stripped off, because such C-specific prefixing is unnecessary in Smalltalk.
Where C types have appropriate corresponding Smalltalk classes, C types are mapped to these. For example, the C type XmString is mapped to the Smalltalk class String, and the C type Boolean is mapped to the Smalltalk class Boolean.
Last modified date: 10/08/2020