Page: | 1 | 2 | 3 | 4 | 5 | 6 |
---|
The Athena widget set provides support for single paned non-hierarchical pop and pulldown menus. Since menus are such a common user interface tool, support for them must be provided in even the most basic widget sets. In menuing as in other areas, the Athena Widget Set provides only basic functionality.
Menus in the Athena widget set are implemented as a menu container (the SimpleMenu widget) and a collection of objects that comprise the menu entries. The SimpleMenu widget is itself a direct subclass of the OverrideShell widget class, so no other shell is necessary when creating a menu. The managed children of a SimpleMenu must be subclasses of the Sme (Simple Menu Entry) object.
The Athena widget set provides three classes of Sme objects that may be used to build menus.
The SimpleMenu widget informs the window manager that it should ignore its window by setting the Override Redirect flag. This is the correct behavior for the press-drag-release style of menu operation. If click-move-click or "pinable"' menus are desired it is the responsibility of the application programmer, using the SimpleMenu resources, to inform the window manager of the menu.
To allow easy creation of pulldown menus, a MenuButton widget is also provided as part of the Athena widget set.
Home |
---|
The default configuration for the menus is press-drag-release. The menus will typically be activated by clicking a pointer button while the pointer is over a MenuButton, causing the menu to appear in a fixed location relative to that button; this is a pulldown menu. Menus may also be activated when a specific pointer and/or key sequence is used anywhere in the application; this is a popup menu(e.g. clicking Ctrl-<pointer button 1> in the common application xterm). In this case the menu should be positioned under the cursor. Typically menus will be placed so the pointer cursor is on the first menu entry, or the last entry selected by the user.
The menu remains on the screen as long as the pointer button is held down. Moving the pointer will highlight different menu items. If the pointer leaves the menu, or moves over an entry that cannot be selected then no menu entry will highlighted. When the desired menu entry has been highlighted, releasing the pointer button removes the menu, and causes any mechanism associated with this entry to be invoked.
Home |
---|
Application | <X11/Xaw/SimpleMenu.h> |
Class Header file | <X11/Xaw/SimpleMenP.h> |
Class | simpleMenuWidgetClass |
Class Name | SimpleMenu |
Superclass | OverrideShell |
The SimpleMenu widget is a container for the menu entries. It is a direct subclass of shell, and is should be created with XtCreatePopupShell, not XtCreateManagedWidget. This is the only part of the menu that actually is associated with a window. The SimpleMenu serves as the glue to bind the individual menu entries together into a menu.
The resources associated with the SimpleMenu widget control aspects that will affect the entire menu.
Name | Class | Type | Notes | Defaull Value |
accelerators | Accelerators | AcceleratorTable | NULL | |
ancestorSensitive | AnsestorSensitive | Boolean | D | True |
allowShellResize | AllowShellResize | Boolean | True | |
background | Background | Pixel | XtDefaultBaekground | |
backgroundPixmap | Pixmap | Pixmap | XtUnspecifiedPixmap | |
backingStore | backingStore | BackingStore | see below | |
borderColor | BorderColor | Pixel | XtDefaultForeground | |
borderPixmap | Pixmap | Pixmap | XlUnspecifiedPixmap | |
borderWidth | BorderWidth | Dimension | 1 | |
bottomMargin | verticalMargins | Dimension | 0 | |
children | ReadOnly | WidgetList | R | NULL |
createPopupChildProc | CreatePopupChildProc | Function | NULL | |
colormap | Colormap | Colormap | Parent's Colormap | |
cursor | Cursor | Cursor | None | |
depth | Depth | int | C | Parent's Depth |
destroyCallback | Callback | XtCallbackList | NULL | |
geometry | Geometry | String | NULL | |
height | Height | Dimension | Enough space to contain all entries | |
label | Label | String | NULL | |
labelClass | LabelClass | Pointer | SmeBSBObjeclClass | |
mappedWhenManaged | MappedWhenManaged | Boolean | True | |
menuOnScreen | MenuOnScreen | Boolean | True | |
numChildren | ReadOnly | Cardinal | R | 0 |
overrideRedirect | OverrideRedirecl | Boolean | True | |
popdownCallback | Callback | XtCallbackList | NULL | |
popupCallback | Callback | XtCallbackList | NULL | |
popupOnEntry | PopupOnEntry | Widget | A | Label or first entry |
rowHeight | RowHeight | Dimension | 0 | |
saveUnder | SaveUnder | Boolean | False | |
screen | Screen | Screen | R | Parent's Screen |
sensitive | Sensitive | Boolean | True | |
topMargin | Vertical Margins | Dimension | 0 | |
translations | Translations | TranslationTable | See below | |
visual | Visual | Visual | CopyFromParent | |
width | Width | Dimension | Width of widest entry | |
x | Position | Position | 0 | |
y | Position | Position | 0 |
accelerators | A list of event to action bindings to be executed by this widget, even though the event occurred in another widget. (See the X Toolkit Intrinsics-C Language Interface for details). |
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. |
backingStore | Determines what type of backing store will be used for the menu. Legal values for this resource are NotUseful, WhenMapped, and Always. These values are the backing-store integers defined in <X11/X.h>. A converter is registered for this resource that will convert the following strings: notUseful, whenMapped, always, and default. If default is specified (the default behavior) the server will use whatever it thinks is appropriate. |
background | A pixel value which indexes the widget's colormap to derive the background color of the widget's window. |
backgroundPixmap | The background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color. |
borderColor | A pixel value which indexes the widget's colormap to derive the border color of the widget's window. |
borderPixmap | The border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color. |
borderWidth | The width of this widget's window border. |
bottom Margin | |
topMargin | The amount of space between the top or bottom of the menu and the menu entry closest to that edge. |
children | A list of all this composite widget's current children. |
colormap | The colormap that this widget will use. |
cursor | The shape of the mouse pointer whenever it is in this widget. |
depth | The depth of this widget's window. |
destroyCallback | All functions on this list are called when this widget is destroyed. |
geometry | If this resource is specified it will override the x, y, width and height of this widget. The format of this string is [<width>x<heigh>][{+ -} <offset>{+ -} <yoffset>] . |
height | |
width | The height and width of this widget in pixels. |
label | This label will be placed at the top of the SimpleMenu, and may not be highlighted. The name of the label object is menuLabel. Using this name it is possible to modify the label's attributes through the resource database. When the label is created, the label is hard coded to the value of label, and justify is hard coded as XtJustifyCenter. |
labelClass | Specifies the type of Sme object created as the menu label. |
mappedWhenManaged | If this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed. |
menuOnScreen | If the menu is automatically positioned under the cursor with the XawPositionSimpleMenu action, and this resource is True, then the menu will always be fully visible on the screen. |
numChildren | The number of children in this composite widget. |
overrideRedirect | Determines the value of the override_redirect attribute of the SimpleMenu's window. The override_redirect attribute of a window determines whether or not a window manager may interpose itself between this window and the root window of the display. For more information see the Inter-Client Communications Conventions Manual. |
PopdownCallback | |
popupCallback | These callback functions are called by the Xt Intrinsics whenever the shell is popped up or down (See X Toolkit Intrinsics-C Language Interface for details). |
popupOnEnlry | The XawPositionSimpleMenu action will, by default, popup the SimpleMenu with its label (or first entry) directly under the pointer. To popup the menu under another entry, set this resource to the menu entry that should be under the pointer, when the menu is popped up. This allows the application to offer the user a default menu entry that can be selected with out moving the pointer. |
rowHeight | If this resources is zero (the default) then each menu entry will be given its desired height. If this resource has any other value then all menu entries will be forced to be rowHeight pixels high. |
saveUnder | If this is True<>/b then save unders will be active on the menu's window. |
screen | The screen on which this widget is displayed. This is not a settable resource. |
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. |
translations | The event bindings associated with this widget. |
x y | The location of the upper left outside corner of this widget in its parent. |
The SimpleMenu widget supports the following actions:
The following are the default translation bindings used by the SimpleMenu widget:
<EnterWindow>: | highlight( ) |
<LeaveWindow>: | unhighlight( ) |
<BtnMotion>: | highlight( ) |
<BtnUp>: | MenuPopdown( ) notify( ) unhighlight( ) |
The user can pop down the menu without activating any of the callback functions by releasing the pointer button when no menu item is highlighted.
The full list of actions supported by SimpleMenu is:
highlight( ) | Highlight the menu entry that is currently under the pointer. Only a item that is highlighted will be notified when the notify action is invoked. The look of a highlighted entry is determined by the menu entry. |
unhighlight( ) | Unhighlights the currently highlighted menu item, and returns it to its normal look. |
notify( ) | Notifies the menu entry that is currently highlighted that is has been selected. It is the responsibility of the menu entry to take the appropriate action. |
MenuPopdown(menu) This
action is defined in X Toolkit Intrinsics-C
Language Interface.
4.2.3. Positioning the SimpleMenu
If the SimpleMenu widget is to be used as a pulldown menu then the MenuButton widget, or some other outside means should be used to place the menu when it is popped up.
If popup menus are desired it will be necessary to add the XawPositionSimpleMenu and MenuPopup actions to the translation table of the widget that will be popping up the menu. The MenuPopup action is described in X Toolkit Intrinsics-C Language Interface. XawPositionSimpleMenu is a global action procedure registered by the SimpleMenu widget when the first one is created or the convenience routine XawSimpleMenuAddGlobalActions is called.
Translation writers should be aware that Xt does not register grabs on "don't care" modifiers, and therefore the left hand side of the production should be written to exclude unspecified modifiers. For example these are the translations needed to popup some of xterm's menus:
!Ctrl<Btn2Down>: XawPositionSimpleMenu(modes) MenuPopup(modes)
XawPositionSimpleMenu(menu) | The XawPositionSimpleMenu routine will search for the menu name passed to it using XtNameToWidget starting with the widget invoking the action as the reference widget. If it is unsuccessful it will continue up the widget tree using each of the invoking widget's ancestors as the reference widget. If it is still unsuccessful it will print a warning message and give up. XawPositionSimpleMenu will position the menu directly under the pointer cursor. The menu will be placed so that the pointer cursor is centered on the entry named by the popupOnEntry resource. If the menuOnScreen resource is True then the menu will always be fully visible on the screen. |
4.2.4.1. Registering the Global Action Routines
The XawPositionSimpleMenu action routine may often be invoked before any menus have been created. This can occur when an application uses dynamic menu creation. In these cases an application will need to register this global action routine by calling XawSimpleMenuAddGlobalActions:
app_con | Specifies the application context in which this action should be registered. |
This function need only be called once per application and must be called before any widget that uses XawPositionSimpleMenu action is realized.
4.2.4.2. Getting and Clearing the Current Menu Entry
To get the currently highlighted menu entry use XawSimpleMenuGetActiveEntry:
w | Specifies the SimpleMenu widget. |
This function returns the menu entry that is currently highlighted, or NULL if no entry is highlighted.
To clear the SimpleMenu widget's internal information about the currently highlighted menu entry use XawSimpleMenuClearActiveEntry:
w | Specifies the SimpleMenu widget. |
This function unsets all internal references to the currently highlighted menu entry. It does not unhighlight or otherwise alter the appearance of the active entry. This function is primarily for use by implementors of menu entries.
Home |
---|
Application Header file | <X11/Xaw/SmeBSB.h> |
Class Header file | <X11/Xaw/SmeBSBP.h> |
Class | smeBSBObjectClass |
Class Name | SmeBSB |
Superclass | Sme |
The SmeBSB object is used to create a menu entry that contains a string, and optional bitmaps in its left and right margins. Since each menu entry is an independent object, the application is able to change the font, color, height, and other attributes of the menu entries, on an entry by entry basis. The format of the string may either be the encoding of the 8 bit font utilized, or in a multi-byte encoding for use with a fontSet.
The resources associated with the SmeBSB object are defined in this section, and affect only the single menu entry specified by this object.
Name | Class | Type | Notes | Default Value |
ancestorSensitive | AncestorSensitive | Boolean | D | True |
callback | Callback | Callback | NULL | |
destroyCallback | Callback | XtCallbackList | NULL | |
font | Font | XFontStruct | XtDefaultFont | |
fontSet | FontSet | XFontSet | XtDefaultFontSet | |
foreground | Foreground | Pixel | XtDefaultForeground | |
height | Height | Dimension | A | Font height + vertSpace |
international | International | Boolean | C | False |
justify | Justify | Justify | XtjustifyLeft | |
label | Label | String | NULL | |
leftBitmap | LeftBitmap | Pixmap | XtUnspecifiedPixmap | |
leftMargin | leftMargin | Dimension | 4 | |
rightBitmap | RightBitmap | Pixmap | XtUnspecifiedPixmap | |
rightMargin | rightMargin | Dimension | 4 | |
sensitive | Sensitive | Boolean | True | |
vertSpace | VertSpace | int | 25 | |
width | Width | Dimension | A | TextWidth + margins |
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. |
callback | All callback functions on this list are called when the SimpleMenu notifies this entry that the user has selected it. |
destroyCallback | All functions on this list are called when this widget is destroyed. |
font | The text font to use when displaying the label, when the international resource is false. |
fontSet | The text font set to use when displaying the label, when the internatonal resource is true. |
foreground | A pixel value which indexes the SimpleMenu's colormap to derive the foreground color of the menu entry's window. This color is also used to render all 1's in the left and right bitmaps. |
height | |
width | The height and width of this widget in pixels. Keep in mind that the SimpleMenu widget will force the width of all menu entries to be the width of the longest entry. |
international | This is a boolean flag, only settable at widget creation time. A value of false signals the widget to use pre-R6 internationalization (specifically, the lack thereof), such as using fonts for displaying text, etc. A value of true directs the widget to act in an internationalized manner, such as utilizing font sets for displaying text, etc. |
justify | How the label is to be rendered between the left and right margins when the space is wider than the actual text. This resource may be specified with the values XtJustifyLeft, XtJustifyCenter, or XtJustifyRight. When specifying the justification from a resource file the values left, center, or right may be used. |
label | This is a the string that will be displayed in the menu entry. The exact location of this string within the bounds of the menu entry is controlled by the leftMargin, rightMargin, vertSpace, and justify resources. |
leftBitmap | |
rightBitmap | This is a name of a bitmap to display in the left or right margin of the menu entry. All 1's in the bitmap will be rendered in the foreground color, and all 0's will be drawn in the background color of the SimpleMenu widget. It is the programmers' responsibility to make sure that the menu entry is tall enough, and the appropriate margin wide enough to accept the bitmap. If care is not taken the bitmap may extend into another menu entry, or into this entry's label. |
leftMargin | |
rightMargin | This is the amount of space (in pixels) that will be left between the edge of the menu entry and the label string. |
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. |
vertSpace | This is the amount of vertical padding, expressed as a percentage of the height of the font, that is to be placed around the label of a menu entry The label and bitmaps are always centered vertically within the menu. The default value for this resource (25) causes the default height to be 125% of the height of the font. |
Home |
---|
Application Header file | <X11/Xaw/SmeLine.h> |
Class Header file | <X11/Xaw/SmeLineP.h> |
Class | smeLineObjectClass |
Class Name | SmeLine |
Superclass | Sme |
The SmeLine object is used to add a horizontal line or menu separator to a menu. Since each SmeLine is an independent object, the application is able to change the color, height, and other attributes of the SmeLine objects on an entry by entry basis. This object is not selectable, and will not highlight when the pointer cursor is over it.
The resources associated with the SmeLine object are defined in this section, and affect only the single menu entry specified by this object.
Name | Class | Type | Notes | Default Value |
destroyCallback | Callback | XtCallbackList | NULL | |
foreground | Foreground | Pixel | XtDefaultForeground | |
height | Height | Dimension | lineWldth | |
international | International | Boolean | C | False |
lineWidth | LineWidth | Dimension | 1 | |
stipple | Stipple | Pixmap | XtUnspecifiedPixmap | |
width | Width | Dimension | 1 |
destroyCallback | All functions on this list are called when this widget is destroyed. |
foreground | A pixel value which indexes the SimpleMenu's colormap to derive the foreground color used to draw the separator line. |
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 widget entry. Thus, setting the width is generally not very important. |
international | This is a boolean flag, only settable at widget creation time. While not utilized in this widget, it can and should be checked by any subclasses that have behavior that should vary with locale. |
lineWidth | The width of the horizontal line that is to be displayed. |
stipple | If a bitmap is specified for this resource, the line will be stippled through it. This allows the menu separator to be rendered as something more exciting than just a line. For instance, if you define a stipple that is a chain link, then your menu separators will look like chains. |
Home |
---|
Application Header file | <X11/Xaw/Sme.h> |
Class Header file | <X11/Xaw/SmeP.h> |
Class | smeObjectClass |
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.
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 | Noets | Default Value |
ancestorSensitive | AncestorSensitive | Boolean | True | |
callback | Callback | XtCallbackList | NULL | |
destroyCallback | Callback | XtCallbackList | NULL | |
height | Height | Dimension | 0 | |
international | Internalional | Boolean | C | False |
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. |
international | This is a boolean flag, only settable at widget creation time. While not utilized in this widget, it can and should be checked by any subclasses that have behavior that should vary with locale. |
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. |
4.5.2. Subclassing the Sme Object
To Create a new Sme object class you will need to define three class methods. These methods allow the SimpleMenu to highlight and unhighlight the menu entry as the pointer cursor moves over it, as well as notify the entry when the user has selected it. 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 methods, creating a new object is straight forward. 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) | XtSetValues calls may come from the application while the Sme is highlighted, and if the SetValues method returns True, will result in an expose event. The SimpleMenu may later call the menu entry's unhighlight procedure. However, due to the asynchronous nature of X, the expose event generated by XtSetValues will come after this unhighlight. |
4) | Remember that your subclass of the Sme does not own the window. Share the space with other menu entries, and refrain from drawing outside the subclass's own section of the menu. |
Home |
---|
Application Header file | <X11/Xaw/MenuButton.h> |
Class Header file | <X11/Xaw/MenuButtonP.h> |
Class | menuButtonWidgetClass |
Class Name | MenuButton |
Superclass | Command |
The MenuButton widget is an area, often rectangular, that displays a graphic. The graphic may be a text string containing multiple lines of characters in an 8 bit or 16 bit character set (to be displayed with a font), or in a multi-byte encoding (for use with a fontset). The graphic may also be a bitmap or pixmap.
When the pointer cursor is on a MenuButton widget, the MenuButton becomes highlighted by drawing a rectangle around its perimeter. This highlighting indicates that the MenuButton is ready for selection. When a pointer button is pressed, the MenuButton widget will pop up the menu named in the menuName resource.
When creating a MenuButton widget instance, the following resources are retrieved from the argument list or from the resource database:
Name | Class | Type | Notes | Default Value |
accelerators | Accelerators | AcceleratorTable | NULL | |
ancestorSensitive | AncestorSensitive | Boolean | D | True |
background | Background | Pixel | XtDeafaultBackgtround | |
backgroundPixmap | Pixmap | Pixmap | XtUnspecifiedPixmap | |
bitmap | Bitmap | Pixmap | None | |
borderColor | BorderColor | Pixel | XtDefaultForegrownd | |
borderPixmap | Pixmap | Pixmap | XtUnspecifiedPixmap | |
borderWidth | BorderWidth | Dimension | 1 | |
callback | Callback | XtCallbackList | NULL | |
colormap | Colormap | Colormap | Parent's Colormap | |
comerRowndPercent | CornerRoundPcrcent | Dimension | 25 | |
cursor | Cursor | Cursor | None | |
cursorName | Cursor | String | None | |
depth | Depth | int | C | Parent's Depth |
destroyCallback | Callback | XtCallbackList | NULL | |
encoding | Encoding | UnsignedChar | XawTextEncoding8bi | |
font | Font | XFontStruct | XtDefaultFont | |
fontSet | FontSet | XFontSet | XtDefaultFontSet | |
foreground | Foreground | Pixel | XtDefaultForegrownd | |
height | Height | Dimension | A | graphic height + 2 * internalHeight |
highlightThickness | Thickness | Dimension | A | 2 (0 if Shaped) |
insensitiveBorder | Insensitive | Pixmap | GreyPixmap | |
internalHeight | Height | Dimension | 2 | |
internalWidth | Width | Dimension | 4 | |
international | International | Boolean | C | False |
justify | Justify | Justify | XtJustifyCenter (center) | |
label | Label | String | name of widget | |
leftBitmap | LehtBitmap | Bitmap | None | |
mappedWhenManaged | MappedWhenManaged | Boolean | True | |
menuName | MenuName | String | "menu" | |
pointerColor | Foreground | Pixel | XtDefaultForegrownd | |
pointerColorBackgrownd | Background | Pixel | XtDefaultBackgrownd | |
resize | Resize | Boolean | True | |
screen | Screen | Screen | R | Parent's Screen |
sensitive | Sensitive | Boolean | True | |
shapeStype | ShapeStyle | ShapeStyle | Rectangle | |
translations | Translations | TranslationTable | See below | |
width | Width | Dimension | A | graphic width + 2 * internalWidth |
x | Position | Position | 0 | |
y | Position | Position | 0 |
accelerators | A list of event to action bindings to be executed by this widget, even though the event occurred in another widget. (See the X Toolkit Intrinsics-C Language Interface for details). |
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. |
background | A pixel value which indexes the widget's colormap to derive the back ground color of the widget's window. |
backgroundPixmap | The background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color. |
bitmap | A bitmap to display instead of the label. The default size of the widget will be just large enough to contain the bitmap and the widget's internal width and height. The resource for this resource constructs bit maps from the contents of files. (See section 2.5.3, Bitmap Conversion, for details.) If this bitmap is one bit deep then the 1's will be rendered in the fore ground color, and the 0's in the background color. If bitmap has a depth greater than one, it is copied directly into the window. |
borderColor | A pixel value which indexes the widget's colormap to derive the border color of the widget's window. |
borderPixmap | The border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color. |
borderWidth | The width of this widget's window border. |
callback | A list of routines to be called when the notify acdon is invoked. |
colormap | The colormap that this widget will use. |
cornerRoundPercent | When a ShapeStyle of roundedRectangle is used, this resource controls the radius of the rounded corner. The radius of the rounded corners is specified as a percentage of the length of the shortest side of the widget. |
cursor | The image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursorName. |
cursorName | The name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.1) |
destroyCallback | All functions on this list are called when this widget is destroyed. |
font | The text font to use when displaying the label, when the international resource is false. |
fontSet | The text font set to use when displaying the label, when the international resource is true. |
foreground | A pixel value which indexes the widget's colormap to derive the foreground color of the widget's window. This color is also used to render all l's in a bitmap one plane deep. |
height | |
width | The height and width of this widget in pixels. |
highlightThickness | The thickness of the rectangle that is used to highlight the internal border of this widget, alerting the user that it is ready to be selected. The default value is 2 pixels if the shapeStyle is rectangle, and 0 Pixels (no highlighting) otherwise. |
insensitiveBorder | This pixmap will be titled into the widget's border if the widget becomes insensitive. |
internalHeight internalWidth | The minimum amount of space to leave between the graphic and the vertical and horizontal edges of the window. |
international | This is a boolean flag, only settable at widget creation time. A value of false signals the widget to use pre-R6 internationalization (specifically, the lack thereof), such as using fonts for displaying text, etc. A value of true directs the widget to act in an internationalized manner, such as utilizing font sets for displaying text, etc. |
justify | Specifies left, center, or right alignment of graphic within the widget. This resource may be specified with the values XtJustifyLeft, XtJustifyCenter, or XtJustifyRight. A converter is registered for this resource that will convert the following strings: left, right, and center. This resource only has noticeable effect when the width of the widget is larger than necessary to display the graphic. Note that when the graphic is a multi-line label, the longest line will obey this justification while shorter lines will be left-justified with the longest one. |
label | Specifies the text string to be displayed in the widget's window if no bit map is specified. The default is the name of this widget. Irregardless of the value of encoding or international, a single newline character ( 1 byte) will cause a line break. |
mappedWhenManaged | If this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed. |
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 the search is unsuccessful the widget will continue up the widget tree using each of its ancestors as the reference widget passed to XtNameToWidget. If no widget of called menuName is found by this algorithm, the widget 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. |
pointerColor | A pixel value which indexes the widget's colormap to derive the fore ground color of the pointer symbol specified by the cursorName resource. |
pointerColorBackground | A pixel value which indexes the widget's colormap to derive the background color of the pointer symbol specified by the cursorName resource. |
resize | Specifies whether the widget should attempt to resize to its preferred dimensions whenever its resources are modified with XtSetValues. This attempt to resize may be denied by the parent of this widget. The parent is always free to resize the widget regardless of the state of this resource. |
screen | The screen on which this widget is displayed. This is not a settable resource. |
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. |
shapeStyle | Nonrectangular widgets may be created using this resource. Nonrectangular widgets are supported only on a server that supports the Shape Extension. If nonrectangular widgets are specified for a server lacking this extension, the shape is ignored and the widgets will be rectangular. The following shapes are currently supported: XmuShapeRectangle, XmuShapeOval, XmuShapeEllipse, and XmuShapeRoundedRectangle. A converter is registered for this resource that will convert the following strings: rectangle, oval, ellipse, and roundedRectangle. |
translations | The event bindings associated with this widget. |
x | |
y | The location of the upper left outside corner of this widget in its parent. |
The MenuButton widget supports the following actions:
The following are the default translation bindings used by the MenuButton widget:
<EnterWindow>: | highlight( ) |
<LeaveWindow>: | reset( ) |
<BtnDown>: | reset( ) PopupMenu( ) |
The full list of actions supported by MenuButton is:
highlight(condition) | Displays the internal highlight border in the color (foreground or background ) that contrasts with the interior color of the Command widget. The conditions WhenUnset and Always are understood by this action procedure. If no argument is passed, WhenUnset is assumed. |
unhighlight( ) | Displays the internal highlight border in the color (XtNforeground or background) that matches the interior color of the MenuButton widget. |
set( ) | Enters the set state, in which notify is possible. This action causes the button to display its interior in the foreground color. The label or bitmap is displayed in the background color. |
unset( ) | Cancels the set state and displays the interior of the button in the background color. The label or bitmap is displayed in the foreground color. |
reset( ) | Cancels any set or highlight and displays the interior of the button in the background color, with the label displayed in the foreground color. |
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 in these callback 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.
Home |
---|
Contents | Previous Chapter | Next Chapter |