[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide


ExmGrid

The Grid widget class

Format

#include <Exm/Grid.h>

DESCRIPTION

ExmGrid is a demonstration widget. OSF provides this widget solely to teach programmers how to write their own Motif widgets. OSF does not support this widget in any way.

The source code for the ExmGrid widget illustrates how to do the following:

  1. Write a Motif-style manager widget supporting Motif-style resources and constraints

  2. Install the XmQTdialogShellSavvy trait and its methods

  3. Install the XmQTspecifyRenderTable trait and its methods

    ExmGrid is a general-purpose manager capable of containing any widget type as a child. In general, it requires no special knowledge about how its children function.

    ExmGrid is like a light-weight version of the standard Motif toolkit XmRowColumn widget. (XmRowColumn has an order of magnitude more code than ExmGrid.) Like XmRowColumn, ExmGrid lays out its children widgets within the cells of a two-dimensional matrix. Unlike XmRowColumn, ExmGrid cannot manage menus.

    ExmGrid ignores the value of the XmNshadowThickness resource of XmManager.

  4. Classes

    ExmGrid inherits behavior and resources from Core, Composite, Constraint and XmManager.

    The class pointer is exmGridWidgetClass.

    The class name is ExmGrid.

    New Resources

    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, ExmN, XmC or ExmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm or Exm 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).


    ExmGrid Resource Set
    Name Class Type Default Access
    XmNbuttonRenderTable XmCButtonRenderTable XmRenderTable NULL CSG
    XmNcolumns XmCColumns short 4 CSG
    XmNdefaultPosition XmCDefaultPosition Boolean true CSG
    XmNdialogTitle XmCDialogTitle XmString NULL CSG
    XmNlabelRenderTable XmCLabelRenderTable XmRenderTable NULL CSG
    XmNmapCallback XmCCallback XtCallbackList NULL C
    XmNmarginHeight XmCMarginHeight Dimension 10 CSG
    XmNmarginWidth XmCMarginWidth Dimension 10 CSG
    XmNrows XmCRows short 4 CSG
    XmNtextRenderTable XmCTextRenderTable XmRenderTable NULL CSG
    XmNunmapCallback XmCCallback XtCallbackList NULL C

    XmNbuttonRenderTable
    Specifies the default button render table used by Grid's button descendants (for example, ExmCommandButton or XmPushButton). If a button descendant has not defined a render table, Motif searches the button descendants parent hierarchy for the first ancestor that has the XmQTspecifyRenderTable trait installed. (For example, VendorShell, MenuShell, ExmGrid, XmBulletinBoard and its subclasses all install the XmQTspecifyRenderTable trait.) If the first ancestor encountered is an ExmGrid widget, then the value of XmNbuttonRenderTable becomes the button descendant's render table. If XmNbuttonRenderTable of ExmGrid is NULL, then Motif continues searching ancestors until it finds one that defines a button render table. Refer to XmRenderTable(3) for more information on the creation and structure of a render table.

    XmNcolumns
    Specifies the number of columns in the Grid. The default is 4 columns.

    XmNdefaultPosition
    Controls the positioning of a DialogShell managing a Grid. This resource has no influence if the Grid is not managed by a DialogShell. If XmNdefaultPosition is true, the DialogShell will center itself at the center of its own parent. For example, if the parent of the DialogShell is an ApplicationShell, then the center of the DialogShell will be at the same coordinates as the center of the ApplicationShell. If the DialogShell becomes unmapped (but stays managed) and then remapped, this resource has no influence on the DialogShell's position. If this resource is False, the DialogShell does not automatically center itself. Instead, the DialogShell (and therefore the Grid) will be positioned according to the values of XmNx and XmNy. Motif will treat the values of XmNx and XmNy as offsets from the upper-left corner of the screen (rather than as offsets from the upper-left corner of the parent shell).

    XmNdialogTitle
    Specifies the dialog title. If this resource is not NULL, and the parent of the Grid is a subclass of WMShell, Grid sets the XmNtitle and XmNtitleEncoding of its parent. If the only character set in XmNdialogTitle is ISO8859-1, XmNtitle is set to the string of the title, and XmNtitleEncoding is set to STRING. If XmNdialogTitle contains character sets other than ISO8859-1, XmNtitle is set to the string of the title converted to a compound text string, and XmNtitleEncoding is set to COMPOUND_TEXT. The direction of the title is based on the XmNlayoutDirection resource of the widget.

    XmNlabelRenderTable
    Specifies the default button render table used by Grid's label descendants (for example, ExmString or XmLabel). If a label descendant has not defined a render table, Motif searches the label descendants parent hierarchy for the first ancestor that has the XmQTspecifyRenderTable trait installed. (For example, VendorShell, MenuShell, ExmGrid, XmBulletinBoard and its subclasses all install the XmQTspecifyRenderTable trait.) If the first ancestor encountered is an ExmGrid widget, then the value of XmNlabelRenderTable becomes the label descendant's render table. If XmNlabelRenderTable of ExmGrid is NULL, then Motif continues searching ancestors until it finds one that defines a label render table. Refer to XmRenderTable(3) for more information on the creation and structure of a render table.

    XmNmapCallback
    Specifies the list of callbacks that is called only when the parent of the Grid is a DialogShell. If the parent of the Grid is not a DialogShell, XmNmapCallback has no influence. Assuming that the parent of the Grid is a DialogShell, the callback list is invoked when the DialogShell (and therefore the Grid) is mapped. The callback reason is XmCR_MAP. DialogShells are usually mapped when the Grid is managed.

    XmNmarginHeight
    Specifies the amount of blank space between the top edge of the Grid widget and the first item in each column, and between the bottom edge of the Grid widget and the last item in each column. The default value is 10 pixels.

    XmNmarginWidth
    Specifies the amount of blank space between the left edge of the Grid widget and the first item in each row, and between the right edge of the Grid widget and the last item in each row. The default value is 10 pixels.

    XmNrows
    Specifies the number of rows in the Grid. The default is 4 rows.

    XmNtextRenderTable
    Specifies the default button render table used by Grid's text descendants (for example, XmText, XmTextField, and XmList). If a text descendant has not defined a render table, Motif searches the text descendants parent hierarchy for the first ancestor that has the XmQTspecifyRenderTable trait installed. (For example, VendorShell, MenuShell, ExmGrid, XmBulletinBoard and its subclasses all install the XmQTspecifyRenderTable trait.) If the first ancestor encountered is an ExmGrid widget, then the value of XmNtextRenderTable becomes the text descendant's render table. If XmNtextRenderTable of ExmGrid is NULL, then Motif continues searching ancestors until it finds one that defines a text render table. Refer to XmRenderTable(3) for more information on the creation and structure of a render table.

    XmNunmapCallback
    Specifies the list of callbacks that is called only when the parent of the Grid is a DialogShell. In this case, this callback list is invoked when the Grid is unmapped. The callback reason is XmCR_UNMAP. DialogShells are usually unmapped when the Grid is unmanaged.


    ExmGrid Constraint Resource Set
    Name Class Type Default Access
    ExmNgridMarginHeightWithinCell ExmCGridMarginHeightWithinCell Dimension 0 CSG
    ExmNgridMarginWidthWithinCell ExmCGridMarginWidthWithinCell Dimension 0 CSG

    ExmNgridMarginHeightWithinCell
    Specifies the amount of blank space between the top edge of a child widget and the top of its cell. Also specifies the amount of blank space between the bottom edge of a child widget and the bottom of its cell.

    ExmNgridMarginWidthWithinCell
    Specifies the amount of blank space between the left edge of a child widget and the left edge of its cell. Also specifies the amount of blank space between the right edge of a child widget and the right edge of its cell.

    Inherited Resources

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


    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 NULL CSG
    XmNlayoutDirection XmCLayoutDirection XmDirection dynamic CG
    XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG
    XmNpopupHandlerCallback XmCCallback XtCallbackList NULL C
    XmNshadowThickness XmCShadowThickness Dimension 0 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 CSG
    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

    Translations

    ExmGrid inherits all the translations of XmManager. ExmGrid does not provide any additional translations beyond those defined by XmManager.

    Action Routines

    ExmGrid provides no action routines of its own.

    RELATED

    Core(3), Composite(3), Constraint(3), and XmManager(3).


    [ Previous | Next | Contents | Glossary | Home | Search ]