Application Header file Class Header file Class Class Name Superclass |
<X11/XawPlus/MenuButton.h> <X11/XawPlus/MenuButtonP.h> menuButtonWidgetClass MenuButton Command |
The MenuButton widget is an rectangular area, that contains a text label or bitmap image. When the pointer cursor is on the button, the button becomes highlighted. This highlighting indicates that the button is ready for selection. When a pointer button is pressed, the MenuButton widget will pop up the menu that has been named in the menuName resource.
Since the core extension class Add3dExt is inserted, the MenuButton widget has the additional resources highlightColor, shadowColor and buttonBorderWidth. The default background color is now grey75. These three colors and the width of the button border are used to draw the shape of a button with an inherited method of the Add3dExt class. Since XawPlus only supply rectangular buttons, the resources shapeStyle and cornerRoundPercent (inherited from the Command widget class) lost their meaning.
The bitmap and leftBitmap resources now also provide support of XPM styled pixmaps. These resources are inherited from the Label widget class. Look there for a description of this new feature.
Since Release 1.5 this widget provide a help function. If a help text and useHelp is set in the resources, a help window is popped up afer 1.2 seconds when the mouse pointer stay over the widgets window. This feature is inherited from the Command widget class. Look there for a detailed description.
Since release 2.0 this widget has a new highlight mode. The old highlight mode of Xaw is not longer available. This new feature is inherited from the Command widget class. Look there for a detailed description.
When creating a MenuButton widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:
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 12 True 12 0 0 |
CORE: | |||
border background mappedWhenManaged |
BorderColor Background MappedWhenManaged |
Pixel Pixel Boolean |
XtDefaultForeground grey75 True |
ADD3DEXT: | |||
highlightColor shadowColor buttonBorderWidth |
Background Background Width |
Pixel Pixel Dimension |
grey90 grey40 2 |
SIMPLE: | |||
cursor cursorName pointerColor pointerColorBackground insensitiveBorder |
Cursor Cursor Foreground Background Insensitive |
Cursor String Pixel Pixel Pixmap |
None NULL XtDefaultForeground XtDefaultBackground NULL |
LABEL: | |||
internalHeight internalWidth justify resize truncateLabel truncLeftSide font encoding foreground label leftBitmap leftClipMask bitmap clipMask |
Height Width Justify Resize Truncate Truncate Font Encoding Foreground Label LeftBitmap LeftBitmap Pixmap Pixmap |
Dimension Dimension XtJustify Boolean Boolean Boolean XFontStruct* unsigned char Pixel String Bitmap ClipMask Bitmap ClipMask |
2 4 XtJustifyCenter True True False XtDefaultFont XawTextEncoding8bit XtDefaultForeground NULL None None None None |
COMMAND: | |||
helpText helpEncoding helpBackground useHelp highlightThickness highlightMode callback translations accelerators ancestorSensitive |
Label Encoding Background Boolean Thickness Boolean Callback Translations Accelerators AncestorSensitive |
String unsigned char Pixel Boolean Dimension Boolean XtCallbackList TranslationTable AcceleratorTable Boolean |
NULL XawTextEncoding8bit LightGoldenrodYellow True 2 True NULL see doc or source NULL True |
MENUBUTTON: | |||
menuName | MenuName | String | "menu" |
menuName | The name of a popup shell to popup as a menu. The MenuButton will search for this name using XtNameToWidget starting with itself as the reference widget. If it is unsuccessful it will continue up the widget tree using each of its ancestors as the reference widget. If it is still unsuccessful it will print a warning message and give up. When the menu is found it will be popped up exclusive and spring_loaded. The MenuButton widget does not copy the value of this resource into newly allocated memory. The application programmer must pass the resource value in nonvolatile memory. |
The MenuButton widget supports the following actions:
The following are the default translation bindings used by the MenuButton widget:
<EnterWindow> |
highlight() reset() reset(), PopupMenu() |
The full list of actions supported by MenuButton is:
highlight() | Displays the interior of the button in the raised style, if highlightMode is set to True. If not, the button is always displayed in the raised style. In this case highlight() has no meaning. Since XawPlus 2.0 the conditions WhenUnset and Always are not longer supported. |
unhighlight() | Displays a flat border if highlightMode is set to True. If not, the button is displayed in the raised style. In this case unhighlight() has no meaning. |
set() | Enters the set state, in which notify is possible. This action causes the button to display its interior in the sunken button style. |
unset() | Cancels the set state and displays the interior of the button in the raised button style |
reset() | Cancels any set or highlight and displays the interior of the toggle in the flat style if highlightMode is set to True. If not, the toggle is displayed in the raised style. |
notify() | When the button is in the set state this action calls all functions in the callback list named by the callback resource. The value of the call_data argument passed to these functions is undefined. |
PopupMenu() | Pops up the menu specified by the menuName resource. |
The MenuButton widget does not place a server grab on itself. Instead, PopupMenu is registered as a grab action. As a result, clients which popup menus without using XtMenuPopup or MenuPopup or PopupMenu in translations will fail to have a grab active. They should make a call to XtRegisterGrabAction on the appropriate action in the application initialization routine, or use a different translation.