Sme Object


Application Header file <Xraw/Sme.h>
Class Header file <Xraw/SmeP.h>
Class smeWidgetClass
Class Name Sme
Superclass 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.


New 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
ancestorSensitive AncestorSensitive Boolean True
callback Callback XtCallbackList NULL
destroyCallback Callback XtCallbackList NULL
height Height Dimension 0
sensitive Sensitive Boolean True
width Width Dimension 1
ancestorSensitive The sensitivity state of the ancestors of this widget. A widget is insensitive if either it or any of its ancestors is insensitive. This resource should not be changed with XtSetValues, although it may be queried.
destroyCallback All functions on this list are called when this widget is destroyed.
height
width
The height and width of this widget in pixels. Keep in mind that the SimpleMenu widget will force all menu items to be the width of the widest entry.
sensitive Whether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensitive is False.


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.

  1. Objects can be zero 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 0 to height.

  3. 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.

  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.

[Xraw home] [Xraw widget class hierarchy]
Vladimir T. Romanovski
romsky@hp1.oea.ihep.su