[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide

What Is a Trait?

Motif provides widget writers with about a dozen traits. A widget writer can install any number of these traits on a widget. A trait is named by an XrmQuark that symbolizes a specific widget capability. If a widget holds a particular trait, then that widget is announcing a specific capability to other widgets. Conversely, if a widget does not hold a particular trait, than that widget is implicitly announcing to other widgets that it is incapable of providing a particular service.

For example, consider the XmQTaccessTextual trait. A widget holding this trait is announcing to other widgets that it is capable of displaying one primary text parcel. Many standard Motif widgets, including XmText and XmLabel, hold this trait. If you are writing a widget that can display one primary text parcel, then it too should hold this trait.

Table 5-1 summarizes the standard Motif traits.

Table 4. Standard Motif Traits

Trait Name A Widget Holding This Trait Can:
XmQTaccessTextual Display one primary text parcel
XmQTactivatable Become a command button in a DialogBox
XmQTcareParentVisual Borrow its parent's visual information
XmQTcontainer Manage one or more XmQTcontainerItem children
XmQTcontainerItem Become a child of an XmQTcontainer parent
XmQTdialogShellSavvy Become a child of XmDialogShell
XmQTjoinSide Attach itself to one side of a suitable parent
XmQTmenuSavvy Become a menu child
XmQTmenuSystem Manage a menu system
XmQTnavigator Act as a navigator to a scrollable widget
XmQTscrollFrame Handle one or more navigator widgets
XmQTspecifyRenderTable Supply default render tables
XmQTtakesDefault Change its appearance to show that it is the default button
XmQTtransfer Transfer data to other widgets and/or receive data from other widgets

[ Previous | Next | Contents | Glossary | Home | Search ]