Grid Widget Class


Overview

The Grid widget class allows the user to define a two dimensional world coordinate system and to draw the corresponding grid. A rich set of resources is available for customizing the appearance of the grid lines, the grid frame and the annotation. Axes of the Grid widget can be linear or logarithmic. Grid lines can be displayed as solid lines, dashed lines or 3D lines. The type, thickness and color of the grid lines can be set independently for vertical and horizontal grid lines for both major and minor annotation. The font, format and orientation of the annotation text can also be customized for both the horizontal and vertical directions. The Grid widget class inherits all of the resources and functions defined by its superclasses CompBase and EditObject. Therefore, Graphic object editing, zooming, and hardcopy output is supported for the Grid class.

Inherited Behavior and Resources

The Grid widget inherits behavior and resources from the Core, Composite, Constraint, Motif Manager, INT CompBase and EditObject classes.
The following resources are defined by the Grid widget class:
NameTypeDefaultAccess
XmNautoMarginAdjustintXintADJUST_NONECSG
XmNbottomAnnotationAngleint0CSG
XmNbottomMarginint40CSG
XmNcolorPixelblackCSG
XmNexposeCallbackXtCallbackListNULLC
XmNframeintXintFRAMECSG
XmNframeStyleintXintFRAME_SOLIDCSG
XmNframeThicknessint2CSG
XmNgridBelowBooleanTrueCSG
XmNhorizontalAnnotationForegroundPixelblackCSG
XmNhorizontalAnnotationFormatchar *"%g"CSG
XmNhorizontalAnnotationPlacementintXintPLACEMENT_TOP_
BOTTOM
CSG
XmNhorizontalAnnotationPositionfloat *NULLCSG
XmNhorizontalAxisTypeintXintAXIS_LINEARCSG
XmNhorizontalDirectionintXintSTART_TO_ENDCSG
XmNhorizontalEndfloat *100.0CSG
XmNhorizontalLabelchar *NULLCSG
XmNhorizontalLabelAlignmentintXintALIGNMENT_CENTERCSG
XmNhorizontalLabelFontchar *"*courier*bold-r*120*"CSG
XmNhorizontalLabelPlacementintXintPLACEMENT_TOP_
BOTTOM
CSG
XmNhorizontalMajorAnnotationBooleanTrueCSG
XmNhorizontalMajorAnnotationFontchar *"*courier*bold-r*100*"CSG
XmNhorizontalMajorGridLineStyleintXintGRID_LINE_SOLIDCSG
XmNhorizontalMajorIncrementfloat *10.0CSG
XmNhorizontalMajorThicknessint2CSG
XmNhorizontalMajorTickLengthint-5CSG
XmNhorizontalMinorAnnotationBooleanFalseCSG
XmNhorizontalMinorAnnotationFontchar *"*courier*medium-r*100*"CSG
XmNhorizontalMinorGridLineStyleintXintGRID_LINE_NONECSG
XmNhorizontalMinorIncrementfloat *5.0CSG
XmNhorizontalMinorThicknessint1CSG
XmNhorizontalMinorTickLengthint-5CSG
XmNhorizontalStartfloat *0.0CSG
XmNlabelForegroundPixelblackCSG
XmNleftAnnotationAngleint0CSG
XmNleftMarginint60CSG
XmNresizeCallbackXtCallbackListNULLC
XmNrightAnnotationAngleint0CSG
XmNrightMarginint60CSG
XmNroundAnnotationBooleanFalseCSG
XmNtextThreeDBooleanFalseCSG
XmNtitleAlignmentintXintALIGNMENT_CENTERCSG
XmNtitleBackgroundPixeldefault backgroundCSG
XmNtitleFontchar *"*courier*bold-r*140*"CSG
XmNtitleForegroundPixelblackCSG
XmNtitlePlacementintXintPLACEMENT_TOPCSG
XmNtitleShadowTypeintXintSHADOW_NONECSG
XmNtitleStringchar *NULLCSG
XmNtopAnnotationAngleint0CSG
XmNtopMarginint70CSG
XmNverticalAnnotationForegroundPixelblackCSG
XmNverticalAnnotationFormatchar *"%g"CSG
XmNverticalAnnotationPlacementintXintPLACEMENT_LEFT_
RIGHT
CSG
XmNverticalAnnotationPositionfloat *NULLCSG
XmNverticalAxisTypeintXintAXIS_LINEARCSG
XmNverticalDirectionintXintSTART_TO_ENDCSG
XmNverticalEndfloat *100.0CSG
XmNverticalLabelchar *NULLCSG
XmNverticalLabelAlignmentintXintALIGNMENT_CENTERCSG
XmNverticalLabelFontchar *"*courier*bold-r*120*"CSG
XmNverticalLabelOrientationintXintPARALLEL_TO_AXISCSG
XmNverticalLabelPlacementintXintPLACEMENT_LEFT_
RIGHT
CSG
XmNverticalMajorAnnotationBooleanTrueCSG
XmNverticalMajorAnnotationFontchar *"*courier*bold-r*100*"CSG
XmNverticalMajorGridLineStyleintXintGRID_LINE_SOLIDCSG
XmNverticalMajorIncrementfloat *10.0CSG
XmNverticalMajorThicknessint2CSG
XmNverticalMajorTickLengthint-5CSG
XmNverticalMinorAnnotationBooleanFalseCSG
XmNverticalMinorAnnotationFontchar *"*courier*medium-r*100*"CSG
XmNverticalMinorGridLineStyleintXintGRID_LINE_NONECSG
XmNverticalMinorIncrementfloat *5.0CSG
XmNverticalMinorThicknessint1CSG
XmNverticalMinorTickLengthint-5CSG
XmNverticalStartfloat *0.0CSG


XmNautoMarginAdjust

Specifies which of the values of the margin resources (XmNtopMargin, XmNbottomMargin, XmNleftMargin and XmNrightMargin) are automatically determined by the widget. You can specify one of the following constants:

Defined ConstantDescription
XintADJUST_ALLAll margins will be automatically computed by the widget.
XintADJUST_NONE (default)None of the margins will be automatically computed by the widget.
XintADJUST_LEFTThe left margin will be automatically computed by the widget.
XintADJUST_RIGHTThe right margin will be automatically computed by the widget.
XintADJUST_TOPThe top margin will be automatically computed by the widget.
XintADJUST_BOTTOMThe bottom margin will be automatically computed by the widget.

You also can specify a combination of the constants by using a logical OR operation or a arithmetic + operation. For instance, to have the left and right margin sized automatically and the top and bottom margin sized as specfied with the XmNtop and XmNbottom resources, you would set XmNautoMarginAdjust to XintADJUST_LEFT | XintADJUST_RIGHT or XintADJUST_LEFT + XintADJUST_RIGHT.


XmNbottomAnnotationAngle

Specifies the angle of rotation to apply when drawing the bottom annotation. Specify a value between -360 and 360. An XWindow font will be used to draw the annotation when this resource is set to 0, a stroke font will be used otherwise.

XmNbottomMargin

Specifies the margin, in pixel units, between the bottom of the window and the bottom of the widget's display area. This area may contain the annotation strings, the horizontal label and a title. This resource is set automatically if resource XmNautoMarginAdjust is set to XintADJUST_ALL or XintADJUST_BOTTOM.

XmNcolor

Specifies the color (as a Pixel value) used to draw the frame when the resource XmNframeStyle is set to XintFRAME_SOLID, XintFRAME_DASHED or XintFRAME_DOUBLE_DASHED. This resource also specifies the color used to draw the horizontal and vertical grid lines.

XmNexposeCallback

Specifies a list of callbacks to be called when a portion of the window containing the Grid widget is exposed.

XmNframe

Specifies whether or not a frame or a portion of a frame is drawn inside the widget's window. Specify one of the following constants:

Defined ConstantDescription
XintFRAME (default)Draws a complete frame inside the widget window.
XintFRAME_NONENo frame will be drawn.
XintFRAME_LEFTDraws the left portion of the frame.
XintFRAME_RIGHTDraws the right portion of the frame.
XintFRAME_TOPDraws the top portion of the frame.
XintFRAME_BOTTOMDraws the bottom portion of the frame.

The last four constants can be added (or OR'd) together to form various combinations (e.g. XintFRAME_TOP + XintFRAME_BOTTOM to have the widget draw the top and bottom portions of the frame).


XmNframeStyle

Specifies the style of line used to draw the Grid widget frame. Specify one of the following constants as the value of this resource:

Defined ConstantDescription
XintFRAME_SOLIDFrame is drawn with a solid line.
XintFRAME_DASHEDFrame is drawn with a dashed line.
XintFRAME_DOUBLE_DASHEDFrame is drawn with a double dashed line.
XintFRAME_SHADOW_INFrame is drawn so that it appears inset.
XintFRAME_SHADOW_OUTFrame is drawn so that it appears outset.


XmNframeThickness

Specifies the width (in pixels) of the Grid widget frame.

XmNgridBelow

Specifies whether the grid lines are displayed above (False) or below (True) Graphic objects drawn on a Grid widget.

XmNhorizontalAnnotationForeground

Specifies the pixel color used to draw the horizontal annotation.

XmNhorizontalAnnotationFormat

Specifies the format used to draw the horizontal annotation. Use any C format descriptor (e.g. "%5.2f") suitable for displaying float point data.

XmNhorizontalAnnotationPlacement

Specifies the placement of horizontal annotation. You can specify one the following constants:

Defined ConstantDescription
XintPLACEMENT_NONEHorizontal annotation is not displayed.
XintPLACEMENT_TOPHorizontal annotation is displayed above the Grid frame.
XintPLACEMENT_BOTTOMHorizontal annotation is displayed below the Grid frame.
XintPLACEMENT_TOP_BOTTOM (default)Horizontal annotation is displayed above and below the Grid frame.
XintPLACEMENT_INSIDEHorizontal annotation is drawn inside the Grid frame at the location specified by resource XmNhorizontalAnnotationPosition.

The constants listed above can be combined with an arithmetic addition or logical OR operation. For example, to draw annotation both at the top and inside the Grid frame area, specify the following: XintPLACEMENT_TOP + XintPLACEMENT_INSIDE.


XmNhorizontalAnnotationPosition

Specifies the location at which to draw the horizontal annotation within the Grid frame when the resource XmNhorizontalAnnotationPlacement includes the value XintPLACEMENT_INSIDE. This value can be positive or negative with respect to XmNhorizontalStart.

XmNhorizontalAxisType

Specifies the type of axis for the horizontal direction. Specify XintLINEAR for a linear axis and XintLOG for a logarithmic axis.

XmNhorizontalDirection

Specifies the orientation of the horizontal axis. Specify the constant XintSTART_TO_END to have the horizontal starting value located on the left end of the axis or the constant XintEND_TO_START to have the horizontal starting value located on the right end of the axis.

XmNhorizontalEnd

Specifies the axis ending value in user coordinates in the horizontal direction.

XmNhorizontalLabel

Specifies a single line string or multiple line string that provides labeling for the horizontal annotation. The label placement is controlled by resource, XmNhorizontalLabelPlacement.

XmNhorizontalLabelAlignment

Specifies the alignment of each line of the horizontal label. Multiple lines can be specified by inserting the special character `\n' between each line in the label string. Label lines are adjusted in respect to the horizontal label area, which is the same width as the widget's display area. You can specify one of the following constants:

Defined ConstantDescription
XintALIGNMENT_BEGINNINGLines of the label are left aligned.
XintALIGNMENT_CENTERLines of the label are centered.
XintALIGNMENT_ENDLines of the label are right aligned.


XmNhorizontalLabelFont

Specifies the name of a font used to draw the horizontal label specified by resource, XmNhorizontalLabel.

XmNhorizontalLabelPlacement

Specifies the placement of the horizontal label. You can specify one of the following constants:

Defined ConstantDescription
XintPLACEMENT_TOPThe horizontal label is drawn above the widget's display area
XintPLACEMENT_BOTTOM The horizontal label is drawn below the widget's display area.
XintPLACEMENT_TOP_BOTTOM The horizontal label is drawn both above and below the widget's display area.


XmNhorizontalMajorAnnotation

Specifies whether or not to draw major annotation in the horizontal direction.

XmNhorizontalMajorAnnotationFont

Specifies the name of the font used to draw major annotation in the horizontal direction.

XmNhorizontalMajorGridLineStyle

Specifies the line style used to draw the major grid lines corresponding to the horizontal axis. You can use one of the following constants:

Resource ValueDescription
XintGRID_LINE_NONE No grid lines are drawn.
XintGRID_LINE_SOLID (default)Grid lines are solid lines.
XintGRID_LINE_DASHEDGrid lines are drawn using an on-off dash pattern.
XintGRID_LINE_DOUBLE_DASHEDGrid lines are drawn using a double dashed pattern.
XintGRID_LINE_SHADOW_INGrid lines are drawn using reversed shadow colors.
XintGRID_LINE_SHADOW_OUTGrid lines are drawn using the normal bottom and top shadow colors.


XmNhorizontalMajorIncrement

Specifies the major grid increment, as a positive value, in the horizontal direction.

XmNhorizontalMajorThickness

Specifies the thickness, in pixels, of the major grid lines associated with the horizontal axis.

XmNhorizontalMajorTickLength

Specifies the length of major tick marks associated with the horizontal axis. Specify a positive value to have the tick marks drawn inside the grid frame or a negative value to have the tick marks drawn outside the grid frame.

XmNhorizontalMinorAnnotation

Specifies whether or not to draw minor annotation in the horizontal direction.

XmNhorizontalMinorAnnotationFont

Specifies the name of the font used to draw minor annotation in the horizontal direction.

XmNhorizontalMinorGridLineStyle

Specifies the line style used to draw the minor grid lines corresponding to the horizontal axis. Use one of the following constants:

Resource ValueDescription
XintGRID_LINE_NONENo grid lines are drawn.
XintGRID_LINE_SOLID (default)Grid lines are drawn using a solid line.
XintGRID_LINE_DASHEDGrid lines are drawn using a on-off dash pattern.
XintGRID_LINE_DOUBLE_DASHEDGrid lines are drawn using a double dashed pattern.
XintGRID_LINE_SHADOW_INGrid lines are drawn using reversed shadow colors.
XintGRID_LINE_SHADOW_OUTGrid lines are drawn using the bottom and top shadow colors.


XmNhorizontalMinorIncrement

Specifies the minor increment, as a positive value, in the horizontal direction.

XmNhorizontalMinorThickness

Specifies the thickness, in pixels, of minor grid lines associated with the horizontal axis.

XmNhorizontalMinorTickLength

Specifies the length in pixels of minor tick marks associated with the horizontal axis. Specify a positive value to have the tick marks drawn inside the grid frame or a negative value to have the tick marks drawn outside the grid frame.

XmNhorizontalStart

Specifies the starting value in user coordinates of the horizontal axis.

XmNlabelForeground

Specifies the pixel used to draw the horizontal and vertical labels.

XmNleftAnnotationAngle

Specifies the angle of rotation to apply when drawing the left annotation. Specify a value between -360 and 360. An XWindow font will be used to draw the annotation when this resource is set to 0, a stroke font will be used otherwise.

XmNleftMargin

Specifies the margin, in pixels, between the left of the window and the left of the widget's display area. This area may contain the vertical annotation and vertical label. This resource is set automatically if resource XmNautoMarginAdjust is set to XintADJUST_ALL or XintADJUST_LEFT.

XmNresizeCallback

Specifies a list of callbacks to be called when the Grid widget window is resized.

XmNrightAnnotationAngle

Specifies the angle of rotation to apply when drawing the right annotation. Specify a value between -360 and 360. An XWindow font will be used to draw the annotation when this resource is set to 0, a stroke font will be used otherwise.

XmNrightMargin

Specifies the margin, in pixels, between the left of the window and the left of the widget's display area. This area may contain the vertical annotation and vertical label. This resource is set automatically if resource XmNautoMarginAdjust is set to XintADJUST_ALL or XintADJUST_RIGHT.

XmNroundAnnotation

Specifies whether annotation is placed at a multiple of the increment (True) or at the starting value plus multiples of the increment (False).

XmNtextThreeD

Specfies whether the widget's labels and title are drawn with a shadow so that they have a 3-dimensional appearance. The default is False indicating that they will not have a 3-dimensional appearance.

XmNtitleAlignment

Specifies the alignment of the lines of the title if it has more than one line. Multiple lines can be specified by inserting special character `\n' between each line in the title string. You can specify one of the following constants:

Defined ConstantDescription
XintALIGNMENT_BEGINNINGLines of the title are left adjusted.
XintALIGNMENT_CENTERLines of the title are centered.
XintALIGNMENT_ENDLines of the title are right adjusted.


XmNtitleBackground

Specifies the pixel value used to draw the background of the title.

XmNtitleFont

Specifies the name of the font used to draw the title.

XmNtitleForeground

Specifies the pixel value used to draw the foreground of the title.

XmNtitlePlacement

Specifies the placement of the title string. You can specify one of the following constants:

Defined ConstantDescription
XintPLACEMENT_NONEThe title is not drawn.
XintPLACEMENT_TOP (default)The title is drawn above the widget's window.
XintPLACEMENT_BOTTOMThe title is drawn at the bottom of the widget's window.


XmNtitleShadowType

Specifies the type of shadow to draw around the title. You can specify one of the following constants:

Defined ConstantDescription
XintSHADOW_NONENo shadow is drawn.
XintSHADOW_INShadow drawn so that title appears inset.
XintSHADOW_OUTShadow drawn so that tile appears outset.
XintSHADOW_ETCHED_INShadow drawn using a double line inset.
XintSHADOW_ETCHED_OUTShadow drawn using a double line outset.


XmNtitleString

Specifies the string used to draw the title. The color, font and location of the title string can be specified using resources XmNtitleFont, XmNtitleForeground and XmNtitlePlacement.

XmNtopAnnotationAngle

Specifies the angle of rotation to apply when drawing the top annotation. Specify a value between -360 and 360. An XWindow font will be used to draw the annotation when this resource is set to 0, a stroke font will be used otherwise.

XmNtopMargin

Specifies the margin, in pixels, between the top of the widget window and the top of the widget's display window. This area may contain the horizontal annotation, horizontal label and title. This resource is automatically set by the widget when the value of the resource XmNautoMarginAdjust is XintADJUST_ALL or XintADJUST_TOP.

XmNverticalAnnotationForeground

Specifies the color (as a Pixel value) used to draw the vertical annotation.

XmNverticalAnnotationFormat

Specifies the format used to draw the vertical annotation. Use any C format descriptor (e.g. "%5.2f") for displaying floating point data.

XmNverticalAnnotationPlacement

Specifies the placement of vertical annotation. You can specify one the following constants:

Defined ConstantDescription
XintPLACEMENT_NONEVertical annotation is not displayed.
XintPLACEMENT_RIGHTVertical annotation is displayed to the right of the Grid frame.
XintPLACEMENT_LEFTVertical annotation is displayed to the left of the Grid frame.
XintPLACEMENT_LEFT_RIGHT (default)Vertical annotation is displayed left and right of the Grid frame.
XintPLACEMENT_INSIDEVertical annotation is drawn inside the Grid frame at the location specified by resource XmNverticalAnnotationPosition.

The constants listed above can be combined with an arithmetic addition or logical OR operation. For example, to draw annotation both on the right and also inside the Grid frame area, specify the following: XintPLACEMENT_RIGHT + XintPLACEMENT_INSIDE.


XmNverticalAnnotationPosition

Specifies the location at which to draw the vertical annotation within the Grid frame when the resource XmNverticalAnnotationPlacement includes the value XintPLACEMENT_INSIDE. This value can be positive or negative with respect to XmNverticalStart.

XmNverticalAxisType

Specifies the type of axis in the vertical direction. Specify XintLINEAR for a linear axis or XintLOG for a logarithmic axis.

XmNverticalDirection

Specifies the orientation of the vertical axis. Specify XintSTART_TO_END to have the vertical starting value located at the top of the axis or XintEND_TO_START to have the vertical ending value located at the top of the axis.

XmNverticalEnd

Specifies the axis ending value in user coordinates in the vertical direction.

XmNverticalLabel

Specifies a single or multiple line string that provides labelling for the vertical annotation. The label placement is controlled by resource XmNverticalLabelPlacement.

XmNverticalLabelAlignment

Specifies the alignment of each line of the vertical label. Multiple lines can be specified by inserting the special character `\n' between lines in the label string. Label lines are adjusted in respect to the vertical label area, which is the same height as the widget's display area. For a vertical label, beginning alignment means the lines are justified to the top of the widget's display area and continue downward. End alignment means these lines will be justified to the bottom of the widget's display area and continue upward. You can specify one of the following constants:

Defined ConstantDescription
XintALIGNMENT_BEGINNINGLines of the label are aligned with the top of the widget's display area.
XintALIGNMENT_CENTERLines of the label are centered.
XintALIGNMENT_ENDLines of the label are aligned with the bottom of the widget's display area.


XmNverticalLabelFont

Specifies the name of a font used to draw the vertical label specified by the resource XmNverticalLabel.

XmNverticalLabelOrientation

Specifies the orientation of the label string. Specify the constant XintPARALLEL_TO_AXIS to have the label rotated 90 degrees from the horizontal and placed along the vertical axis, or the constant XintSTACKED to have the letters of the label stacked vertically.

XmNverticalLabelPlacement

Specifies the placement of the vertical label. You can specify one of the following constants:

Defined ConstantDescription
XintPLACEMENT_LEFTThe vertical label is drawn left of the widget's display area.
XintPLACEMENT_RIGHTThe vertical label is drawn right of the widget's display area.
XintPLACEMENT_LEFT_RIGHTThe vertical label is drawn both left and right of the widget's display area.


XmNverticalMajorAnnotation

Specifies whether or not to draw major annotation in the vertical direction.

XmNverticalMajorAnnotationFont

Specifies the name of the font used to draw the major annotation in the vertical direction.

XmNverticalMajorGridLineStyle

Specifies the line style used to draw the major grid lines corresponding to the vertical axis. Use one of the following constants:

Resource ValueDescription
XintGRID_LINE_NONENo grid lines are drawn.
XintGRID_LINE_SOLID (default)Grid lines are drawn using a solid line.
XintGRID_LINE_DASHEDGrid lines are drawn using a on-off dash pattern.
XintGRID_LINE_DOUBLE_DASHEDGrid lines are drawn using a double dashed pattern.
XintGRID_LINE_SHADOW_INGrid lines are drawn using reversed shadow colors.
XintGRID_LINE_SHADOW_OUTGrid lines are drawn using the bottom and top shadow colors.


XmNverticalMajorIncrement

Specifies the major increment, as a positive value, in the vertical direction.

XmNverticalMajorThickness

Specifies the width, in pixels, of major grid lines associated with the vertical axis.

XmNverticalMajorTickLength

Specifies the length, in pixels, of major tick marks associated with the vertical axis. Specify a positive value to have the tick marks drawn inside the grid frame or a negative value to have the tick marks drawn outside the grid frame.

XmNverticalMinorAnnotation

Specifies whether or not to draw vertical minor annotation. The default value is True, indicating that the vertical minor annotation is to be drawn.

XmNverticalMinorAnnotationFont

Specifies the name of a font used to draw minor annotation in the vertical direction.

XmNverticalMinorGridLineStyle

Specifies the line style used to draw the minor grid lines corresponding to the vertical axis. Use one of the following constants:

Resource ValueDescription
XintGRID_LINE_NONENo grid lines are drawn.
XintGRID_LINE_SOLID (default)Grid lines are drawn using a solid line.
XintGRID_LINE_DASHEDGrid lines are drawn using a on-off dash pattern.
XintGRID_LINE_DOUBLE_DASHEDGrid lines are drawn using a double dashed pattern.
XintGRID_LINE_SHADOW_INGrid lines are drawn using reversed shadow colors.
XintGRID_LINE_SHADOW_OUTGrid lines are drawn using the bottom and top shadow colors.


XmNverticalMinorIncrement

Specifies the minor increment, as a positive value, in the vertical direction.

XmNverticalMinorThickness

Specifies the width, in pixels, of minor grid lines associated with the vertical axis.

XmNverticalMinorTickLength

Specifies the length, in pixels, of minor tick marks associated with the vertical axis. Specify a positive value to have the tick marks drawn inside the grid frame or a negative value to have the tick marks drawn outside the grid frame.

XmNverticalStart

Specifies the starting value, in user coordinates, of the horizontal axis.

Constraint Resources

The following constraint resources are defined by the Grid widget class. These resources can be applied to specify the location of Axis widgets created as children of a Grid widget.
NameTypeDefaultAccess
XmNaxisOffsetint5CSG
XmNpercentEndint100CSG
XmNpercentStartint0CSG
XmNplacementintdynamicCSG


XmNaxisOffset

Specifies the offset in pixels between the Grid widget annotation area and the Axis widget.

XmNpercentEnd

Specifies the ending location of the Axis widget as a percentage. Specify 100 to have the Axis widget extend to the end of the Grid widget.

XmNpercentStart

Specifies the starting location of the Axis widget as a percentage. Specify 0 to have the Axis widget start at the beginning of the Grid widget.

XmNplacement

Specifies the location of the Axis widget. You can specify one of the following constants:

Resource ValueDescription
XintPLACEMENT_TOPThe Axis widget is created above the Grid top annotation area. The Axis widget must be horizontal.
XintPLACEMENT_BOTTOMThe Axis widget is created under the Grid bottom annotation area. The Axis widget must be horizontal.
XintPLACEMENT_LEFTThe Axis widget is created left of the Grid left annotation area. The Axis widget must be vertical.
XintPLACEMENT_RIGHTThe Axis widget is created right of the Grid right annotation area. The Axis widget must be vertical.


Defined Actions

The Grid widget class inherits all of the action routines defined by the superclass EditObject. Refer to the EditObject widget class reference section for a description of the action routines. In addition, the Grid widget class defines the action routines listed below. Both the inherited and defined actions can be tied to user event sequences via a translation table.

NameDescription
Highlight()Highlights the color of the title string to that color specified as the value of resource XmNhighlightColor.
UnHighlight()Returns the color of the title string to its original color.


Default Translations

The following translation table is used by a Grid widget. These default translations can be overridden by the end-user or application programmer.

Event SequenceActions Invoked
<EnterWindow>ManagerEnter() InitDrawCursor()
<LeaveWindow>ManagerFocus() EndDrawCursor()
<FocusIn>ManagerFocusIn() Highlight()
<FocusOut>ManagerFocusOut() UnHighlight()
Ctrl <Key>kChangeCursorMask()
!Shift <Key> TabPreviousTabGroup()
None <Key> TabNextTabGroup()
!Shift <Btn1Down>TraverseCurrent() Locator() SelectionCallback() InitAreaSelection(callback) ObjectEditEnd()
!Ctrl <Btn1Down>TraverseCurrent() Locator() SelectionCallback() InitAreaSelection(extend) ObjectSelect(extend)
None <Btn1Down>TraverseCurrent() ObjectSelect(single) ObjectEditStart() Locator() SelectionCallback() InitAreaSelection(single)
None <Btn2Down>ObjectEditEnd(m) SelectionCallback()
None <BtnDown>SelectionCallback()
<Btn1Up>EndAreaSelection() ObjectEditEnd()
<PtrMoved>DrawCursor() ExtendAreaSelection() ObjectEdit() Locator()


Defined Callbacks

The following callbacks are defined (or inherited) by the Grid widget class:

NameStructureReason
XmNareaSelectionCallbackXintGridAreaSelectionCallbackStructXintCR_AREA_SELECTION
XmNexposeCallbackXintCallbackStructXintCR_EXPOSE
XmNlocatorCallbackXintGridLocatorCallbackStructXintCR_LOCATOR
XmNresizeCallbackXintCallbackStructXintCR_RESIZE
XmNselectionCallbackXintGridLocatorCallbackStructXintCR_SELECTION


XintGridAreaSelectionCallbackStruct

The following ordered table lists the members of the callback structure XintGridAreaSelectionCallbackStruct returned to each procedure in the callback list specified by the resource XmNareaSelectionCallback.

Data TypeMemberDescription
intreasonIndicates why the callback was invoked.
XEvent *eventPoints to the XEvent that triggered the callback.
intx_startX coordinate of the upper left corner of the selected rectangle in pixel units.
inty_startY coordinate of the upper left corner of the selected rectangle in pixel units.
intx_endX coordinate of the lower right corner of the selected rectangle in pixel units.
inty_endY coordinate of the lower right corner of the selected rectangle in pixel units.
floatuser_x_startX coordinate of the upper left corner of the selected rectangle in user units.
floatuser_y_startY coordinate of the upper left corner of the selected rectangle in user units.
floatuser_x_endX coordinate of the lower right corner of the selected rectangle in user units.
floatuser_y_endY coordinate of the lower right corner of the selected rectangle in user units.


XintCallbackStruct

The following ordered table lists the members of the callback structure XintCallbackStruct used by the Grid widget for the expose and resize callbacks.

Data TypeMemberDescription
intreasonIndicates why the callback was invoked.
XEvent *eventPointer to the XEvent that triggered the callback.
WindowwindowWindow ID of the Grid widget.


XintGridLocatorCallbackStruct

The following ordered table lists the members of the callback structure XintGridLocatorCallbackStruct returned to each procedure in the callback list specified by resource XmNlocatorCallback.

Data TypeMemberDescription
intreasonIndicates why the callback was invoked.
XEvent *eventPoints to the XEvent that triggered the callback.
intpixel_xThe X location of the cursor in the window coordinate system.
intpixel_yThe Y location of the cursor in the window coordinate system.
floatuser_xThe X location of the cursor in the user coordinate system.
floatuser_yThe Y location of the cursor in the user coordinate system.
Booleaninside_frameTrue if the cursor is inside the grid's frame and False otherwise.


Area selection callback

This list of callback procedures, inherited from the EditObject class, is called whenever an area is selected inside a Grid widget's window using the area selection action routines.The callback structure returned by this callback is redefined by the Grid class.

Expose callback

This list of callback procedures is called whenever the Grid widget's window is exposed so that the application can redraw anything that it displays in the Grid widget's window.

Locator callback

This list of callback procedures, inherited from the EditObject class, is called by the Locator action when the cursor is moved inside a Grid widget's window. The callback structure returned by this callback is redefined by the Grid class.

Resize callback

This list of callback procedures is called whenever the Grid widget window is resized so that the application can resize anything that is displaying in the Grid widget's window.

Selection callback

This list of callback procedures, inherited from the EditObject class, is called when the user presses one of the mouse buttons inside the widget window. The callback structure returned by this callback is redefined by the Grid class.

Defined Functions

The following functions are defined by the Grid widget class.

Function NameDescription
XintCreateGridCreates an unmanaged Grid widget.
XintGridZoomPerforms a zoom operation for a widget whose class is derived from the XintGrid widget class.


XintCreateGrid

This function creates an unmanaged Grid widget.

     Widget XintCreateGrid (...)

Widgetparent Parent of the new Grid widget.
char *nameName of the new Grid widget.
ArgListarglistList of resource/value items.
CardinalargcountNumber of items in arglist.


XintGridZoom

Causes a selected area of a widget's displayed image to be zoomed. The widget must be an instance of the XintGrid widget class or a class derived from the Grid widget class. The area to be scaled must have been previously selected and returned to the application via an area selection callback. The zoom operation can be performed so that the scaled image replaces the previous image displayed by the widget. Alternatively, a new widget can be created to display the scaled area.

     Widget XintGridZoom (...)

WidgetwidgetWidget ID of the widget containing the area to be scaled.
WidgetparentSpecify the parent's widget ID so that a new widget will be created as a child of the widget's parent, to display the zoomed area, or specify NULL so that the original widget will be used to display the zoomed area.
XintGridAreaSelectionCallbackStruct *selectionSpecify the address of an XintGridAreaSelectionCallback structure that indicates the area to be zoomed, or specify NULL to indicate that the currently displayed area in the widget is the area to be zoomed.
floatzxThe horizontal scale factor to be used to zoom the selected area.
floatzyThe vertical scale factor to be used to zoom the selected area.

This function returns the widget ID of the widget containing the zoomed area (i.e., the original widget or the new widget) if it is successful. Otherwise, it returns NULL.