NAME
Sme object − base class for menu entries.
SYNOPSIS
Public Headers:<X11/StringDefs.h> <X11/Xaw/Sme.h>
Private Header:<X11/Xaw/SmeP.h>
Class Name:Sme
Class Pointer:smeObjectClass
Instantiation:widget = XtCreateWidget(name, smeObjectClass, ...)
CLASS HIERARCHY
Object → RectObj → Sme
DESCRIPTION
The Sme object is the base class for all menu entries that are children of SimpleMenu. While this object is intended mainly to be subclassed, it may be used in a menu to add blank space between menu entries.
RESOURCES
The resources associated with the Sme object are defined in this section and affect only the single menu entry specified by this object.
| Name (XtN...) | Class Type | Default | Description | |||
| XtNancestorSensitive | Boolean | True | Sensitivity state of the ancestors of this widget: a widget is insensitive if either it or any of its ancestors is insensitive. | |||
| XtNborderWidth | Dimension | 1 | Width of button border. | |||
| XtNcallback | XtCallbackList | NULL | Callback for notify action. | |||
| XtNdestroyCallback | XtCallbackList | NULL | Callbacks for XtDestroyWidget(). | |||
| XtNheight | Dimension | 0 | Object height. | |||
| XtNsensitive | Boolean | True | Whether widget receives input. | |||
| XtNwidth | Dimension | 1 | Object width. | |||
| XtNx | Position | 0 | x-coordinate in pixels. | |||
| XtNy | Position | 0 | y-coordinate in pixels. | |||
Keep in mind that the SimpleMenu widget forces all menu items to be the width of the widest entry.
SUBCLASSING THE SME OBJECT
To create a new Sme object, you must 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.
Three new class methods are 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 than using these specialized class procedures, creating a new object is straightforward. Just subclass Sme and define new redisplay and highlight procedures. Here is some information that can help you avoid some common mistakes.
1.Objects can be 0 pixels high.
2.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 from 0 to height.
3.XtSetValues() calls may come from the application while the SimpleMenu is in its notify procedure. The SimpleMenu may later call the menu entry’s unhighlight procedure. Due to the asynchronous nature of X, the Expose event generated by XtSetValues() will come after this unhighlight.
4.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.
SEE ALSO
MenuButton, SimpleMenu, SmeBSB, SmeLine.