XbaeMatrix

NAME
SYNOPSIS
DESCRIPTION
Classes
New Resources
Inherited Resources
Callback Information
Translations
Action Routines
Type Converters
Public Functions
Additional Behavior
Virtual Bindings
AUTHOR
SPECIAL THANKS
RELEASE
SEE ALSO
Notice of Limitation

NAME

XbaeMatrix − The Bellcore Application Environment (BAE) XbaeMatrix widget class.

SYNOPSIS

#include <Xbae/Matrix.h>

DESCRIPTION

XbaeMatrix presents an editable array of string data to the user in a scrollable grid-like format similar to a spreadsheet. Non editable pixmaps can also be displayed on the matrix. The rows and columns of the Matrix may optionally be labeled. Also, a number of fixed leading or trailing rows or columns may be specified - these behave similarly to the labels. While XbaeMatrix looks and acts like a grid of XmText widgets, it actually contains only one XmText. This means that XbaeMatrix widgets with hundreds or thousands of rows have much less overhead than they would if they used an XmText for each cell.

Clicking on a cell with Button1 will edit the cell. While a cell is being edited, Tab and Shift-Tab will edit the cell to the right or left respectively. The osfUp and osfDown keys will edit the cell above or below. Ctrl-Tab and Shift-Ctrl-Tab will traverse out of the Matrix and into the next or previous tab groups.

The osfCancel key will cancel any edits made to a cell. The osfActivate key will commit any edits made to a cell and store them in the Matrix. When traversing from another tab group into the Matrix, the focus will go to whichever cell is currently being edited. If no cells are being edited, then the upper left most visible non-fixed cell will be edited.

The column sizes may be dynamically resized by pressing the Shift-Button2 combination when over a column boundary, similar to the behaviour of some popular spreadsheets. After a column has been resized in this manner, the XbaeMatrix calls the callbacks on the XmNresizeColumnCallback callback list for post processing.

If the Matrix is resized until it is too small to display all of the cells in a given dimension, then it will display a ScrollBar for that dimension. The horizontal ScrollBar will scroll the cells and column labels, but not the row labels, fixed columns or trailing fixed columns. The vertical ScrollBar will scroll the cells and row labels, but not the column labels, fixed rows or trailing fixed rows.

For the application programmer, XbaeMatrix provides callbacks to assist in data validation. The callbacks on the XmNmodifyVerifyCallback callback list are called before text is inserted into, or deleted from, a cell. This callback list can be used to force user input to match a certain pattern (e.g. a date format). Similarly, the XmNvalueChangedCallback is called after text is inserted or deleted.

When a cell is edited (by clicking on it or tabbing into it), the XmNleaveCellCallback callbacks are called for the previous cell being edited, if any. The application can verify the data entered in that cell and disallow editing of the new cell if the data is invalid. If the data was valid, then the XmNenterCellCallback callbacks for the new cell are called. These callbacks can be used to specify the editability of the new cell.

The XmNtraverseCellCallback callbacks are also called when the user attempts to edit a new cell. This allows the application to override the default traversal behavior of XbaeMatrix.

The XmNdefaultActionCallback is provided to allow a double click action in a cell to perform some function.

Motif’s Drag and Drop functionality can be achieved via the XmNprocessDragCallback.

For large amounts of data, the overhead of assigning data to the widget can be avoided using the XmNdrawCellCallback. This callback also allows user defined pixmaps to be placed in a certain cell. When using this callback, data for string fields can be written back to the application by using the XmNwriteCellCallback.

Classes

XbaeMatrix inherits behavior and resources from the Core, Composite, Constraint, and XmManager widget classes.
The class pointer is xbaeMatrixWidgetClass.
The class name is XbaeMatrix.

New Resources

The following table lists the new resources defined by XbaeMatrix. The codes in the ‘‘Access’’ column indicate whether the given resource can be set at creation time (C), or set by using XtSetValues (S), or retrieved by using XtGetValues (G).

This resource cannot be specified in a resource file

XmNallowColumnResize

If True, allows the columns to be dynamically resized via the ResizeColumns() action. The default value is to allow column resizing.

XmNallowRowResize

If True, allows the rows to be dynamically resized via the ResizeRows() action. The default value is to allow row resizing.

XmNaltRowCount

Specifies the number of rows to use for each of the XmNevenRowBackground and XmNoddRowBackround colors. This resource is ignored if XmNevenRowBackground and XmNoddRowBackround are not used.

XmNboldLabels

Overstrikes the row and column labels to create a bold font appearance when True. If False, the labels will appear the same as the text in the cells. This resource will be overriden and set to False if XmNlabelFont is set.

XmNbuttonLabels

When set to True, the labels will be drawn with a shadow around them similar to an XmPushButton widget. A ButtonPress event generated on the labels, when XmNbuttonLabels is True will cause the label to reverse the shadow and take on a pushed in appearance. A ButtonRelease event on the same label will invoke callbacks on the XmNlabelActivateCallback, list. The default value is False.

XmNbuttonLabelBackground

Specifies a Pixel value in which to draw the XmNbuttonLabels.

XmNcalcCursorPosition

If set to True, the insertion position on the text field is calculated with respect to where the pointer was clicked in the cell. The default value is False. The insertion position will be overridden if the position member of the XbaeEnterCellCallbackStruct is set to a valid position.

XmNcellBackgrounds

Points to an array of pointers to rows. Each row is an array of Pixel values, one for each column in that row. This data structure is the same as that for XmNcells, except each entry is a Pixel instead of a String. The background of a cell will be drawn in the color specified for that cell. If XmNcellBackgrounds is NULL, backgrounds will be drawn using the color specified by XmNbackground. This resource is copied. XmNcellBackgrounds may be specified in a resource file but due to the two dimensional nature of the XbaeMatrix widget, it must be done by terminating each line with a \n character. If the XbaeMatrix widget had XmNrows set to 5 and XmNcolumns set to 5, XmNcellBackgrounds would be specified as:

Care must be taken when specifying these values in a resource file as an incorrect format can produce undesirable results.

XmNcellHighlightThickness

Specifies the XmNhighlightThickness resource of the XmText cell edit widget. This resource is also used to compute the size of each cell. See the description of XmNhighlightThickness in XmText(3X).

XmNcellMarginHeight

Specifies the XmNmarginHeight resource of the XmText widget. This resource is also used to compute the size of each cell. See the description of XmNmarginHeight in XmText(3X).

XmNcellMarginWidth

Specifies the XmNmarginWidth resource of the XmText cell edit widget. This resource is also used to compute the size of each cell. See the description of XmNmarginWidth in XmText(3X).

XmNcellShadowThickness

Specifies the XmNshadowThickness resource of the XmText cell edit widget. This resource is also used to compute the size of each cell. See the description of XmNshadowThickness in XmText(3X).

XmNcellShadowType

Specifies the type of shadow drawn around each cell. Possible values for this resource are XmSHADOW_OUT, XmSHADOW_IN, XmSHADOW_ETCHED_OUT, and XmSHADOW_ETCHED_IN. The default shadow type is XmSHADOW_OUT.

XmNcellShadowTypes

Specifies on a per cell basis, the XmNcellShadowType. Values for the resource are the same as for XmNcellShadowType. This resource is copied.

XmNcellUserData

Points to an array of pointers to individual user defined data areas associated with each cell. The data should be set using XbaeMatrixSetCellUserData() and retrieved using XbaeMatrixGetCellUserData(). This resource cannot be specified in a resource file and is copied.

XmNcells

Points to an array of pointers to rows. Each row is an array of String, one for each column in that row. For example, the cells for a 2x3 Matrix could be set up as follows:

Now cells could be used as the XmNcells resource. If XmNcells is NULL, XbaeMatrix will not generate an internal table of empty Strings. This implies that if XmNcells is NULL, no cells have been set. This resource is copied. See the discussion in XmNcellBackgrounds for how to specify XmNcells in a resource file.

XmNclipWindow

The widget ID of the clip window. The clip window is the widget that contains the non-fixed region of cells. This resource can not be set to a new value.

XmNcolors

Points to an array of pointers to rows. Each row is an array of Pixel values, one for each column in that row. This data structure is the same as that for XmNcells, except each entry is a Pixel instead of a String. The text in a cell will be drawn in the color specified for that cell. If XmNcolors is NULL, text will be drawn using the color specified by XmNforeground. This resource is copied. See the discussion in XmNcellBackgrounds for how to specify XmNcolors in a resource file.

XmNcolumnAlignments

Points to an array of alignments (unsigned char), one for each column. Each element can be one of XmALIGNMENT_BEGINNING, XmALIGNMENT_CENTER or XmALIGNMENT_END. This specifies the alignment of the text or pixmap in each cell of that column. See the description of XmNalignment for XmLabel(3X). If XmNcolumnAlignments is NULL, each column will default to XmALIGNMENT_BEGINNING. This resource is copied.

XmNcolumnButtonLabels

An array of Booleans that tells the XbaeMatrix which column labels should be drawn as a button. Each Boolean can be specified as a Boolean string or integer. In order to use this resource, XmNbuttonLabels should be set to False.

XmNcolumnLabelAlignments

Points to an array of alignments (unsigned char), one for each column label. Each element can be one of XmALIGNMENT_BEGINNING, XmALIGNMENT_CENTER or XmALIGNMENT_END. This specifies the alignment of the text of each column label. See the description of XmNalignment for XmLabel(3X). If XmNcolumnLabelAlignments is NULL, each column label will default to XmALIGNMENT_BEGINNING. This resource is copied.

XmNcolumnLabelColor

Specifies a Pixel value in which to draw the XmNcolumnLabels.

XmNcolumnLabels

Points to an array of Strings to be drawn above each column. Each String may have embedded newline characters, in which case the label will be drawn on multiple lines. If XmNcolumnLabels is NULL, no labels will be drawn. This resource is copied.

XmNcolumnMaxLengths

Points to an array of int, one for each column. These specify the maximum length of a String which can be entered in the cells in that column. See the description of the XmText(3X) XmNmaxLength resource. If XmNcolumnMaxLengths is NULL, then the corresponding width from XmNcolumnWidths is used. This resource is copied.

XmNcolumnShadowTypes

Specifies on a per column basis, the XmNcellShadowType. Values for the resource are the same as for XmNcellShadowType. This resource is copied.

XmNcolumnUserData

Points to a user defined data area associated with a particular column. The data should be set using XbaeMatrixSetColumnUserData() and retrieved using XbaeMatrixGetColumnUserData(). This resource cannot be specified in a resource file.

XmNcolumnWidths

Points to an array of short, one for each column. These specify the visible width the cells in each column. See the description of the XmText(3X) XmNcolumns resource. XmNcolumnWidths must not be NULL. This resource is copied.

XmNcolumns

Specifies the total number of columns of cells. XmNcolumns must be at least one. If the number of columns is changed via XtSetValues, then XmNcolumnWidths must change, XmNcolumnMaxLengths must change or be NULL, XmNcolumnLabels must change or be NULL, XmNcolumnAlignments must change or be NULL and XmNcolumnLabelAlignments must change or be NULL. The preferred way to dynamically change the number of columns is to use XbaeMatrixAddColumns() or XbaeMatrixDeleteColumns().

XmNdefaultActionCallback

Specifies a list of callbacks to be called when a double click occurs in a cell. A pointer to an XbaeMatrixDefaultActionCallbackStruct is passed to the callbacks. Events are reported to the cell in which the double click occurs regardless of whether or not a callback exists. This callback is called by the DefaultAction() action and is NULL by default. The XmNdefaultActionCallback is ideal for popping up a dialog or other window when a double click occurs.

XmNdoubleClickInterval

Specifies the amount of time between mouse clicks before it is considered a double click. A double click is defined to be the time between the realease of the mouse button and subsequent press in the same cell. The default value is inherited from the display.

XmNdrawCellCallback

Specifies a list of callbacks to be called when a cell needs to be drawn. A pointer to an XbaeMatrixDrawCellCallbackStruct is passed to the callbacks. The application can specify what to put in a cell by modifying the callback struct’s data fields. When the application callback returns to the widget code, the type field will determine what the widget draws on the screen. If the value is XbaeString, then the regular string drawing function for the widget will be called with the value the applicaton assigned to the string field in the struct. Else, if the value is XbaePixmap, the widget will do an XCopyPlane(), in the case of a single plane bitmap, or XCopyArea(), in the case of a color pixmap. The width and height of cell is passed in the struct so the application can know how big to make the pixmap. In neither case will a copy of the string or the pixmap value be made. The widget also uses the XmNcolumnAlignments resource to determine the horizontal alignment of the Pixmap. To have an editable array of data when the XmNdrawCellCallback is used and the cell is of type XbaeString, use the XmNwriteCellCallback.

XmNenterCellCallback

Specifies a list of callbacks to be called immediately before a cell is to be edited. This callback list is called by the EditCell() action. A pointer to an XbaeMatrixEnterCellCallbackStruct is passed to the callbacks. The application can specify the editability of specific cells using this callback list as well as specifying configuration options for the XmText.

XmNevenRowBackground

Specifies a background cell Pixel value to use on even rows. This allows the matrix to look like computer paper. For wider bands of color, increase the size of XmNaltRowCount.

XmNfill

If True, controls whether the matrix should fill all of its available space when additional space if available, or if it should simply size itself as large as necessary, regardless of any additonal available space.

XmNhorzFill

If True, controls whether the matrix should highlight available space on the right of the selected cell(s) when the selected cell(s) are in the last column of the matrix.

XmNvertFill

If True, controls whether the matrix should highlight available space below the selected cell(s) when the selected cell(s) are in the last row of the Matrix.

XmNfixedColumns

Specifies the number of leading columns (starting from the left column) which should not be horizontally scrollable. XmNfixedColumns must be less than XmNcolumns-XmNtrailingFixedColumns. Cells in fixed columns are not editable unless XmNtraverseFixedCells is set to True.

XmNfixedRows

Specifies the number of leading rows (starting from the top row) which should not be vertically scrollable. XmNfixedRows must be less than XmNrows-XmNtrailingFixedRows. Cells in fixed rows are not editable unless XmNtraverseFixedCells is set to True.

XmNfontList

Specifies the font list to be used for the text displayed in the cells and the XmText cell edit widget. See XmFontListCreate(3X) to create a font list. This resource is copied. The preferred way of specifying a font for the table is in a resource file.

XmNgridLineColor

Specifies the color in which the grid line should be drawn if XmNgridType is set to XmGRID_CELL_LINE, XmGRID_ROW_LINE or XmGRID_COLUMN_LINE. The default is that of XmNforeground.

XmNgridType

Sets the way the matrix grid is drawn. The grid types available include XmGRID_NONE, XmGRID_CELL_LINE, XmGRID_CELL_SHADOW, XmGRID_ROW_LINE, XmGRID_ROW_SHADOW, XmGRID_COLUMN_LINE and XmGRID_COLUMN_SHADOW. All of the grid types vary the way the shadow or line is drawn around the cell. XmGRID_ROW_LINE, XmGRID_ROW_SHADOW, XmGRID_COLUMN_LINE, and XmGRID_COLUMN_SHADOW only draw a border around the rows and columns, giving a more tabular rather than spreadsheet appearance. The default is XmGRID_CELL_LINE which draws a solid line around the cells.

XmNhighlightedCells

Points to an array of pointers to rows. Each row is an array of unsigned char values, one for each column in that row. This data structure is the same as that for XmNcells, except each entry is an unsigned char instead of a String. Each entry in the array will have a value that is either HighlightNone, HighlightCell, HighlightRow, HighlightColumn, HighlightOther or the bitwise OR of those values, depending on the value of XmNgridType and which call was used to highlight the cell. A cell will be drawn as highlighted if the corresponding unsigned char does not have the value HighlightNone. If XmNhighlightedCells is NULL, XbaeMatrix then no cells have been highlighted. This resource is copied, and cannot be specified in a resource file.

XmNhorizontalScrollBar

The widget ID of the horizontal XmScrollBar. This resource exists only for those applications that need to tie another scrollbar to the matrix’s for synchronized scrolling. This resource can not be set to a new value.

XmNhorizontalScrollBarDisplayPolicy

Determines when to display a horizontal scrollbar in the matrix. Possible values are XmDISPLAY_NONE, which makes the matrix never display the scrollbar, XmDISPLAY_AS_NEEDED, which makes the matrix display the scrollbar when the list is too large, and XmDISPLAY_STATIC, which makes the matrix always display the scrollbar.

XmNlabelFont

Specifies the font list to be used for the text displayed in the row and column labels. If XmNlabelFont is not specified, the value of XmNfontList is copied and used for the label fonts. If XmNboldLabels is set, this resource will override the value and set it to False. See XmFontListCreate(3X) to create a font list. This resource is copied. The preferred way of specifying a font for the labels is in a resource file.

XmNlabelActivateCallback

Specifies a list of callbacks to be called after a button label has been pressed. A pointer to an XbaeMatrixLabelActivateCallbackStruct is passed to the callbacks on this list.

XmNleaveCellCallback

Specifies a list of callbacks to be called immediately after a cell has been edited. This callback list is called by the EditCell() and CommitEdit() actions. A pointer to an XbaeMatrixLeaveCellCallbackStruct is passed to the callbacks. The application can perform cell specific data checks using this callback list.

XmNleftColumn

Allows the programmer to specify the first non fixed column to appear on the leftmost side of the matrix. This resource compliments the XmNtopRow resource. See the discussion of XmNtopRow for more details.

XmNmodifyVerifyCallback

Specifies a list of callbacks to be called before text is deleted from or inserted into the XmText cell edit widget. A pointer to an XbaeMatrixModifyVerifyCallbackStruct is passed to the callbacks. See the description of the XmText(3X) XmNmodifyVerifyCallback resource.

XmNmultiLineCell

is a boolean (default False) which specifies whether the matrix displays more than one line of text in a cell, when appropriate.

XmNoddRowBackground

Specifies a background cell color to use on odd rows. This allows the matrix to look like computer paper. For wider bands of color, increase the size of XmNaltRowCount.

XmNprocessDragCallback

Specifies a list of callbacks to be called from the ProcessDrag() action A pointer to an XbaeMatrixProcessDragCallbackStruct will be passed to the callbacks. The application can use this callback list to perform particular processing during a drag.

XmNresizeCallback

Specifies a list of callbacks to be called when the matrix is resized.

XmNresizeColumnCallback

Specifies a list of callbacks to be called when a column is dynamically resized by the user.

XmNreverseSelect

Overrides the default XmNselectedForeground and XmNselectedBackground and draws a selected cell in the colours specified by XmNcellBackgrounds and XmNcolors for the particular cell. If these values are not set then the default colours will be used.

XmNrowButtonLabels

An array of Booleans that tells the XbaeMatrix which row labels should be drawn as a button. Each Boolean can be specified as a Boolean string or integer. In order to use this resource, XmNbuttonLabels should be set to False.

XmNrowLabelAlignment

Specifies the alignment of the row labels. It can be one of XmALIGNMENT_BEGINNING, XmALIGNMENT_CENTER or XmALIGNMENT_END. See the description of XmNalignment for XmLabel(3X). XmNrowLabelAlignment defaults to XmALIGNMENT_END.

XmNrowLabelColor

Specifies a Pixel value in which to draw the XmNrowLabels.

XmNrowLabelWidth

Specifies the width of the row labels. XmNrowLabelWidth defaults to the width of the longest row label.

XmNrowLabels

Points to an array of Strings to be drawn to the left of each row. If XmNrowLabels is NULL, no labels will be drawn. This resource is copied.

XmNrowShadowTypes

Specifies on a per row basis, the XmNcellShadowType. Values for the resource are the same as for XmNcellShadowType. This resource is copied.

XmNrowUserData

Points to a user defined data area associated with a particular row. The data should be set using XbaeMatrixSetRowUserData() and retrieved using XbaeMatrixGetRowUserData(). This resource cannot be specified in a resource file.

XmNrows

Specifies the total number of rows of cells. XmNrows must be at least one. If the number of rows is changed via XtSetValues, then XmNrowLabels must change or be NULL. The preferred way to dynamically change the number of rows is to use XbaeMatrixAddRows() or XbaeMatrixDeleteRows().

XmNscrollBarPlacement

Determines where the scrollbars will be drawn. See the discussion of XmNscrollBarPlacement in XmScrolledWindow(3) for a complete discussion on this resource.

XmNselectCellCallback

Specifies a list of callbacks to be called from the SelectCell() action. A pointer to an XbaeMatrixSelectCellCallbackStruct will be passed to the callbacks. The application can use this callback list to perform selection/deselection of cells using the provided widget methods.

XmNselectScrollVisible

Specifies whether the matrix will scroll to make the selected cell visible. This flag is only checked when cells are selected programmatically, as when the user selects a cell with the mouse, it will already be visible.

XmNselectedBackground

Allows the background of selected cells in XmNselectedCells to be specified.

XmNselectedCells

Points to an array of pointers to rows. Each row is an array of Boolean values, one for each column in that row. This data structure is the same as that for XmNcells, except each entry is a Boolean instead of a String. A cell will be drawn as selected if the corresponding Boolean is True. If XmNselectedCells is NULL, then no cells have been selected. This resource is copied. It cannot be specified in a resource file.

XmNselectedForeground

Allows the foreground of selected cells in XmNselectedCells to be specified.

XmNshadowType

Specifies the type of shadow drawn around the border of the matrix. Possible values for this resource are XmSHADOW_OUT, XmSHADOW_IN, XmSHADOW_ETCHED_OUT, and XmSHADOW_ETCHED_IN. The default shadow type is XmSHADOW_OUT.

XmNshowArrows

Specifies whether arrows should be drawn when data in a cell has been obscured due to the value of XmNcolumnWidths.

XmNspace

Specifies the distance that separates the ScrollBars from the cell grid. The default value is 4 pixels.

XmNtextBackground

Specifies the background of the XmText cell edit widget. This can be used to make the XmText stand out against a uniformly colored matrix.

XmNtextField

The widget ID of the XmText. This resource cannot be set to a new value.

XmNtextShadowThickness

Specifies the XmNshadowThickness of the XmText. Interesting effects can be achieved by setting the XmNcellHighlightThickness to 0 and replacing the highlight with an indented shadow.

XmNtextTranslations

Specifies the XmNtranslations resource of the XmText cell edit widget. See the description of XmNtranslations in XmText(3X).

XmNtopRow

Specifies the row which should be displayed at the top of the non-fixed rows. XmNtopRow is specified relative to the first non-fixed row, so (XmNfixedRows + XmNtopRow) is the actual row number which will be moved to the top. If (XmNtopRow > (XmNrows - (<number of rows visible> + XmNfixedRows), then the actual row which will be moved to the top is (XmNrows - (<number of rows visible> + XmNfixedRows).

XmNtrackCellCallback

specifies a list of callbacks to be called when the mouse pointer is being moved.

XmNtrailingAttachedBottom

Indicated that any trailing fixed rows should be attached to the bottom of the matrix. This resource only has effect when XmNfill is true and XmNtrailingFixedRows is greater than zero.

XmNtrailingFixedColumns

Specifies the number of trailing columns (starting from the right column) which should not be horizontally scrollable. XmNtrailingFixedColumns must be less than XmNcolumns-XmNfixedColumns. Cells in trailing fixed columns are not editable unless XmNtraverseFixedCells is set to True.

XmNtrailingFixedRows

Specifies the number of trailing rows (starting from the bottom row) which should not be vertically scrollable. XmNtrailingFixedRows must be less than XmNrows-XmNfixedRows. Cells in trailing fixed rows are not editable unless XmNtraverseFixedCells is set to True.

XmNtraverseCellCallback

Specifies a list of callbacks to be called before a new cell is edited. These callbacks are called by the EditCell() action, they are also called when XbaeMatrix receives the focus while the XmText edit widget is unmapped. A pointer to an XbaeMatrixTraverseCellCallbackStruct is passed to the callbacks. The application can specify the next cell which should be edited via this callback list, thereby performing custom traversal.

XmNtraverseFixedCells

If True, this resource allows fixed cells and columns to be edited. The default is to not allow fixed rows or columns to be edited.

XmNuseXbaeInput

This boolean value determines whether to use XbaeInput or XmTextField as the widget used for editing cells. Default is not to use XbaeInput.

XmNvalueChangedCallback

Specifies a list of callbacks to be called after text is deleted from or inserted into the XmText cell edit widget. A pointer to an XbaeMatrixValueChangedCallbackStruct is passed to the callbacks. See the description of the XmText(3X) XmNvalueChangedCallback resource.

XmNverticalScrollBar

The widget ID of the vertical XmScrollBar. This resource exists only for those applications that need to tie another scrollbar to the matrix’s for synchronized scrolling. This resource can not be set to a new value.

XmNverticalScrollBarDisplayPolicy

Determines when to display a horizontal scrollbar in the matrix. Possible values and their effects are listed under XmNhorizontalScrollBarDisplayPolicy.

XmNvisibleColumns

Specifies the number of non-fixed columns which should be visible. The widget will request a size which will allow XmNvisibleColumns columns to be displayed. The programmer should take into allowance any XmNfixedColumns that are specified. This feature becomes even more apparent if the number of XmNfixedColumns changes at runtime as the value may need to be adjusted to avoid a warning.

XmNvisibleRows

Specifies the number of rows which should be visible at any one time. The widget will request a size which will allow XmNvisibleRows rows to be displayed.

XmNwriteCellCallback

Specifies a list of callbacks to be called when a cell value changes and an XmNdrawCellCallback is defined. A pointer to an XbaeMatrixWriteCellCallbackStruct is passed to the callbacks. The XmNwriteCellCallback allows data to be written back into the application’s data structure and must be defined for an editable XbaeMatrix with an XmNdrawCellCallback.

Inherited Resources

The following table lists the resources which XbaeMatrix inherits from it’s superclasses XmManager, Compositeand Core. For a complete description of each resource, refer to the man page for that superclass. The codes in the ‘‘Access’’ column indicate whether the given resource can be set at creation time (C), or set by using XtSetValues (S), or retrieved by using XtGetValues (G).

Callback Information

XbaeMatrixAnyCallbackStruct

A callback struct that is suitable for all callbacks that require the reason, event, row and column to be available. Any callback called may therefore cast the third parameter to the following struct in XbaeMatrix and can rest assured that evrything in it will be available.

Each of the members are set to the appropriate struct for the callback.

If this idea is a little foreign to you, recommended reading is K&R II page 213.

XmNdefaultActionCallback

Callbacks on the XmNdefaultActionCallback list are called when the DefaultAction() action occurs. The application can bind the DefaultAction() action to any pointer based event. When a double click occurs on this pointer event, DefaultAction() will call the callbacks on the XmNdefaultActionCallback list. A pointer to the following structure is passed to each callback on the XmNdefaultActionCallback list:

reason

Set to XbaeDefaultActionReason .

event

The event that invoked this callback.

row

The row number of the cell in which the double click occurred.

column

The column number of the cell in which the double click occurred.

event

If an application has an XmNdefaultActionCallback, then the callbacks on the list will be called when the user clicks twice in a cell within XmNdoubleClickInterval, enabling some action to occur for the particular cell.

XmNdrawCellCallback

Callbacks on the XmNdrawCellCallback list are called when the widget needs to draw a cell. A pointer to the following structure is passed to each callback on the XmNdrawCellCallback list:

reason

Set to XbaeDrawCellReason.

event

Always set to NULL

row

The row number of the cell that needs to be drawn.

column

The column number of the cell that needs to be drawn.

width

The width of the cell that needs to be drawn.

height

The height of the cell that needs to be drawn.

type

The type of ‘‘data’’ the programmer wants drawn in the cell, or which field should be looked at for data to draw: string or pixmap.

string

The string to draw if type is set to XbaeString.

pixmap

The pixmap to copy if type is set to XbaePixmap. It will be clipped to width by height if necessary.

mask

A mask for the pixmap as obtained from the XPM library. mask is only necessary when pixmap has a depth greater than one.

foreground

The foreground color of the cell.

background

The background color of the cell.

depth

The depth of the pixmap image (in bits per pixel).

If the application adds this callback, when the XbaeMatrix determines that a cell at (row, column) needs to be redrawn, the normal cell drawing mechanism will be skipped and this callback called so the application can tell the widget what to put in the cell.

The type field is defaulted to XbaeString and no cacheing or saving of the string or pixmap is done.

If the application sets type to XbaePixmap, the width, height and depth of the returned pixmap will be calculated with a call to XGetGeometry(). If the programmer wishes to supply the width, height and depth there is a marked improvement as a round trip to the X server is avoided. Note that all geometry parameters must be supplied to ensure successful display of the pixmap.

If a mask is also provided, it will be used to display the pixmap transparently. Pixmaps drawn in cells also respect the value of XmNcolumnAlignments.

By defining an XmNdrawCellCallback the need for the storage of the XbaeMatrix data within the matrix is eliminated and can prove to be advantageous for memory usage.

To write the data back to the application, use the XmNwriteCellCallback described below.

XmNenterCellCallback

Callbacks on the XmNenterCellCallback list are called from the EditCell() action just before a cell is edited to determine it’s editability. A pointer to the following structure is passed to each callback on the XmNenterCellCallback list:

reason

Set to XbaeEnterCellReason.

event

The event that invoked the callback.

row

The row number of the cell about to be edited.

column

The column number of the cell about to be edited.

position

The location of the cursor in the text field. The default is to place the cursor at the end of the string in the cell.

pattern

A pattern for the XbaeInput widget (see XbaeInput(3)). The default is to not specify a pattern.

auto_fill

Used in conjunction with the setting of the pattern to allow literals in the pattern to be automatically inserted.

convert_case

If the pattern specifies an upper or lower case letter, the character typed in the position can automatically be converted to the appropriate case when set to True. The default is to not convert the case of the typed letter.

overwrite_mode

Normally, the cursor appears as the familiar I caret. By setting overwrite_mode to True, the text field will go into overwrite mode where keystrokes replace the character underneath the block cursor.

select_text

Indicates whether the text in the cell should be highlighted (only valid if doit is set to True also.

map

Tells the matrix if the XmText should be mapped onto the cell. Only makes sense if doit is set to False.

num_params

The number of String parameters passed to the EditCell() action.

params

An array containing the num_params String parameters passed to the EditCell() action.

doit

Indicates whether or not this cell is editable. Setting doit to False will make this cell not editable. The default value is True.

If the application determines that the cell at (row, column) is not editable, it should set the doit flag to False. If the map flag is also set to False, XbaeMatrix will not place the XmText cell editor on the cell. If map is left as True, the XmText will be placed on the cell but the user will not be able to add or delete characters from it. If the application leaves doit as True, then the TextField will be editable. In addition, if select_text is set to True, the text in the cell will be selected via XmTextSetSelection. Assuming XmNpendingDelete for the XmText is also True, the selected text will be deleted as soon as the next text insertion occurs.

XmNlabelActivateCallback

Callbacks on the XmNlabelActivateCallback list are called after a button label has been activated via a mouse click. A pointer to the following structure is passed to each callback on the XmNlabelActivateCallback list:

reason

Set to XbaeLabelActivateReason.

event

The event that invoked this callback.

row

The row number of the button label or -1 if the button was a column label.

column

The column number of the button label or -1 if the button was a row label.

row_label

If the button label that invoked the callback is a row label, then this value is set to True. If it was a column label then it is set to False.

label

The label on the button that was pressed.

When the XbaeMatrix receives a ButtonRelease event on the same button label that it received a ButtonPress event, the XmNlabelActivateCallback is called to allow the programmer to respond to the event. The callback has been provided to emulate some popular spreadsheets on the market.

XmNleaveCellCallback

Callbacks on the XmNleaveCellCallback list are called from the EditCell() and CommitEdit() actions just before the edit to the current cell is committed. The application can validate the changes made to the cell, and allow or disallow them. A pointer to the following structure is passed to each callback on the XmNleaveCellCallback list:

reason

Set to XbaeLeaveCellReason.

event

The event that invoked this callback.

row

The row number of the cell being edited.

column

The column number of the cell being edited.

value

Contains the new data which will be stored in this cell if doit is True. The memory pointed to by value may be modified, or if the new contents are larger than the current contents, then value should be set to point to a larger piece of allocated memory.

doit

Indicates whether the edits applied to this cell should actually be stored into XbaeMatrix. Setting doit to False will cause the changes to be discarded and the cell will retain its original value. The default value is True.

If the application determines that the value entered in the cell at (row, column) is not valid, it should set the doit flag to False. This will prevent the changes from being stored in the cell. The TextField edit widget will remain on the current cell. If the application leaves doit as True, then the changes made to the cell will be committed and the TextField will move to the next cell or be unmapped. The application can also modify the String in value, e.g. to force a String to be all upper case.

XmNmodifyVerifyCallback

Callbacks on the XmNmodifyVerifyCallback list are called while a cell is being edited. The callbacks are called before text is inserted into or deleted from the TextField edit widget. A pointer to the following structure is passed to each callback on the XmNmodifyVerifyCallback list:

reason

Set to XbaeModifyVerifyReason.

event

Always set to NULL.

row

The row number of the cell being edited.

column

The column number of the cell being edited.

verify

The contents of this structure and its use are documented in the XmText(3X) man page.

prev_text

The contents of the cell as seen by this user before the new text. If other text has already been entered, this value will not match the official XbaeMatrix value of the cell. This pointer and the string should not be modified.

XmNprocessDragCallback

Callbacks on the XmNprocessDragCallback list are called from the ProcessDrag() action. The application can bind the ProcessDrag() action to any pointer based event, though by default it is bound to the Button2Down event. When this event occurs, ProcessDrag() will call the callbacks on the XmNprocessDragCallback list. A pointer to the following structure is passed to each callback on the XmNprocessDragCallback list:

reason

Set to XbaeProcessDragReason.

event

The XEvent which invoked the ProcessDrag() action.

row

The row number of the cell where the drag was initiated..

column

The column number of the cell where the drag was initiated..

string

The string in the cell where the drag was initiated if type is XbaeString. This is provided as a convenience to the application.

type

The type of the cell in which the drag was initiated.

pixmap

The pixmap in the cell where the drag was initiated if type is XbaePixmap. This is provided as a convenience to the application.

mask

A mask for the pixmap as obtained from the XPM library. mask is only necessary when pixmap has a depth greater than one. Also provided as a convenience to the application.

num_params

The number of String parameters passed to the ProcessDrag() action.

params

An array containing the num_params String parameters passed to the ProcessDrag() action.

The application can use the XmNprocessDragCallback list to implement particular processing for Motif’s drag-and-drop.

XmNresizeCallback

Callbacks on the XmNresizeCallback list are called when the XbaeMatrix widget is resized. A pointer to the following structure is passed to each callback on the XmNresizeCallback list:

reason

Set to XbaeResizeReason.

event

Always set to NULL

row

Set to the number of rows in the matrix (provided for convenience).

column

Set to the number of colums in the matrix (provided for convenience).

width

The new width of the XbaeMatrix widget.

height

The new height of the XbaeMatrix widget.

The application can use the XmNresizeCallback to adjust such resources as XmNcolumnWidths, XmNvisibleColumns and XmNvisibleRows when the widget containing an XbaeMatrix widget is resized.

XmNresizeColumnCallback

Callbacks on the XmNresizeColumnCallback list are called when a column of the XbaeMatrix widget is dynamically resized by the user. A pointer to the following structure is passed to each callback on the XmNresizeColumnCallback list:

reason

Set to XbaeResizeColumnReason.

event

The XEvent that ended the resize. The event will be of type XButtonReleasedEvent.

row

The row in which the ResizeColumn() action began.

column

The column in which the ResizeColumn() action began (and ended).

which

The column that was resized in the ResizeColumn() action.

columns

The number of columns in the XbaeMatrix widget.

column_widths

The widths of each column as they stand after the ResizeColumn() action.

The application can use the XmNresizeColumnCallback to perform post processing after a column has been resized. By adjusting the values contained in column_widths the XbaeMatrix widget will use the values upon return from the callback. Changing the number of columns in the matrix in the XmNresizeColumnCallback should be used carefully as it may cause unexpected results.

XmNselectCellCallback

Callbacks on the XmNselectCellCallback list are called from the SelectCell() action. The application can bind the SelectCell() action to any pointer based event. When this event occurs, SelectCell() will call the callbacks on the XmNselectCellCallback list. A pointer to the following structure is passed to each callback on the XmNselectCellCallback list:

reason

Set to XbaeSelectCellReason.

event

The XEvent which invoked the SelectCell() action.

row

The row number of the cell which was selected.

column

The column number of the cell which was selected.

selected_cells

The value of the XmNselectedCells resource. This is provided as a convenience to the application and will be NULL if no cells have yet been selected.

cells

The value of the XmNcells resource. This is provided as a convenience to the application and will be NULL if no cells have been specified or the XmNdrawCellCallback is being used.

num_params

The number of String parameters passed to the SelectCell() action.

params

An array containing the num_params String parameters passed to the SelectCell() action.

The application can use the XmNselectCellCallback list to implement it’s own selection model. The XbaeMatrixSelectCellCallbackStruct contains the array of String parameters passed to the SelectCell() action which invoked this callback. By binding the SelectCell() action to various events via the translation manager, and using String action parameters to distinguish them, the application can implement various selection models. For example, the following translations could be used to implement a model in which a modifier key indicates whether a single cell or an entire row should be selected. The callbacks on the XmNselectCellCallback list would examine the parameter and take the appropriate action.

The callbacks on the XmNselectCellCallback list can also be used in other ways, e.g. to pop up a cell specific menu.

NOTE: If no cells have been selected, the value of selected_cells will be NULL. The same applies for cells. Care must be taken so as not to dereference these members of the callback struct.

XmNtrackCellCallback

Callbacks on the XmNtrackCellCallback list are being called by the HandleTracking() action, which is triggered by pointer motion. One of the purposes of this callback list is to figure out from which cell to which cell the pointer is being moved. A pointer to the XbaeMatrixTrackCellCallbackStruct structure is being passed. Its fields are defined as :

reason

Set to XbaeSelectCellReason.

event

The XEvent which invoked the HandleTracking() action.

row

This is the row number that the pointer is currently in.

column

This is the column number that the pointer is currently in.

prev_row

The row that the pointer was previously in.

prev_column

The column that the pointer was previously in.

pointer_x

The x position of the pointer.

pointer_y

The y position of the pointer.

XmNtraverseCellCallback

Callbacks on the XmNtraverseCellCallback list are called from the EditCell() action, they are also called when XbaeMatrix receives the focus while the TextField edit widget is unmapped. The application can customize cell traversal using these callbacks. XbaeMatrix has a default traversal order, outlined below, which the application can override. A pointer to the following structure is passed to each callback on the XmNtraverseCellCallback list:

reason

Set to XbaeTraverseCellReason.

event

The event that invoked this callback.

row

The row number of the cell currently being edited.

column

The column number of the cell currently being edited.

next_row

The row number of the next cell to be edited, this can be changed by the application.

next_column

The column number of the next cell to be edited, this can be changed by the application.

fixed_rows

The value of the XmNfixedRows resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

fixed_columns

The value of the XmNfixedColumns resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

trailing_fixed_rows

The value of the XmNtrailingFixedRows resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

trailing_fixed_columns

The value of the XmNtrailingFixedColumns resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

num_rows

The value of the XmNrows resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

num_columns

The value of the XmNcolumns resource. This is provided as a convenience for the application in calculating the next_row and next_column fields.

param

The String value of the parameter passed to the EditCell() action.

qparam

The XrmQuark value of the parameter passed to the EditCell() action.

The EditCell() action takes an arbitrary parameter which it passes through to the callbacks on the XmNtraverseCellCallback list in both String and XrmQuark forms. The EditCell() action recognizes five special parameters which it uses to implement it’s default cell traversal. These parameters and their corresponding traversal results are:

Pointer

Set next_row and next_column to the cell underneath the mouse pointer.

Left

If we are currently editing cell (XmNfixedRows, XmNfixedColumns), then do not move. Otherwise move one column to the left, if that column is less than XmNfixedColumns , then move up to the last column of the row above.

Right

If we are currently editing cell (XmNrows - 1, XmNcolumns - 1), then do not move. Otherwise move one column to the right, if that column is greater than or equal to XmNcolumns , then move down to column XmNfixedColumns of the row below.

Up

Move up one row. If that row is less than XmNfixedRows , then move to the last row.

Down

Move down one row. If that row is greater than or equal to XmNrows , then move to row XmNfixedRows.

If the EditCell() action recognizes one of these special parameters, it calculates the new cell to be edited accordingly and stores the results in the next_row and next_column fields of the XbaeMatrixTraverseCellCallbackStruct. If EditCell() does not recognize it’s parameter, it sets next_row and next_column to the current row and column. It also stores a String and XrmQuark version of it’s parameter in the param and qparam fields. EditCell() then calls the callbacks on the XmNtraverseCellCallback list. These callbacks can examine the parameter and recalculate the next_row and next_column fields appropriately. The application can override the default calculation for the special parameters, or it can define an entirely new parameter with a corresponding new calculation. It would do this by binding EditCell() with a new application specific parameter to an event in a translation table. It is expected that application callbacks will use the XrmQuark version of the parameter for efficiency reasons (by statically creating the new XrmQuarks and comparing them against the incoming qparam).

When XbaeMatrix receives the focus and the TextField edit widget is unmapped, it will call the XmNtraverseCellCallback callbacks before attempting to automatically edit the upper left most visible cell. The XbaeMatrixTraverseCellCallbackStruct will have a param of NULL, a qparam of NULLQUARK and a row and column of 0.

XmNvalueChangedCallback

Callbacks on the XmNvalueChangedCallback list are called while a cell is being edited. The callbacks are called after text is inserted into or deleted from the TextField edit widget. A pointer to the following structure is passed to each callback on the XmNvalueChangedCallback list:

reason

Set to XbaeValueChangedReason.

event

The event that triggered this callback.

row

The row number of the cell being edit