The Sme Object
Author: Roland Krause 2002, roland_krause@freenet.de
Description: Documentation to XawPlus

### _________________________________________________________XawPlus

### The Sme Object

Application Header file Class Header file Class Class Name Superclass | <X11/XawPlus/Sme.h> <X11/XawPlus/SmeP.h> smeObjectClass Sme RectObj

The Sme object is the base class for all menu entries. While this object is mainly intended to be subclassed, it may be used in a menu to add blank space between menu entries.

### Differences between Xaw and XawPlus

Sme now has the new resources highlightColor and shadowColor to inherit them to SmeLine and SmeBSB. These resources are not used from Sme.

### Resources

The resources associated with the SmeLine object are defined in this section, and affect only the single menu entry specified by this object. There are no new resources added for this class, as it picks up all its resources from the RectObj class.

Name | Class | Type | Default Value
OBJECT: |  |  |
destroyCallback | Callback | Pointer | NULL
RECTANGLE: |  |  |
borderWidth height sensitive width x y | BorderWidth Height Sensitive Width Position Position | Dimension Dimension Boolean Dimension Position Position | 0 0 True 0 0 0
SME: |  |  |
callback highlightColor shadowColor international | Callback Background Background International | Pointer Pixel Pixel Boolean | NULL grey90 grey40 False

highlightColor | The color is used for the highlighted part of the line in SmeLine and for the highlighted part of the text from insensitive entries in SmeBSB.
shadowColor | The color is used for the shadowed part of the line in SmeLine and for the shadowed part of the text from insensitive entries in SmeBSB.
international | This is a boolean flag, only settable at widget creation time. A value of false signals not to use the X11R6 internationalization facility. A value of true signals to use font sets and support of multi byte code to display text etc. This resource is used from widgets which has to handle text output like SmeBSB.

Keep in mind that the SimpleMenu widget will force all menu items to be the width of the widest entry.

### Subclassing the Sme Object

To Create a new Sme object you will need to define a few class procedures. These procedures allow the SimpleMenu to highlight and unhighlight the menu entry as the pointer cursor moves over it, as well as notifying the entry when the user has selected it.

There are three new class methods defined by the Sme Object. All of these methods may be inherited from the Sme object, although the default semantics are not very interesting.

Highlight() | Called to put the menu entry into the highlighted state.
Unhighlight() | Called to return the widget to its normal (unhighlighted) state.
Notify() | Called when the user selects this menu entry.

Other then these specialized class procedures creating a new object is straight forward. Just subclass Sme and define new redisplay and highlight procedures. Here is some information that may help you avoid some common mistakes.

- Objects can be zero pixels high.
- Objects draw on their parent's window, therefore the Drawing dimensions are different from those of widgets. For instance, y locations vary from y to y + height, not 0 to height.
- SetValues calls may come from the application while the SimpleMenu is in its notify procedure. The SimpleMenu may later call the menu entries unhighlight procedure. Due to the asynchronous nature of X the expose event generated by XtSetValues() will come after this unhighlight.
- Remember the menu entry does not own the window. Share the space with other menu entries, never draw outside your own section of the menu.

### XawPlus_________________________________________________________