Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XmCommand(Xm) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 XmCommand(Xm)                  6 January 1993                  XmCommand(Xm)


 Name

    XmCommand - the Command widget class

 Syntax


    #include <Xm/Command.h>


 Description

    Command is a special-purpose composite widget for command entry that pro-
    vides 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.

    Classes

    Command inherits behavior and resources from Core, Composite, Constraint,
    XmManager, XmBulletinBoard, and XmSelectionBox classes.

    The class pointer is xmCommandWidgetClass.

    The class name is XmCommand.

    New resources

    The following table defines a set of widget resources used by the pro-
    grammer 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
 XmNcommandChanged-   XmCCallback         XtCallbackList   NULL        C
 Callback
 XmNcommandEntered-   XmCCallback         XtCallbackList   NULL        C
 Callback
 XmNhistoryItems      XmCItems            XmStringTable    NULL        CSG
 XmNhistoryItem-      XmCItemCount        int              0           CSG
 Count
 XmNhistoryMaxItems   XmCMaxItems         int              100         CSG
 XmNhistoryVisible-   XmCVisibleItem-     int              dynamic     CSG
 ItemCount            Count
 XmNpromptString      XmCPromptString     XmString         dynamic     CSG


    XmNcommand
            Contains the current command-line text. This is the XmNtextString
            resource in SelectionBox, renamed for Command.  This resource can
            also be modified via XmCommandSetValue and XmCommandAppendValue
            functions.  The command area is a Text widget.

    XmNcommandChangedCallback
            Specifies the list of callbacks that is called when the value of
            the command changes.  The callback reason is XmCRCOM-
            MANDCHANGED.  This is equivalent to the XmNvalueChangedCallback
            of the Text widget, except that a pointer to an XmCommand-
            CallbackStructure is passed, and the structure's value member
            contains the XmString.

    XmNcommandEnteredCallback
            Specifies the list of callbacks that is called when a command is
            entered in the Command.  The callback reason is
            XmCRCOMMANDENTERED. A pointer to an XmCommandCallback structure
            is passed.

    XmNhistoryItems
            Lists XmString items that make up the contents of the history
            list. This is the XmNlistItems resource in SelectionBox, renamed
            for Command.  XtGetValues for this resource returns the list
            items themselves, not a copy of the list items.  The application
            must not free the returned items.

    XmNhistoryItemCount
            Specifies the number of XmStrings in XmNhistoryItems. This is the
            XmNlistItemCount resource in SelectionBox, renamed for Command.
            The value must not be negative.

    XmNhistoryMaxItems
            Specifies the maximum number of items allowed in the history
            list. Once this number is reached, an existing list item must be
            removed before a new item can be added to the list. For each com-
            mand entered, the first list item is removed from the list, so
            the new command can be added to the list.  The value must be
            greater than 0.

    XmNhistoryVisibleItemCount
            Specifies the number of items in the history list that should be
            visible at one time. In effect, it sets the height (in lines) of
            the history list window. This is the XmNlistVisibleItemCount
            resource in SelectionBox, renamed for Command.  The value must be
            greater than 0.  The default is dynamic based on the height of
            the list.

    XmNpromptString
            Specifies a prompt for the command line.  This is the XmNselec-
            tionLabelString resource in SelectionBox, renamed for Command.
            The default may vary depending on the value of the XmNstring-
            Direction resource and the locale.  In the C locale the default
            is ``>''.

    Inherited resources

    Command inherits behavior and resources from the following superclasses.
    For a complete description of each resource, refer to the man page for
    that superclass.

 XmSelectionBox resource set

 ____________________________________________________________________________
 Name               Class              Type            Default         Access
 ____________________________________________________________________________
 XmNapplyCallback   XmCCallback        XtCallbackList  NULL            N/A
 XmNapply-          XmCApply-          XmString        dynamic         N/A
 LabelString        LabelString
 XmNcancelCallback  XmCCallback        XtCallbackList  NULL            N/A
 XmNcancel-         XmCCancel-         XmString        dynamic         N/A
 LabelString        LabelString
 XmNchildPlacement  XmCChildPlacement  unsigned char   XmPLACE_ABOVE_- CSG
                                                       SELECTION
 XmNdialogType      XmCDialogType      unsigned char   XmDIALOG_-      G
                                                       COMMAND
 XmNhelpLabelString XmCHelpLabelString XmString        dynamic         N/A
 XmNlistItemCount   XmCItemCount       int             0               CSG
 XmNlistItems       XmCItems           XmStringTable   NULL            CSG
 XmNlistLabelString XmCListLabelString XmString        NULL            N/A
 XmNlistVisible-    XmCVisible-        int             dynamic         CSG
 ItemCount          ItemCount
 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
 XmNselection-      XmCSelection-      XmString        dynamic         CSG
 LabelString        LabelString
 XmNtext-           XmCText-           XtAccelerators  default         C
 Accelerators       Accelerators
 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
 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
 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
 XmNtext-            XmCTranslations    XtTranslations  NULL           C
 Translations
 XmNunmapCallback    XmCCallback        XtCallbackList  NULL           C


 XmManager resource set

 ____________________________________________________________________________
 Name               Class             Type              Default        Access
 ____________________________________________________________________________
 XmNbottomShadow-   XmCBottomShadow-  Pixel             dynamic        CSG
 Color              Color


 XmNbottomShadow-   XmCBottomShadow-  Pixmap            XmUNSPECIFIED- CSG
 Pixmap             Pixmap                              _PIXMAP
 XmNforeground      XmCForeground     Pixel             dynamic        CSG
 XmNhelpCallback    XmCCallback       XtCallbackList    NULL           C
 XmNhighlightColor  XmCHighlightColor Pixel             dynamic        CSG
 XmNhighlightPixmap XmCHighlightPixmapPixmap            dynamic        CSG
 XmNinitialFocus    XmCInitialFocus   Widget            dynamic        CSG
 XmNnavigationType  XmCNavigationType XmNavigationType  XmTAB_GROUP    CSG
 XmNshadowThickness XmCShadowThicknessDimension         dynamic        CSG
 XmNstringDirection XmCStringDirectionXmStringDirection dynamic        CG
 XmNtopShadowColor  XmCTopShadowColor Pixel             dynamic        CSG
 XmNtopShadowPixmap XmCTopShadowPixmapPixmap            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
 XmNancestor-        XmCSensitive        Boolean        dynamic        G
 Sensitive
 XmNbackground       XmCBackground       Pixel          dynamic        CSG
 XmNbackground-      XmCPixmap           Pixmap         XmUNSPECIFIED_-CSG
 Pixmap                                                 PIXMAP
 XmNborderColor      XmCBorderColor      Pixel          XtDefaultFore- CSG
                                                        ground
 XmNborderPixmap     XmCPixmap           Pixmap         XmUNSPECIFIED_-CSG
                                                        PIXMAP
 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
 XmNinitialResources-XmCInitialResources-Boolean        True           C
 Persistent          Persistent
 XmNmappedWhen-      XmCMappedWhen-      Boolean        True           CSG
 Managed             Managed
 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


    Callback information

    A pointer to the following structure is passed to each callback:

       typedef struct
       {
           int         reason;
           XEvent          * event;
           XmString    value;
           int         length;
       } XmCommandCallbackStruct;


    reason  Indicates why the callback was invoked.

    event   Points to the XEvent that triggered the callback.

    value   Specifies the XmString in the CommandArea.

    length  Specifies the size of the command in value.

    Translations

    XmCommand inherits translations from XmSelectionBox.

    Accelerators

    The XmNtextAccelerators from XmSelectionBox are added to the Text descen-
    dant of XmCommand.

    Action routines

    The XmCommand action routines are described below:

    SelectionBoxUpOrDown(0|1|2|3):
            When called with a 0 argument, selects the previous item in the
            history list and replaces the text with that item.

            When called with a 1 argument, selects the next item in the his-
            tory list and replaces the text with that item.

            When called with a 2 argument, selects the first item in the his-
            tory list and replaces the text with that item.

            When called with a 3 argument, selects the last item in the his-
            tory list and replaces the text with that item.

            Calls the callbacks for XmNcommandChangedCallback.

    Additional behavior

    The Command widget has the additional behavior described below:

    MAny KCancel:
            If the parent of the Command is a manager, the event is passed to
            the parent.

    KActivate in Text:
            Calls the Text widget's XmNactivateCallback callbacks.  If the
            text is empty, this action then returns.  Otherwise, if the his-
            tory list has XmNhistoryMaxItems items, it removes the first item
            in the list.  It adds the text to the history list as the last
            item, clears the text, and calls the XmNcommandEnteredCallback
            callbacks.

    <Key> in Text:
            When any change is made to the text edit widget, this action
            calls the callbacks for XmNcommandChangedCallback.

    <DoubleClick> or <KActivate> in List:
            Calls the List widget's XmNdefaultActionCallback callbacks.  If
            the history list has XmNhistoryMaxItems items, this action
            removes the first item in the list.  It adds the selected List
            item to the history list as the last item, clears the text, and
            calls the XmNcommandEnteredCallback callbacks.

    <FocusIn>:
            Calls the callbacks for XmNfocusCallback.

    <MapWindow>:
            When a Command that is the child of a DialogShell is mapped, this
            action calls the callbacks for XmNmapCallback.

    <UnmapWindow>:
            When a Command that is the child of a DialogShell is unmapped,
            this action calls the callbacks for XmNunmapCallback.

    Virtual bindings

    The bindings for virtual keys are vendor specific.  For information about
    bindings for virtual buttons and keys, see VirtualBindings(Xm).

 See also

    Composite(Xm), Constraint(Xm), Core(Xm), XmBulletinBoard(Xm),
    XmCommandAppendValue(Xm), XmCommandError(Xm), XmCommandGetChild(Xm),
    XmCommandSetValue(Xm),
    XmCreateCommand(Xm), XmManager(Xm) and
    XmSelectionBox(Xm).


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026