The Command widget class
Format
#include <Xm/Command.h>
DESCRIPTION
Command is a special-purpose composite widget for command entry that provides a built-in command-history mechanism. Command includes a command-line text-input field, a command-line prompt, and a command-history list region.
One additional WorkArea child may be added to the Command after creation.
Whenever a command is entered, it is automatically added to the end of the command-history list and made visible. This does not change the selected item in the list, if there is one.
Many of the new resources specified for Command are actually SelectionBox resources that have been renamed for clarity and ease of use.
Command automatically creates the descendants shown in the following
table. An application can use XtNameToWidget to gain access to the named
descendant. In addition, a user or an application can use the named descendant
when specifying resource values.
Named Descendant | Class | Identity |
= | ||
ItemsList | XmList | command-history list region |
ItemsListSW | XmScrolledWindow | the ScrolledWindow parent of ItemsList |
Selection | XmLabelGadget | command-line prompt |
Text | XmTextField | command-line text-input field |
Command inherits behavior, resources, and traits from Core, Composite, Constraint, XmManager, XmBulletinBoard, and XmSelectionBox.
The class pointer is xmCommandWidgetClass.
The class name is XmCommand.
The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).
XmCommand Resource Set | ||||
Name | Class | Type | Default | Access |
XmNcommand | XmCTextString | XmString | "" | CSG |
XmNcommandChangedCallback | XmCCallback | XtCallbackList | NULL | C |
XmNcommandEnteredCallback | XmCCallback | XtCallbackList | NULL | C |
XmNhistoryItems | XmCItems | XmStringTable | NULL | CSG |
XmNhistoryItemCount | XmCItemCount | int | 0 | CSG |
XmNhistoryMaxItems | XmCMaxItems | int | 100 | CSG |
XmNhistoryVisibleItemCount | XmCVisibleItemCount | int | dynamic | CSG |
XmNpromptString | XmCPromptString | XmString | dynamic | CSG |
Now that some default localized label strings are provided through message catalogs for the children of composite widgets, the labelString resources cannot be set on the child through default resource files. Instead, the resource provided at the parent level must be used.
Command inherits behavior and resources from the superclasses described in the following tables. For a complete description of each resource, refer to the reference page for that superclass.
XmSelectionBox Resource Set | ||||
Name | Class | Type | Default | Access |
XmNapplyCallback | XmCCallback | XtCallbackList | NULL | N/A |
XmNapplyLabelString | XmCApplyLabelString | XmString | dynamic | N/A |
XmNcancelCallback | XmCCallback | XtCallbackList | NULL | N/A |
XmNcancelLabelString | XmCCancelLabelString | XmString | dynamic | N/A |
XmNchildPlacement | XmCChildPlacement | unsigned char | XmPLACE_ABOVE_SELECTION | CSG |
XmNdialogType | XmCDialogType | unsigned char | XmDIALOG_COMMAND | G |
XmNhelpLabelString | XmCHelpLabelString | XmString | dynamic | N/A |
XmNlistItemCount | XmCItemCount | int | 0 | CSG |
XmNlistItems | XmCItems | XmStringTable | NULL | CSG |
XmNlistLabelString | XmCListLabelString | XmString | NULL | N/A |
XmNlistVisibleItemCount | XmCVisibleItemCount | int | dynamic | CSG |
XmNminimizeButtons | XmCMinimizeButtons | Boolean | False | N/A |
XmNmustMatch | XmCMustMatch | Boolean | False | N/A |
XmNnoMatchCallback | XmCCallback | XtCallbackList | NULL | N/A |
XmNokCallback | XmCCallback | XtCallbackList | NULL | N/A |
XmNokLabelString | XmCOkLabelString | XmString | dynamic | N/A |
XmNselectionLabelString | XmCSelectionLabelString | XmString | dynamic | CSG |
XmNtextAccelerators | XmCTextAccelerators | XtAccelerators | default | C |
XmNtextColumns | XmCColumns | short | dynamic | CSG |
XmNtextString | XmCTextString | XmString | "" | CSG |
XmBulletinBoard Resource Set | ||||
Name | Class | Type | Default | Access |
XmNallowOverlap | XmCAllowOverlap | Boolean | True | CSG |
XmNautoUnmanage | XmCAutoUnmanage | Boolean | False | N/A |
XmNbuttonFontList | XmCButtonFontList | XmFontList | dynamic | N/A |
XmNbuttonRenderTable | XmCButtonRenderTable | XmRenderTable | dynamic | CSG |
XmNcancelButton | XmCWidget | Widget | NULL | N/A |
XmNdefaultButton | XmCWidget | Widget | NULL | N/A |
XmNdefaultPosition | XmCDefaultPosition | Boolean | False | CSG |
XmNdialogStyle | XmCDialogStyle | unsigned char | dynamic | CSG |
XmNdialogTitle | XmCDialogTitle | XmString | NULL | CSG |
XmNfocusCallback | XmCCallback | XtCallbackList | NULL | C |
XmNlabelFontList | XmCLabelFontList | XmFontList | dynamic | CSG |
XmNlabelRenderTable | XmCLabelRenderTable | XmRenderTable | dynamic | CSG |
XmNmapCallback | XmCCallback | XtCallbackList | NULL | C |
XmNmarginHeight | XmCMarginHeight | Dimension | 10 | CSG |
XmNmarginWidth | XmCMarginWidth | Dimension | 10 | CSG |
XmNnoResize | XmCNoResize | Boolean | False | CSG |
XmNresizePolicy | XmCResizePolicy | unsigned char | XmRESIZE_NONE | CSG |
XmNshadowType | XmCShadowType | unsigned char | XmSHADOW_OUT | CSG |
XmNtextFontList | XmCTextFontList | XmFontList | dynamic | CSG |
XmNtextRenderTable | XmCTextRenderTable | XmRenderTable | dynamic | CSG |
XmNtextTranslations | XmCTranslations | XtTranslations | NULL | C |
XmNunmapCallback | XmCCallback | XtCallbackList | NULL | C |
XmManager Resource Set | ||||
Name | Class | Type | Default | Access |
XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNforeground | XmCForeground | Pixel | dynamic | CSG |
XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
XmNinitialFocus | XmCInitialFocus | Widget | dynamic | CSG |
XmNlayoutDirection | XmCLayoutDirection | XmDirection | dynamic | CG |
XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG |
XmNpopupHandlerCallback | XmCCallback | XtCallbackList | NULL | C |
XmNshadowThickness | XmCShadowThickness | Dimension | dynamic | CSG |
XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG |
XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG |
XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
XmNuserData | XmCUserData | XtPointer | NULL | CSG |
Composite Resource Set | ||||
Name | Class | Type | Default | Access |
XmNchildren | XmCReadOnly | WidgetList | NULL | G |
XmNinsertPosition | XmCInsertPosition | XtOrderProc | NULL | CSG |
XmNnumChildren | XmCReadOnly | Cardinal | 0 | G |
Core Resource Set | ||||
Name | Class | Type | Default | Access |
XmNaccelerators | XmCAccelerators | XtAccelerators | dynamic | N/A |
XmNancestorSensitive | XmCSensitive | Boolean | dynamic | G |
XmNbackground | XmCBackground | Pixel | dynamic | CSG |
XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNborderColor | XmCBorderColor | Pixel | XtDefaultForeground | CSG |
XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG |
XmNcolormap | XmCColormap | Colormap | dynamic | CG |
XmNdepth | XmCDepth | int | dynamic | CG |
XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
XmNheight | XmCHeight | Dimension | dynamic | CSG |
XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean | True | C |
XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG |
XmNscreen | XmCScreen | Screen * | dynamic | CG |
XmNsensitive | XmCSensitive | Boolean | True | CSG |
XmNtranslations | XmCTranslations | XtTranslations | dynamic | CSG |
XmNwidth | XmCWidth | Dimension | dynamic | CSG |
XmNx | XmCPosition | Position | 0 | CSG |
XmNy | XmCPosition | Position | 0 | CSG |
A pointer to the following structure is passed to each callback:
typedef struct { int reason; XEvent * event; XmString value; int length; } XmCommandCallbackStruct;
XmCommand inherits translations from XmSelectionBox.
The XmNtextAccelerators from XmSelectionBox are added to the Text descendant of XmCommand.
The XmCommand action routines are:
When called with an argument of Next , or 1 for compatibility, selects the next item in the history list and replaces the text with that item.
When called with an argument of First , or 2 for compatibility, selects the first item in the history list and replaces the text with that item.
When called with an argument of Last , or 3 for compatibility, selects the last item in the history list and replaces the text with that item.
Calls the callbacks for XmNcommandChangedCallback.
The Command widget has the following additional behavior:
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings (3).
RELATED
Composite (3), Constraint (3), Core (3), XmBulletinBoard (3), XmCommandAppendValue (3), XmCommandError (3), XmCommandGetChild (3), XmCommandSetValue (3), XmCreateCommand (3), XmManager (3), and XmSelectionBox (3).