XbaeMatrix(3) | xbae | XbaeMatrix(3) |
XbaeMatrix - The Bellcore Application Environment (BAE) XbaeMatrix widget class.
#include <Xbae/Matrix.h>
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 and when the matrix gains or looses focus. 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.
XbaeMatrix inherits behavior and resources from the
Core, Composite, Constraint, and XmManager
widget classes.
The class pointer is xbaeMatrixWidgetClass.
The class name is XbaeMatrix.
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).
XbaeMatrix Resource Set | ||||
Name | Class | Type | Default | Access |
XmNallowColumnResize | XmCAllowResize | Boolean | True | CSG |
XmNallowRowResize | XmCAllowResize | Boolean | True | CSG |
XmNaltRowCount | XmCAltRowCount | int | 1 | CSG |
XmNboldLabels | XmCBoldLabels | Boolean | False | CSG |
XmNbuttonLabels | XmCButtonLabels | Boolean | False | CSG |
XmNbuttonLabelBackground | XmCColor | Pixel | dynamic | CSG |
XmNcalcCursorPosition | XmCCalcCursorPosition | Boolean | False | CSG |
XmNcellBackgrounds | XmCColors | PixelTable | NULL | CSG |
XmNcellHighlightThickness | XmCHighlightThickness | Dimension | dynamic | CSG |
XmNcellMarginHeight | XmCMarginHeight | Dimension | dynamic | CSG |
XmNcellMarginWidth | XmCMarginWidth | Dimension | dynamic | CSG |
XmNcellShadowThickness | XmCShadowThickness | Dimension | 2 | CSG |
XmNcellShadowType | XmCShadowType | unsigned char | XmSHADOW_OUT | CSG |
XmNcellShadowTypes | XmCCellShadowTypes | unsigned char ** | NULL | CSG |
XmNcellUserData | XmCCellUserData | XtPointer ** | NULL | CSG |
XmNclipWindow | XmCClipWindow | Widget | NULL | G |
XmNcells | XmCCells | CellTable | NULL | CSG |
XmNcolors | XmCColors | PixelTable | NULL | CSG |
XmNcolumnAlignments | XmCAlignments | AlignmentArray | dynamic | CSG |
XmNcolumnButtonLabels | XmCButtonLabels | BooleanArray | NULL | CSG |
XmNcolumnLabelAlignments | XmCAlignments | AlignmentArray | dynamic | CSG |
XmNcolumnLabelColor | XmCColor | Pixel | dynamic | CSG |
XmNcolumnLabels | XmCLabels | StringArray | NULL | CSG |
XmNcolumnMaxLengths | XmCColumnMaxLengths | MaxLengthArray | NULL | CSG |
XmNcolumnShadowTypes | XmCShadowTypes | unsigned char * | NULL | CSG |
XmNcolumnUserData | XmCUserDatas | XtPointer * | NULL | CSG |
XmNcolumnWidthInPixels | XmCColumnWidthInPixels | Boolean | False | CSG |
XmNcolumnWidths | XmCColumnWidths | WidthArray | NULL | CSG |
XmNcolumns | XmCColumns | int | 0 | CSG |
XmNdefaultActionCallback | XmCCallback | XtCallbackList | NULL | CSG |
XmNdoubleClickInterval | XmCDoubleClickInterval | int | dynamic | CSG |
XmNdrawCellCallback | XmCCallback | Callback | NULL | CSG |
XmNenterCellCallback | XmCCallback | Callback | NULL | CSG |
XmNevenRowBackground | XmCBackground | Pixel | dynamic | CSG |
XmNfill | XmCFill | Boolean | False | CSG |
XmNhorzFill | XmCHorzFill | Boolean | False | CSG |
XmNvertFill | XmCVertFill | Boolean | False | CSG |
XmNfixedColumns | XmCFixedColumns | Dimension | 0 | CSG |
XmNfixedRows | XmCFixedRows | Dimension | 0 | CSG |
XmNfontList | XmCFontList | FontList | fixed | CSG |
XmNgridLineColor | XmCColor | Pixel | dynamic | CSG |
XmNgridType | XmCGridType | GridType | XmGRID_CELL_LINE | CSG |
XbaeMatrix Resource Set (continued) | ||||
Name | Class | Type | Default | Access |
XmNhighlightedCells | XmCHighlightedCells | HighlightTable * | dynamic | CSG |
XmNhorizontalScrollBar | XmCHorizontalScrollBar | Widget | NULL | G |
XmNhorizontalScrollBarDisplayPolicy | XmCMatrixScrollBarDisplayPolicy | unsigned char | XmDISPLAY_AS_NEEDED | CSG |
XmNlabelActivateCallback | XmCCallback | Callback | NULL | CSG |
XmNlabelFont | XmCFontList | FontList | dynamic | CSG |
XmNleaveCellCallback | XmCCallback | Callback | NULL | CSG |
XmNleftColumn | XmCLeftColumn | int | 0 | CSG |
XmNmodifyVerifyCallback | XmCCallback | Callback | NULL | CSG |
XmNmultiLineCell | XmCMultiLineCell | Boolean | False | CSG |
XmNnonFixedDetachedLeft | XmCNonFixedDetachedLeft | Boolean | False | CSG |
XmNnonFixedDetachedTop | XmCNonFixedDetachedTop | Boolean | False | CSG |
XmNoddRowBackground | XmCBackground | Pixel | dynamic | CSG |
XmNprocessDragCallback | XmCCallback | Callback | NULL | CSG |
XmNrenderTable | XmCRenderTable | RenderTable | NULL | CSG |
XmNresizeCallback | XmCCallback | Callback | NULL | CSG |
XmNresizeColumnCallback | XmCCallback | Callback | NULL | CSG |
XmNreverseSelect | XmCReverseSelect | Boolean | False | CSG |
XmNrowButtonLabels | XmCButtonLabels | BooleanArray | NULL | CSG |
XmNrowHeightInPixels | XmCRowHeightInPixels | Boolean | True | CSG |
XmNrowHeights | XmCColumnWidths | WidthArray | NULL | CSG |
XmNrowLabelAlignment | XmCAlignment | Alignment | XmALIGNMENT_END | CSG |
XmNrowLabelColor | XmCColor | Pixel | dynamic | CSG |
XmNrowLabelWidth | XmCRowLabelWidth | Short | dynamic | CSG |
XmNrowLabels | XmCLabels | StringArray | NULL | CSG |
XmNrowShadowTypes | XmCShadowTypes | unsigned char * | NULL | CSG |
XmNrowUserData | XmCUserDatas | XtPointer * | NULL | CSG |
XmNrows | XmCRows | int | 0 | CSG |
XmNscrollBarPlacement | XmCScrollBarPlacement | unsigned char | XmBOTTOM_RIGHT | CSG |
XmNselectCellCallback | XmCCallback | Callback | NULL | CSG |
XmNselectScrollVisible | XmCSelectScrollVisible | Boolean | True | CSG |
XmNselectedBackground | XmCColor | Pixel | dynamic | CSG |
XmNselectedCells | XmCSelectedCells | BooleanTable | dynamic | CSG |
XmNselectedForeground | XmCColor | Pixel | dynamic | CSG |
XmNshadowType | XmCShadowType | unsigned char | XmSHADOW_IN | CSG |
XmNshowArrows | XmCShowArrows | Boolean | False | CSG |
XmNspace | XmCSpace | Dimension | dynamic | CSG |
XmNtextBackground | XmCBackground | Pixel | XmUNSPECIFIED_PIXEL | CSG |
XmNtextBackgroundIsCell | XmCTextBackgroundIsCell | Boolean | False | CSG |
XmNtextField | XmCTextField | Widget | NULL | G |
XmNtextShadowThickness | XmCTextShadowThickness | Dimension | 0 | CSG |
XmNtextTranslations | XmCTranslations | TranslationTable | dynamic | CSG |
XmNtopRow | XmCTopRow | int | 0 | CSG |
XmNtrackcellCallback | XmCCallback | Callback | NULL | CSG |
XmNtrailingAttachedBottom | XmCTrailingAttachedBottom | Boolean | False | CSG |
XmNtrailingAttachedRight | XmCTrailingAttachedRight | Boolean | False | CSG |
XmNtrailingFixedColumns | XmCTrailingFixedColumns | Dimension | 0 | CSG |
XmNtrailingFixedRows | XmCTrailingFixedRows | Dimension | 0 | CSG |
XmNtraverseCellCallback | XmCCallback | Callback | NULL | CSG |
XmNtraverseFixedCells | XmCTraverseFixedCells | Boolean | False | CSG |
XbaeMatrix Resource Set (continued) | ||||
Name | Class | Type | Default | Access |
XmNuseXbaeInput | XmCUseXbaeInput | Boolean | False | CSG |
XmNvalueChangedCallback | XmCCallback | Callback | NULL | CSG |
XmNverticalScrollBar | XmCVerticalScrollBar | Widget | NULL | G |
XmNverticalScrollBarDisplayPolicy | XmCMatrixScrollBarDisplayPolicy | unsigned char | XmDISPLAY_AS_NEEDED | CSG |
XmNvisibleColumns | XmCVisibleColumns | Dimension | 0 | CSG |
XmNvisibleRows | XmCVisibleRows | Dimension | 0 | CSG |
XmNwrapType | XmCWrapType | Boolean | XbaeWrapNone | CSG |
XmNwriteCellCallback | XmCCallback | Callback | NULL | CSG |
XmNxmColumnLabels | XmCXmLabels | XmString * | NULL | CSG |
XmNxmRowLabels | XmCXmLabels | XmString * | NULL | CSG |
This resource cannot be specified in a resource file
*mw.cellBackgrounds: | blue, white, blue, white, blue\n\ |
white, blue, white, blue, white\n\ | |
blue, white, blue, white, blue\n\ | |
white, blue, white, blue, white\n\ | |
blue, white, blue, white, blue\n |
String rows[2][3] = | |||
{ | |||
"00", | "01", | "02", | |
"10", | "11", | "12" | |
}; |
String *cells[2]; | |
cells[0] = &rows[0][0]; | |
cells[1] = &rows[1][0]; |
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.
When drawing a cell, the matrix uses the first entry with the tag XmFONTLIST_DEFAULT_TAG if no tag has been set on the cell using XbaeMatrixSetCellTag. If a tag has been set on the cell the first entry with a matching tag is used.
When drawing a label, the matrix uses the first entry with the tag XmFONTLIST_DEFAULT_TAG.
When drawing a cell, the matrix uses the first entry with the tag _MOTIF_DEFAULT_LOCALE if no tag has been set on the cell using XbaeMatrixSetCellTag. If a tag has been set on the cell the first entry with a matching tag is used.
When drawing a label, the matrix uses the first entry with the tag "labels". If there is no such entry the first entry with the tag _MOTIF_DEFAULT_LOCALE is used.
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).
XmManager Resource Set | ||||
Name | Class | Type | Default | Access |
XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNforeground | XmCForeground | Pixel | dynamic | CSG |
XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
XmNinitialFocus | XmCInitialFocus | Widget | NULL | CSG |
XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG |
XmNshadowThickness | XmCShadowThickness | Dimension | dynamic | CSG |
XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG |
XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG |
XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
XmNuserData | XmCUserData | XtPointer | NULL | CSG |
Composite Resource Set | ||||
Name | Class | Type | Default | Access |
XmNchildren | XmCReadOnly | WidgetList | NULL | G |
XmNinsertPosition | XmCInsertPosition | XtOrderProc | NULL | CSG |
XmNnumChildren | XmCReadOnly | Cardinal | 0 | G |
Core Resource Set | ||||
Name | Class | Type | Default | Access |
XmNaccelerators | XmCAccelerators | XtAccelerators | NULL | 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 | 1 | 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 |
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
int | row; | |
int | column; | |
XEvent | *event; | |
} XbaeMatrixAnyCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
} XbaeMatrixDefaultActionCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
int | width; | |
int | height; | |
XbaeCellType | type; | |
String | string; | |
Pixmap | pixmap; | |
Pixmap | mask; | |
Pixel | foreground; | |
Pixel | background; | |
int | depth; | |
} XbaeMatrixDrawCellCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
int | position; | |
String | pattern; | |
Boolean | auto_fill; | |
Boolean | convert_case; | |
Boolean | overwrite_mode; | |
Boolean | select_text; | |
Boolean | map; | |
Cardinal | num_params; | |
String | *params; | |
Boolean | doit; | |
} XbaeMatrixEnterCellCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
Boolean | row_label; | |
String | label; | |
} XbaeMatrixLabelActivateCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row, column; | |
String | value; | |
Boolean | doit; | |
} XbaeMatrixLeaveCellCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
XmTextVerifyCallbackStruct | *verify; | |
const char | *prev_text; | |
} XbaeMatrixModifyVerifyCallbackStruct; |
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
String | string; | |
XbaeCellType | type; | |
Pixmap | pixmap; | |
Pixmap | mask; | |
Cardinal | num_params; | |
String | *params; | |
} XbaeMatrixProcessDragCallbackStruct; |
The application can use the XmNprocessDragCallback list to implement particular processing for Motif's drag-and-drop.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
Dimension | width; | |
Dimension | height; | |
} XbaeMatrixResizeCallbackStruct; |
The application can use the XmNresizeCallback to adjust such resources as XmNcolumnWidths, XmNvisibleColumns and XmNvisibleRows when the widget containing an XbaeMatrix widget is resized.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
int | which; | |
int | columns; | |
short | *column_widths; | |
} XbaeMatrixResizeColumnCallbackStruct; |
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.
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
Boolean | **selected_cells; | |
String | **cells; | |
Cardinal | num_params; | |
String | *params; | |
} XbaeMatrixSelectCellCallbackStruct; |
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.
#override\n\ | ||
Shift<Btn1Down>: | SelectCell(cell)\n\ | |
Ctrl<Btn1Down>: | SelectCell(row) |
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.
typedef struct _XbaeMatrixTrackCellCallbackStruct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row, column; | |
int | prev_row, prev_column; | |
Position | pointer_x, pointer_y; | |
} XbaeMatrixTrackCellCallbackStruct; |
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
int | next_row; | |
int | next_column; | |
int | fixed_rows; | |
int | fixed_columns; | |
int | trailing_fixed_rows; | |
int | trailing_fixed_columns; | |
int | num_rows; | |
int | num_columns; | |
String | param; | |
XrmQuark | qparam; | |
} XbaeMatrixTraverseCellCallbackStruct; |
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:
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 it will also call the XmNtraverseCellCallback callbacks before returning to the current cell or the upper left most visible cell if no cell is currently edited. The XbaeMatrixTraverseCellCallbackStruct will have param and qparm set to Focus. If there is no current cell row and column will be set to -1.
When XbaeMatrix looses the focus it will also call the XmNtraverseCellCallback with param and qparm set to LoosingFocus.
typedef struct | ||
{ | ||
XbaeReasonType reason; | ||
XEvent *event; | ||
int row; | ||
int column; | ||
} XbaeMatrixValueChangedCallbackStruct; |
typedef struct | ||
{ | ||
XbaeReasonType | reason; | |
XEvent | *event; | |
int | row; | |
int | column; | |
XbaeCellType | type; | |
String | string; | |
Pixmap | pixmap; | |
Pixmap | mask; | |
} XbaeMatrixWriteCellCallbackStruct; |
If the application adds this callback, when the XbaeMatrix is editable and has been assigned an XmNdrawCellCallback, data on the widget can be edited and stored back in the application's data structure. Only if an XmNdrawCellCallback has been assigned to the XbaeMatrix widget, will the XmNwriteCellCallback be called.
At the moment, pixmap and mask will be sent to the XmNwriteCellCallback as NULL.
XbaeMatrix inherits translations from XmManager. In addition, XbaeMatrix uses the following translation:
:<Btn1Up>: | DefaultAction()\n\ |
:<Btn1Down>: | DefaultAction() EditCell(Pointer)\n\ |
:Shift<Btn2Down>: | ResizeColumns()\n\ |
:<Btn2Down>: | ProcessDrag()\n\ |
:<Btn1Motion>: | HandleMotion() HandleTracking()()\n\ |
:<Motion>: | HandleTracking()()\n\ |
:<Btn4Down>: | ScrollRows(-50)()\n\ |
:<Btn5Down>: | ScrollRows( 50)() |
XbaeMatrix installs the following default XmNtextTranslations on the TextField edit widget:
#override\n\ | |
Shift ~Ctrl ~Meta ~Alt <Key>Tab: | EditCell(Left)\n\ |
~Ctrl ~Meta ~Alt <Key>Tab: | EditCell(Right)\n\ |
<Key>osfUp: | EditCell(Up)\n\ |
<Key>osfDown: | EditCell(Down)\n\ |
<Key>osfActivate: | CommitEdit(False)\n\ |
~Shift ~Meta ~Alt <Key>Return: | CommitEdit(False)\n\ |
<Key>osfCancel: | CommitEdit(False)\n\ |
Shift Ctrl ~Meta ~Alt <Key>Tab: | TraversePrev()\n\ |
Ctrl ~Meta ~Alt <Key>Tab: | TraverseNext()\n\ |
<Key>osfPageDown: | PageDown()\n\ |
<Key>osfPageUp: | PageUp()\n |
If the changes are valid, CommitEdit() examines it's one parameter, which must be the string True or False. If the parameter is True, then the edit TextField is unmapped. If it is False, then the TextField is not unmapped.
If the changes are valid, EditCell() attempts to scroll the new cell to be edited so that it is fully visible. If the new cell is in a fixed row or column, EditCell() returns and does nothing further (these cells are not editable). Otherwise, EditCell() calls the callbacks on the XmNenterCellCallback list to determine if the new cell is editable. It then moves the XmText edit widget to the new cell, setting it's editability based on the return from the XmNenterCellCallback callbacks.
In addition to the standard type converters registered by Xt and Motif, XbaeMatrix registers the following additional type converters:
The following external entry points to XbaeMatrix class methods are defined:
XbaeCreateMatrix()
Widget XbaeCreateMatrix() | ||
Widget | parent; | |
String | name; | |
ArgList | arglist; | |
Cardinal | argcount; |
XbaeCreateMatrix() creates an unmanaged instance of an XbaeMatrix widget and returns the associated widget ID.
XbaeMatrixAddColumns()
void XbaeMatrixAddColumns() | ||
Widget | w; | |
int | position; | |
String | *columns; | |
String | *labels; | |
short | *widths; | |
int | *max_lengths; | |
unsigned | char *alignments; | |
unsigned | char *label_alignments; | |
Pixel | *colors; | |
int | num_columns; |
XbaeMatrixAddColumns() allows the application developer to dynamically add new columns anywhere in the Matrix. The columns will be added before the column specified in position. Columns are numbered starting at zero. To append new columns onto the end of the Matrix, specify position as the total number of columns. Most of the arguments to XbaeMatrixAddColumns() may be specified as NULL. Default values will be used by the widget.
If the programmer attempts to add columns using XbaeMatrixAddColumns() when there are no rows, it will result in a warning message. There must be at least one row in the XbaeMatrix widget to add columns.
To maintain backward compatibility, the cell backgrounds cannot be set in a call to XbaeMatrixAddColumns() and must be set (if so desired) in a separate call to XtVaSetValues().
void XbaeMatrixAddRows() | ||
Widget | w; | |
int | position; | |
String | *rows; | |
String | *labels; | |
Pixel | *colors; | |
int | num_rows; |
XbaeMatrixAddRows() allows the application developer to dynamically add new rows anywhere in the Matrix. The rows will be added before the row specified in position. Rows are numbered starting at zero. To append new rows onto the end of the Matrix, specify position as the total number of rows.
To maintain backward compatibility, the cell backgrounds cannot be set in a call to XbaeMatrixAddRows() and must be set (if so desired) in a separate call to XtVaSetValues().
XbaeMatrixCancelEdit()
void XbaeMatrixCancelEdit() | ||
Widget | w; | |
Boolean | unmap; |
XbaeMatrixCancelEdit() allows the application developer to programmatically cancel a cell edit in progress, discarding any changes made by the user. This function unmaps the TextField edit widget if the unmap flag is True. If unmap is False, the contents of the TextField are restored to their original value, and the TextField is not unmapped.
Boolean XbaeMatrixCommitEdit() | ||
Widget | w; | |
Boolean | unmap; |
XbaeMatrixCommitEdit() can be used by the application developer to programmatically commit an edit, saving any changes made by the user. This will cause the callbacks on the XmNleaveCellCallback list to be called to verify that the changes the user made are valid. If the changes are valid, then they are saved into the cell and if the unmap flag is True, the TextField widget will be unmapped.
void XbaeMatrixDeleteColumns() | ||
Widget | w; | |
int | position; | |
int | num_columns; |
XbaeMatrixDeleteColumns() allows the application developer to dynamically delete columns from anywhere in the Matrix. Columns will be deleted starting at the column specified by position.
void XbaeMatrixDeleteRows() | ||
Widget | w; | |
int | position; | |
int | num_rows; |
XbaeMatrixDeleteRows() allows the application developer to dynamically delete rows from anywhere in the Matrix. Rows will be deleted starting at the row specified by position.
void XbaeMatrixDeselectAll() | ||
Widget | w; |
XbaeMatrixDeselectAll() allows the application developer to programmatically deselect all cells. XbaeMatrixDeselectAll() redraws the cells in normal video. All Booleans in the XmNselectedCells array will be set to False.
void XbaeMatrixDeselectCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixDeselectCell() allows the application developer to programmatically deselect a cell. XbaeMatrixDeselectCell() redraws the cell in normal video. The corresponding Boolean in the XmNselectedCells array will be set to False.
void XbaeMatrixDeselectColumn() | ||
Widget | w; | |
int | column; |
XbaeMatrixDeselectColumn() allows the application developer to programmatically deselect a column. XbaeMatrixDeselectColumn() draws the column in normal video. The corresponding Booleans in the XmNselectedCells array will be set to False.
void XbaeMatrixDeselectRow() | ||
Widget | w; | |
int | row; |
XbaeMatrixDeselectRow() allows the application developer to programmatically deselect a row. XbaeMatrixDeselectRow() draws the row in reverse video (or selectedForeground / selectedBackground if set). The corresponding Booleans in the XmNselectedCells array will be set to False.
int XbaeMatrixDisableRedisplay() | ||
Widget | w; |
XbaeMatrixDisableRedisplay() and XbaeMatrixEnableRedisplay() allow an application to make multiple changes to a matrix without immediate visual updates. When multiple changes are made with redisplay enabled, visual flashing often occurs. These routines help eliminate this problem.
void XbaeMatrixEditCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixEditCell()
allows the application developer to programmatically force a specific cell to be edited. This function will first attempt to commit the edit in the current cell. If the XmNleaveCellCallback callbacks disallow this commit, then XbaeMatrixEditCell() will return. Otherwise the specified cell is scrolled until it is visible. If the specified cell is in a fixed row or column, it cannot be edited and XbaeMatrixEditCell() will return. Next, the callbacks on the XmNenterCellCallback callback list are called for the specified cell to determine it's editability. Then the TextField edit widget is mapped on top of the specified cell.
int XbaeMatrixEnableRedisplay() | ||
Widget | w; | |
Boolean | redisplay; |
XbaeMatrixDisableRedisplay() and XbaeMatrixEnableRedisplay() allow an application to make multiple changes to a matrix without immediate visual updates. When multiple changes are made with redisplay enabled, visual flashing often occurs. These routines help eliminate this problem.
Boolean XbaeMatrixEventToXY() | ||
Widget | w; | |
XEvent | *event; | |
int | *x; | |
int | *y; |
XbaeMatrixEventToXY enables the programmer to determine the x and y values of a given event with respect to the XbaeMatrix widget. The returned values are also adjusted to allow for the XbaeClip widget.
void XbaeMatrixFirstSelectedCell() | ||
Widget | w; | |
int | *row; | |
int | *column; |
XbaeMatrixFirstSelectedCell() allows the application developer to find out which cell is the first selected. The function traverses the XbaeMatrix widget in a left to right, top to bottom manner to determine this value. If no cell is selected, row and column are set to -1.
int XbaeMatrixFirstSelectedColumn() | ||
Widget | w; |
XbaeMatrixFirstSelectedColumn() returns the column number of the first selected column in the XbaeMatrix widget. The function traverses the matrix from column 0. A column must be entirely selected for the column to be considered selected. If no column is selected then -1 is returned.
int XbaeMatrixFirstSelectedRow() | ||
Widget | w; |
XbaeMatrixFirstSelectedRow() returns the row number of the first selected row in the XbaeMatrix widget. The function traverses the matrix from row 0. A row must be entirely selected for the row to be considered selected. If no row is selected then -1 is returned.
String XbaeMatrixGetCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixGetCell() returns the String value stored in the specified cell. This String should not be freed. To examine many cells, it is more efficient to do an XtGetValues() on XmNcells and examine the values in that array.
Pixel XbaeMatrixGetCellBackground() | ||
Widget | w; | |
int | row; | |
int | column; |
Pixel XbaeMatrixGetCellColor() | ||
Widget | w; | |
int | row; | |
int | column; |
int XbaeMatrixGetCellPixmap() | ||
Widget | w; | |
int | row; | |
int | column; | |
Pixmap | *pixmap; | |
Pixmap | *mask; |
XmStringTag XbaeMatrixGetCellTag() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixGetCellTag returns the font tag of the indicated cell. The application should not modify or free the returned value.
XtPointer XbaeMatrixGetCellUserData() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixGetCellUserData() returns a pointer to the data assigned to the cell in the given coordinates. The data should be set using XbaeMatrixSetCellUserData(). If no data is found to be associated with the particular cell, NULL is returned.
int XbaeMatrixGetColumnWidth() | ||
Widget | w; | |
int | column; |
XbaeMatrixGetColumnWidth() is a convenient way to query a column width.
String XbaeMatrixGetColumnLabel() | ||
Widget | w; | |
int | column; |
XbaeMatrixGetColumnLabel() returns a pointer to the label of the given column. If no column labels exist or the given column is not a valid column NULL is returned. If no data is found to be associated with the particular column, NULL is returned.
XtPointer XbaeMatrixGetColumnUserData() | ||
Widget | w; | |
int | column; |
XbaeMatrixGetColumnUserData() returns a pointer to the data assigned to the given column. The data should be set using XbaeMatrixSetColumnUserData(). If no data is found to be associated with the particular column, NULL is returned.
void XbaeMatrixGetCurrentCell() | ||
Widget | w; | |
int | *row; | |
int | *column; |
XbaeMatrixGetCurrentCell() allows the application developer to determine what cell is being edited or has focus.
int XbaeMatrixGetEventRowColumn() | ||
Widget | w; | |
XEvent | *event; | |
int | *row; | |
int | *column; |
XbaeMatrixGetEventRowColumn() allows the application developer to determine what cell corresponds to an (x, y) in an event. If the (x, y) of the event is a legal cell, row and column are set and True is returned. However, if the (x, y) is not over a cell, False is returned, and row and column will have undefined values.
int XbaeMatrixGetNumSelected() | ||
Widget | w; |
XbaeMatrixGetNumSelected() returns the number of cells that are currently selected in the given matrix. The widget maintains an internal variable as cells are selected and deselected so a complete traversal of the widget is avoided.
int XbaeMatrixGetRowHeight() | ||
Widget | w; | |
int | row; |
XbaeMatrixGetRowHeight() is a convenient way to query a row height.
String XbaeMatrixGetRowLabel() | ||
Widget | w; | |
int | row; |
XbaeMatrixGetRowLabel() returns a pointer to the label of the given row. If no row labels exist or the given row is not a valid row NULL is returned.
XtPointer XbaeMatrixGetRowUserData() | ||
Widget | w; | |
int | row; |
XbaeMatrixGetRowUserData() returns a pointer to the data assigned to the given row. The data should be set using XbaeMatrixSetRowUserData(). If no data is found to be associated with the particular row, NULL is returned.
XmString XbaeMatrixGetXmColumnLabel() | ||
Widget | w; | |
int | column; |
XbaeMatrixGetXmColumnLabel() returns a pointer to the xmLabel of the given column. If no xmColumnLabels exist or the given column is not a valid column NULL is returned. If no data is found to be associated with the particular column, NULL is returned.
XmString XbaeMatrixGetXmRowLabel() | ||
Widget | w; | |
int | row; |
XbaeMatrixGetXmRowLabel() returns a pointer to the xmLabel of the given row. If no xmRowLabels exist or the given row is not a valid row NULL is returned. If no data is found to be associated with the particular row, NULL is returned.
void XbaeMatrixHighlightCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixHighlightCell() allows the application developer to programmatically highlight a cell. XbaeMatrixHighlightCell() draws the highlight around the cell. The corresponding unsigned char in the XmNhighlightedCells array will be have its HighlightCell bit set.
void XbaeMatrixHighlightColumn() | ||
Widget | w; | |
int | column; |
XbaeMatrixHighlightColumn() allows the application developer to programmatically highlight a column. XbaeMatrixHighlightColumn() draws the highlight around the column if XmNgridType is XmGRID_COLUMN_SHADOW or from around each cell in the column otherwise. The corresponding unsigned chars in the XmNhighlightedCells array will be have its HighlightColumn or HighlightOther bit set, depending on whether XmNgridType is set to XmGRID_COLUMN_SHADOW or not.
void XbaeMatrixHighlightRow() | ||
Widget | w; | |
int | row; |
XbaeMatrixHighlightRow() allows the application developer to programmatically highlight a row. XbaeMatrixHighlightRow() draws the highlight around the row if XmNgridType is XmGRID_ROW_SHADOW or from around each cell in the row otherwise. The corresponding unsigned chars in the XmNhighlightedCells array will be have its HighlightRow or HighlightOther bit set, depending on whether XmNgridType is set to XmGRID_ROW_SHADOW or not.
Boolean XbaeMatrixIsCellSelected() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixIsCellSelected() allows the application developer to determine whether or not a particular cell is selected. The function returns True if the cell is selected and False otherwise.
Boolean XbaeMatrixIsCellVisible() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixIsCellVisible() allows the application developer to determine whether or not a particular cell is in the visible area of the XbaeMatrix widget. The function returns True if the cell is visible and False otherwise.
Boolean XbaeMatrixIsColumnSelected() | ||
Widget | w; | |
int | column; |
XbaeMatrixIsColumnSelected() allows the application developer to determine whether or not a particular column is selected. The function returns True if the column is selected and False otherwise. A column must be selected in its entirety for XbaeMatrixIsColumnSelected() to return True.
Boolean XbaeMatrixIsColumnVisible() | ||
Widget | w; | |
int | column; |
XbaeMatrixIsColumnVisible() allows the application developer to determine whether or not a particular column is in the visible area of the XbaeMatrix widget. The function returns True if the column is visible and False otherwise.
Boolean XbaeMatrixIsRowSelected() | ||
Widget | w; | |
int | row; |
XbaeMatrixIsRowSelected() allows the application developer to determine whether or not a particular row is selected. The function returns True if the row is selected and False otherwise. A row must be selected in its entirety for XbaeMatrixIsRowSelected() to return True.
Boolean XbaeMatrixIsRowVisible() | ||
Widget | w; | |
int | row; |
XbaeMatrixIsRowVisible() allows the application developer to determine whether or not a particular row is in the visible area of the XbaeMatrix widget. The function returns True if the row is visible and False otherwise.
int XbaeMatrixMakeCellVisible() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixMakeCellVisible() allows a cell to be programatically scrolled into the visible area of the XbaeMatrix widget. By calling this function, the XmNselectScrollVisible resource is ignored. For a more accurate cell location after scrolling, the programmer should use the XmNleftColumnandXmNtopRow resources.
int XbaeMatrixNumRows() | ||
Widget | w; |
XbaeMatrixNumRows() returns the number of rows in the given matrix.
int XbaeMatrixNumColumns() | ||
Widget | w; |
XbaeMatrixNumColumns() returns the number of columns in the given matrix.
int XbaeMatrixNumRows() | ||
Widget | w; |
XbaeMatrixNumRows() returns the number of rows in the given matrix.
void XbaeMatrixRefresh() | ||
Widget | w; |
XbaeMatrixRefresh() allows the application developer to force the widget to redraw itself. This might be used when the programmer knows the widget's values have changed, but the widget has not detected the change. For example, the quickest way to swap the values of 2 rows would be to do an XtGetValues on XmNcells, swap the values of the 2 rows, and then do an XtSetValues on XmNcells with the same StringTable variable. Because of the way the Intrinsics work, the widget will not see this change and will display the old values until a redraw is preformed because of a resize or scroll event (assuming no other change in the XtSetValues caused a redraw). Calling XbaeMatrixRefresh() will cause the correct values to be drawn and overcome this limitation in the Intrinsics. While this function should rarely be needed, it is provided ``just in case''.
void XbaeMatrixRefreshCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixRefreshCell() allows the application developer to redraw a specific cell of the matrix. This function is particularly useful when used with the XbaeMatrixDrawCellCallback as it allows updates of the data without an explicit expose event.
void XbaeMatrixRefreshColumn() | ||
Widget | w; | |
int | column; |
XbaeMatrixRefreshColumn() allows the application developer
to efficiently redraw a specific column
of the matrix.
void XbaeMatrixRefreshRow() | ||
Widget | w; | |
int | row; |
XbaeMatrixRefreshRow() allows the application developer to
efficiently redraw a specific row
of the matrix.
int XbaeMatrixRowColToXY() | ||
Widget | w; | |
int | row; | |
int | column; | |
int | *x; | |
int | *y; |
XbaeMatrixRowColToXY() allows the application developer to determine the coordinates of the upper left corner of a given cell. If the given widget is not an XbaeMatrix widget, False will be returned and the values of x and y will be undefined. This function is useful for drag and drop calculations.
void XbaeMatrixSelectAll() | ||
Widget | w; |
XbaeMatrixSelectAll() allows the application developer to programmatically select all cells. XbaeMatrixSelectAll() redraws the cells in reverse video. All Booleans in the XmNselectedCells array will be set to True.
void XbaeMatrixSelectCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixSelectCell() allows the application developer to
programmatically select a cell. XbaeMatrixSelectCell() first scrolls
the specified cell until it is visible, and then draws the cell in reverse
video (or selectedForeground / selectedBackground if set).
The corresponding Boolean in the XmNselectedCells array will be set to
True.
void XbaeMatrixSelectColumn() | ||
Widget | w; | |
int | column; |
XbaeMatrixSelectColumn() allows the application developer to programmatically select a column. XbaeMatrixSelectColumn() first scrolls the specified column until it is visible, and then draws the column in reverse video (or selectedForeground / selectedBackground if set). The corresponding Booleans in the XmNselectedCells array will be set to True.
void XbaeMatrixSelectRow() | ||
Widget | w; | |
int | row; |
XbaeMatrixSelectRow() allows the application developer to programmatically select a row. XbaeMatrixSelectRow() first scrolls the specified row until it is visible, and then draws the row in reverse video (or selectedForeground / selectedBackground if set). The corresponding Booleans in the XmNselectedCells array will be set to True.
void XbaeMatrixSetCell() | ||
Widget | w; | |
int | row; | |
int | column; | |
const | String value; |
XbaeMatrixSetCell() allows the application developer to programmatically set the value of the specified cell. To set the values of many cells, it may be more efficient to do an XtSetValues() on the XmNcells resource.
void XbaeMatrixSetCellBackground() | ||
Widget | w; | |
int | row; | |
int | column; | |
Pixel | color; |
XbaeMatrixSetCellBackground() is a convenient way to specify and modify the XmNcellBackgrounds resource when changing the background of a single cell. If XmNcellBackgrounds is NULL, then XbaeMatrixSetCellBackground() will create a Pixel table initialized to XmNforeground except for the cell specified in it's arguments. If XmNcellBackgrounds is not NULL, then XbaeMatrixSetCellBackground() will changed the specified cell in that resource to the specified color.
void XbaeMatrixSetCellColor() | ||
Widget | w; | |
int | row; | |
int | column; | |
Pixel | color; |
XbaeMatrixSetCellColor() is a convenient way to specify and modify the XmNcolors resource when changing the color of a single cell. If XmNcolors is NULL, then XbaeMatrixSetCellColor() will create a Pixel table initialized to XmNforeground except for the cell specified in it's arguments. If XmNcolors is not NULL, then XbaeMatrixSetCellColor() will changed the specified cell in that resource to the specified color.
void XbaeMatrixSetCellPixmap() | ||
Widget | w; | |
int | row; | |
int | column; | |
Pixmap | pixmap; | |
Pixmap | mask; |
XbaeMatrixSetCellPixmap will set the pixmap and the associated mask of the indicated cell. If the row or column are out of bounds, or the widget is not an XbaeMatrix widget, then nothing is changed; this erroneous condition is silently ignored.
void XbaeMatrixSetCellShadow() | ||
Widget | w; | |
int | row; | |
int | column; | |
unsigned char | shadow_type; |
XbaeMatrixSetShadow() allows the application developer to programmatically set the shadow of a specified cell.
void XbaeMatrixSetCellTag() | ||
Widget | w; | |
int | row; | |
int | column; | |
XmStringTag | tag; |
XbaeMatrixSetTag() allows the application developer to programmatically set the font tag of a specified cell. This value is copied (quarkified).
void XbaeMatrixSetCellUserData() | ||
Widget | w; | |
int | row; | |
int | column; | |
XtPointer | data; |
XbaeMatrixSetCellUserData() allows the application developer to programmatically set the user data of a specified cell. To set the data value of many cells, it may be more efficient to do an XtSetValues() on the XmNcellUserData resource. This resource is copied.
void XbaeMatrixSetCellWidget(w, row, column, widget) | ||
Widget | w; | |
int | row; | |
int | column; | |
Widget | widget; |
XbaeMatrixSetCellWidget() is a function to attach a widget to a matrix cell. The cell is selected by specifying its row and column , widget is the cell widget to be associated with that cell. XbaeMatrix will manage the cell widget's position and size so it is displayed inside the cell at all times, including when scrolling.
Using a NULL widget removes the link between a widget and its cell. Only one widget can be in a cell, a widget should also be in only one cell at a time.
void XbaeMatrixSetCellWidget(w, row, column, widget) | ||
Widget | w; | |
int | row; | |
int | column; | |
Widget | widget; |
XbaeMatrixSetCellWidget() is a function to attach a widget to a matrix cell. The cell is selected by specifying its row and column , widget is the cell widget to be associated with that cell. XbaeMatrix will manage the cell widget's position and size so it is displayed inside the cell at all times, including when scrolling.
Using a NULL widget removes the link between a widget and its cell. Only one widget can be in a cell, a widget should also be in only one cell at a time.
void XbaeMatrixSetColumnBackgrounds() | ||
Widget | w; | |
int | position; | |
Pixel | *colors; | |
int | num_colors; |
XbaeMatrixSetColumnBackgrounds() is a convenient way to specify and modify the XmNcellBackgrounds resource when setting the background of an entire column or columns. If XmNcellBackgrounds is NULL, then XbaeMatrixSetColumnBackgrounds() will create a Pixel table initialized to XmNforeground except for the columns specified in it's arguments. If XmNcellBackgrounds is not NULL, then XbaeMatrixSetColumnBackgrounds() will changed the specified columns in that resource to the specified colors.
void XbaeMatrixSetColumnColors() | ||
Widget | w; | |
int | position; | |
Pixel | *colors; | |
int | num_colors; |
XbaeMatrixSetColumnColors() is a convenient way to specify and modify the XmNcolors resource when setting the color of an entire column or columns. If XmNcolors is NULL, then XbaeMatrixSetColumnColors() will create a Pixel table initialized to XmNforeground except for the columns specified in it's arguments. If XmNcolors is not NULL, then XbaeMatrixSetColumnColors() will changed the specified columns in that resource to the specified colors.
void XbaeMatrixSetColumnWidth() | ||
Widget | w; | |
int | column; | |
int | width; |
XbaeMatrixSetColumnWidth() is a convenient way to change the width of a column without the need to allocate an array with column width numbers. Passing -1 as the new width will reset the column width to the default value.
void XbaeMatrixSetColumnLabel() | ||
Widget | w; | |
int | column; | |
String | value; |
XbaeMatrixSetColumnLabel() allows the application developer to programmatically change the label of a specified column.
void XbaeMatrixSetColumnShadow() | ||
Widget | w; | |
int | column; | |
unsidned char | shadow_type; |
XbaeMatrixSetColumnShadow() allows the application developer to programmatically change the shadow of a specified column.
void XbaeMatrixSetColumnUserData() | ||
Widget | w; | |
int | column; | |
XtPointer | data; |
XbaeMatrixSetColumnUserData() allows the application developer to programmatically associate user data for the specified column.
void XbaeMatrixSetRowBackgrounds() | ||
Widget | w; | |
int | position; | |
Pixel | *colors; | |
int | num_colors; |
XbaeMatrixSetRowBackgrounds() is a convenient way to specify and modify the XmNcellBackgrounds resource when setting the background of an entire row or rows. If XmNcellBackgrounds is NULL, then XbaeMatrixSetRowBackgrounds() will create a Pixel table initialized to XmNforeground except for the rows specified in it's arguments. If XmNcellBackgrounds is not NULL, then XbaeMatrixSetRowBackgrounds() will changed the specified rows in that resource to the specified colors.
void XbaeMatrixSetRowColors() | ||
Widget | w; | |
int | position; | |
Pixel | *colors; | |
int | num_colors; |
XbaeMatrixSetRowColors() is a convenient way to specify and modify the XmNcolors resource when setting the color of an entire row or rows. If XmNcolors is NULL, then XbaeMatrixSetRowColors() will create a Pixel table initialized to XmNforeground except for the rows specified in it's arguments. If XmNcolors is not NULL, then XbaeMatrixSetRowColors() will changed the specified rows in that resource to the specified colors.
void XbaeMatrixSetRowHeight() | ||
Widget | w; | |
int | row; | |
int | height; |
XbaeMatrixSetRowHeight() is a convenient way to change the height of a row without the need to allocate an array with row height numbers. Passing -1 as the new height will reset the row's height to the default value.
void XbaeMatrixSetRowLabel() | ||
Widget | w; | |
int | row; | |
String | value; |
XbaeMatrixSetRowLabel() allows the application developer to programmatically change the label of the specified row.
void XbaeMatrixSetRowShadow() | ||
Widget | w; | |
int | column; | |
unsigned char | shadow_type; |
XbaeMatrixSetRowShadow() allows the application developer to programmatically change the shadow for the specified row.
void XbaeMatrixSetRowUserData() | ||
Widget | w; | |
int | column; | |
XtPointer | data; |
XbaeMatrixSetRowUserData() allows the application developer to programmatically associate user data for the specified row.
void XbaeMatrixSetXmColumnLabel() | ||
Widget | w; | |
int | column; | |
XmString | value; |
XbaeMatrixSetXmColumnLabel() allows the application developer to programmatically change the xmLabel of a specified column.
void XbaeMatrixSetXmRowLabel() | ||
Widget | w; | |
int | row; | |
XmString | value; |
XbaeMatrixSetXmRowLabel() allows the application developer to programmatically change the xmLabel of a specified row.
void XbaeMatrixSortColumns() | ||
Widget | w; | |
int | (*proc)(Widget, int, int, void *); | |
void | *user_data; |
XbaeMatrixSortColumns allows you to sort the columns in the XbaeMatrix widget according to criteria determined by the proc function. The proc function should have the above signature and functionality as demanded by the qsort(3) function. It will be called with a the matrix being sorted, the indices of two columns to compare and the user_data pointer XbaeMatrixSortColumns was called with. It should return -1, 0, or 1 as appropriate. It is guaranteed that the matrix does not change while sorting and the necessary reordering will only take place after the last call to proc has been made.
void XbaeMatrixSortRows() | ||
Widget | w; | |
int | (*proc)(Widget, int, int, void *); | |
void | *user_data; |
XbaeMatrixSortRows allows you to sort the rows in the XbaeMatrix widget according to criteria determined by the proc function. The proc function should have the above signature and functionality as demanded by the qsort(3) function. It will be called with the matrix being sorted, the indices of two rows to compare and the user_data pointer XbaeMatrixSortRows was called with. It should return -1, 0, or 1 as appropriate. It is guaranteed that the matrix does not change while sorting and the necessary reordering will only take place after the last call to proc has been made.
void XbaeMatrixUnhighlightAll() | ||
Widget | w; |
XbaeMatrixUnhighlightAll() allows the application developer to programmatically unhighlight all cells. XbaeMatrixUnhighlightAll() erases the highlight from all cells. All unsigned chars in the XmNhighlightedCells array will be set to HighlightNone.
void XbaeMatrixUnhighlightCell() | ||
Widget | w; | |
int | row; | |
int | column; |
XbaeMatrixUnhighlightCell() allows the application developer to programmatically unhighlight a cell. XbaeMatrixUnhighlightCell() erases the highlight from the cell. The corresponding unsigned char in the XmNhighlightedCells array will be have its HighlightCell bit cleared.
void XbaeMatrixUnhighlightColumn() | ||
Widget | w; | |
int | column; |
XbaeMatrixUnhighlightColumn() allows the application developer to programmatically unhighlight a column. XbaeMatrixUnhighlightColumn() erases the highlight from around the column if XmNgridType is XmGRID_COLUMN_SHADOW or from around each cell in the column otherwise. The corresponding unsigned chars in the XmNhighlightedCells array will be have its HighlightColumn or HighlightOther bit cleared, depending on whether XmNgridType is set to XmGRID_COLUMN_SHADOW or not.
void XbaeMatrixUnhighlightRow() | ||
Widget | w; | |
int | row; |
XbaeMatrixUnhighlightRow() allows the application developer to programmatically unhighlight a row. XbaeMatrixUnhighlightRow() erases the highlight from around the row if XmNgridType is XmGRID_ROW_SHADOW or from around each cell in the row otherwise. The corresponding unsigned chars in the XmNhighlightedCells array will be have its HighlightRow or HighlightOther bit cleared, depending on whether XmNgridType is set to XmGRID_ROW_SHADOW or not.
int XbaeMatrixVisibleCells() | ||
Widget | w; | |
int | *top_row; | |
int | *bottom_row; | |
int | *left_column; | |
int | *right_column; |
XbaeMatrixVisibleCells() allows the the application developer to obtain the currently visible portion of the XbaeMatrix w.
int XbaeMatrixVisibleColumns() | ||
Widget | w; |
XbaeMatrixVisibleColumns() allows the the application developer to programmatically check how many columns are currently displayed in the XbaeMatrix w. A partially visible column will be declared an entire column.
int XbaeMatrixVisibleRows() | ||
Widget | w; |
XbaeMatrixVisibleRows() allows the the application developer to programmatically check how many rows are currently displayed in the XbaeMatrix w. A partially visible row will be declared an entire row.
int XbaeGetVersionNum() |
XbaeGetVersionNum() is a function that returns the numeric representation of the version of the Xbae library that your program is working with. This is the run-time version of the Xbae widgets, where XbaeVersion is a macro that represents the compile-time version.
The numeric representation is a simple calculation based on the major, minor, and pico numbers representing an Xbae widget release. E.g. version 4.8.1 would be represented as 40801.
Releases prior to 4.8.0 didn't have this functionality.
char * XbaeGetVersionText() |
XbaeGetVersionText() is a function that returns the textual representation of the version of the Xbae library that your program is working with. This is the run-time version of the Xbae widgets, where XbaeVersionTxt is a macro that represents the compile-time version.
Using XtSetValues to set the Matrix's XmNwidth resource to 0 will cause it to recompute it's horizontal size. It will request a new size which results in XmNvisibleColumns columns being displayed. If XmNvisibleColumns is 0, then it will request a new size such that it does not need a horizontal ScrollBar (full horizontal size).
Using XtSetValues to set the Matrix's XmNheight resource to 0 will cause it to recompute it's vertical size. It will request a new size which results in XmNvisibleRows rows being displayed. If XmNvisibleRows is 0, then it will request a new size such that it does not need a vertical ScrollBar (full vertical size).
An XtSetValues on XmNvisibleRows will cause the Matrix to request a new size which results in XmNvisibleRows non-fixed rows being displayed, only if the new value is different than the old one.
An XtSetValues on XmNvisibleColumns will cause the Matrix to request a new size which results in the first XmNvisibleColumns non-fixed columns being displayed, only if the new value is different than the old one.
An XtSetValues on any other resource will not result in a request for a new size. Setting other resources in conjunction with setting XmNwidth and/or XmNheight to 0 allows for more control of the Matrix's geometry.
An XtSetValues setting XmNrowLabelWidth to 0 will cause XmNrowLabelWidth to be set to the width of the longest row label.
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(3X).
Andrew Wason (aw@bae.bellcore.com) of Bellcore, Piscataway NJ, wrote the original version of the Xbae widgets. His final release of the widgets was version 3.8.
Kevin Brannen (kbrannen@metronet.com) took over maintainership following Andrew Wason's departure and released version 4.0.
Andrew Lister (lister@db.com) maintained from 1995 to 1999.
Andrew Wason for the original idea and source code.
Jay Schmidgall for his contributions.
Nick Banyard for providing the multibyte extensions.
Callum Gibson for the pattern parsing in the XbaeInput widget.
Sascha Goebel for debugging the scroll-per-pixel code.
Tobias Oed for lots of code cleanup and debugging.
The people from Arcad Systemhaus for code submission for XbaeMatrixSort and a
couple of related functionalities, and easier pixmap support.
This document describes XbaeMatrix, version 4.60.4.
Core(3X), Composite(3X), XmManager(3X), XmScrollBar(3X), XbaeInput(3X), XmText(3X)
Bellcore, previous and current maintainers of the Xbae widgets (collectively 'authors') provide this information solely to professionals who have the appropriate degree of experience to understand and interpret its contents in accordance with generally accepted engineering or other professional standards and applicable regulations. No recommendations as to products or vendors is made or should be implied.
While the information contained herein has been prepared from sources deemed to be reliable, the authors reserve the right to revise the information without notice, but has no obligation to do so. Unless the recipient has been expressly granted a license by Bellcore under separate applicable written agreement with Bellcore, no license, expressed or implied, is granted under any patents, copyrights or other intellectual property rights. Use of the information is at your discretion and shall not be deemed an inducement by Bellcore to infringe any existing or later-issued patent, copyrights or other intellectual property right.
THE AUTHORS MAKE NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EXPRESS OR IMPLIED, WITH RESPECT TO THE INFORMATION, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST INFRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE INFORMATION IS PROVIDED ``AS IS'', AND IN NO EVENT SHALL THE AUTHORS OR ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELATING TO THE INFORMATION.
Copyright 1991, 1992 Bellcore.
Copyright 1995-99 Andrew Lister All Rights Reserved.
Copyright 1999-2002 LessTif Developers
The above no warranty extends to all additions and contributions. No contributor shall be held liable; this work is provided ``as is''. If this is a problem for you, then don't use this software.
2019-03-16 | 4.60.4 |