Matrix.h 20.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
/*
 * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
 *                        All rights reserved
 * Permission to use, copy, modify and distribute this material for
 * any purpose and without fee is hereby granted, provided that the
 * above copyright notice and this permission notice appear in all
 * copies, and that the name of Bellcore not be used in advertising
 * or publicity pertaining to this material without the specific,
 * prior written permission of an authorized representative of
 * Bellcore.
 *
 * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
 * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
 * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
 * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
 * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
 * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
 * ING TO THE SOFTWARE.
 *
 * MatrixWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
 *
 */

#ifndef _Xbae_Matrix_h
#define _Xbae_Matrix_h

/*
 * Matrix Widget public include file
 */

#include <Xm/Xm.h>
#include <X11/Core.h>
#include "patchlevel.h"

/*
 * A few definitions we like to use, but those with R4 won't have.
 * From Xfuncproto.h in R5.
 */

#ifndef XlibSpecificationRelease
# ifndef _XFUNCPROTOBEGIN
#   ifdef __cplusplus                      /* for C++ V2.0 */
#     define _XFUNCPROTOBEGIN extern "C" {   /* do not leave open across includes */
#     define _XFUNCPROTOEND }
#   else
#     define _XFUNCPROTOBEGIN
#     define _XFUNCPROTOEND
#   endif
# endif /* _XFUNCPROTOBEGIN */
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Resources:
 * Name			Class			RepType		Default Value
 * ----			-----			-------		-------------
 * allowColumnResize	ColumnResize		Boolean		False
 * altRowCount		AltRowCount		int		1
 * boldLabels		BoldLabels		Boolean		False
 * buttonLabels		ButtonLabels		Boolean		False
 * buttonLabelBackground Color			Pixel		dynamic
 * cellBackgrounds	Colors			PixelTable	NULL
 * cellHighlightThickness HighlightThickness	HorizontalDimension 2
 * cellMarginHeight	MarginHeight		VerticalDimension   5
 * cellMarginWidth	MarginWidth		HorizontalDimension 5
 * cells		Cells			StringTable	NULL
 * cellShadowThickness	ShadowThickness		Dimension	2
 * cellShadowType	ShadowType		unsigned char	SHADOW_OUT
 * cellShadowTypes	CellShadowTypes		ShadowTypeTable NULL
 * cellUserData		CellUserData		UserDataTable	NULL
 * clipWindow		XmCClipWindow		Widget		NULL (get only)
 * colors		Colors			PixelTable	NULL
 * columnAlignments	Alignments		AlignmentArray	dynamic
 * columnLabelAlignments Alignments		AlignmentArray	dynamic
 * columnLabelColor	Color			Pixel		dynamic
 * columnLabels		Labels			StringArray	NULL
 * columnMaxLengths	ColumnMaxLengths	MaxLengthArray	NULL
 * columnShadowTypes	ShadowTypes		ShadowTypeArray NULL
 * columnUserData	UserDatas		UserDataArray	NULL
 * columnWidths		ColumnWidths		WidthArray	NULL
 * columns		Columns			int		0
 * defaultActionCallback Callback               Callback        NULL
 * doubleClickInterval  Interval                int             dynamic
 * drawCellCallback	Callback		Callback	NULL
 * enterCellCallback	Callback		Callback	NULL
 * evenRowBackground	Background		Pixel		dynamic
 * fill			Fill			Boolean		False
 * fixedColumns		FixedColumns		Dimension	0
 * fixedRows		FixedRows		Dimension	0
 * fontList		FontList		FontList	fixed
 * labelFont		FontList		FontList	fixed
 * gridLineColor	Color			Pixel		dynamic
 * gridType		GridType		GridType	XmGRID_LINE
 * highlightedCells	HighlightedCells	HighlightTable	dynamic
 * horizonalScrollBar	HorizonalScrollBar	Widget		NULL (get only)
 * horizontalScrollBarDisplayPolicy
 *			XmCMatrixScrollBarDisplayPolicy
 *						unsigned char	AS_NEEDED
 * labelActivateCallback Callback		Callback	NULL
 * leaveCellCallback	Callback		Callback	NULL
 * leftColumn           LeftColumn              int             0
 * modifyVerifyCallback	Callback		Callback	NULL
 * oddRowBackground	Background		Pixel		NULL
 * processDragCallback	Callback		Callback	NULL
 * resizeCallback	Callback		Callback	NULL
 * resizeColumnCallback	Callback		Callback	NULL
 * reverseSelect	reverseSelect		Boolean		False
 * rowLabelAlignment	Alignment		Alignment	XmALIGNMENT_END
 * rowLabelColor	Color			Pixel		dynamic
 * rowLabelWidth	RowLabelWidth		Short		dynamic
 * rowLabels		Labels			StringArray	NULL
 * rowShadowTypes	ShadowTypes		ShadowTypeArray NULL
 * rowUserData		UserDatas		UserDataArray	NULL
 * rows			Rows			int		0
 * selectCellCallback	Callback		Callback	NULL
 * selectedBackground	Color			Pixel		dynamic
 * selectedCells	SelectedCells		BooleanTable	dynamic
 * selectedForeground	Color			Pixel		dynamic
 * selectScrollVisible	SelectScrollVisible	Boolean		True
 * space		Space			Dimension	6
 * shadowType		ShadowType		unsigned char	SHADOW_OUT
 * textBackground	Backgound		Pixel   	dynamic
 * textField		TextField		Widget		NULL (get only)
 * textTranslations	Translations		TranslationTable dynamic
 * topRow		TopRow			int		0
 * trailingFixedColumns	TrailingFixedColumns	Dimension	0
 * trailingFixedRows	TrailingFixedRows	Dimension	0
 * traverseCellCallback	Callback		Callback	NULL
 * verticalScrollBar	VerticalScrollBar	Widget		NULL (get only)
 * verticalScrollBarDisplayPolicy
 *			XmCMatrixScrollBarDisplayPolicy
 *						unsigned char	AS_NEEDED
 * visibleColumns	VisibleColumns		Dimension	0
 * visibleRows		VisibleRows		Dimension	0
 * writeCellCallback	Callback		Callback	NULL
 */

#define XmNallowColumnResize		"allowColumnResize"
#define XmNaltRowCount			"altRowCount"
#define XmNboldLabels			"boldLabels"
#define XmNbuttonLabels			"buttonLabels"
#define XmNbuttonLabelBackground	"buttonLabelBackground"
#define XmNcellBackgrounds		"cellBackgrounds"
#define XmNcellHighlightThickness	"cellHighlightThickness"
#define XmNcellMarginHeight		"cellMarginHeight"
#define XmNcellMarginWidth		"cellMarginWidth"
#define XmNcellShadowType		"cellShadowType"
#define XmNcellShadowTypes		"cellShadowTypes"
#define XmNcellShadowThickness		"cellShadowThickness"
#define XmNcellUserData			"cellUserData"
#if CELL_WIDGETS
#define XmNcellWidgets			"cellWidgets"
#endif
#define XmNcells			"cells"
#define XmNcolors			"colors"
#define XmNcolumnAlignments		"columnAlignments"
#define XmNcolumnLabelAlignments	"columnLabelAlignments"
#define XmNcolumnLabelBackground	"columnLabelBackground"
#define XmNcolumnLabelColor		"columnLabelColor"
#define XmNcolumnLabels			"columnLabels"
#define XmNcolumnMaxLengths		"columnMaxLengths"
#define XmNcolumnShadowTypes		"columnShadowTypes"
#define XmNcolumnUserData		"columnUserData"
#define XmNcolumnWidths			"columnWidths"
#define XmNeditVerifyCallback		"editVerifyCallback"
#define XmNdrawCellCallback		"drawCellCallback"
#define XmNenterCellCallback		"enterCellCallback"
#define XmNevenRowBackground		"evenRowBackground"
#define XmNfill				"fill"
#define XmNfixedColumns			"fixedColumns"
#define XmNfixedRows			"fixedRows"
#define XmNgridLineColor		"gridLineColor"
#define XmNgridType			"gridType"
#if XmVersion >= 1002
#define XmNhighlightedCells		"highlightedCells"
#endif
#define XmNhorizontalScrollBarDisplayPolicy "horizontalScrollBarDisplayPolicy"
#define XmNlabelActivateCallback	"labelActivateCallback"
#define XmNlabelFont			"labelFont"
#define XmNleaveCellCallback		"leaveCellCallback"
#define XmNleftColumn			"leftColumn"
#define XmNoddRowBackground		"oddRowBackground"
#define XmNprocessDragCallback		"processDragCallback"
#ifndef XmNresizeCallback
#define XmNresizeCallback               "resizeCallback"
#endif
#define XmNresizeColumnCallback		"resizeColumnCallback"
#define XmNreverseSelect		"reverseSelect"
#define XmNrowLabelAlignment		"rowLabelAlignment"
#define XmNrowLabelWidth		"rowLabelWidth"
#define XmNrowLabelBackground		"rowLabelBackground"
#define XmNrowLabelColor		"rowLabelColor"
#define XmNrowLabels			"rowLabels"
#define XmNrowShadowTypes		"rowShadowTypes"
#define XmNrowUserData			"rowUserData"
#define XmNselectedCells		"selectedCells"
#define XmNselectedBackground		"selectedBackground"
#define XmNselectCellCallback		"selectCellCallback"
#define XmNselectedForeground		"selectedForeground"
#define XmNselectScrollVisible		"selectScrollVisible"
#define XmNtextBackground		"textBackground"
#define XmNtextField			"textField"
#define XmNtopRow			"topRow"
#define XmNtrailingFixedColumns		"trailingFixedColumns"
#define XmNtrailingFixedRows		"trailingFixedRows"
#define XmNleftColumn			"leftColumn"
#define XmNtraverseCellCallback		"traverseCellCallback"
#define XmNverticalScrollBarDisplayPolicy "verticalScrollBarDisplayPolicy"
#define XmNvisibleColumns		"visibleColumns"
#define XmNvisibleRows			"visibleRows"
#define XmNwriteCellCallback		"writeCellCallback"


#define XmCAlignments			"Alignments"
#define XmCAltRowCount			"AltRowCount"
#define XmCBoldLabels			"BoldLabels"
#define XmCButtonLabels			"ButtonLabels"
#define XmCCells			"Cells"
#define XmCCellShadowTypes		"CellShadowTypes"
#define XmCCellUserData			"CellUserData"
#if CELL_WIDGETS
#define XmCCellWidgets			"CellWidgets"
#endif
#define XmCColors			"Colors"
#define XmCColumnMaxLengths		"ColumnMaxLengths"
#define XmCColumnResize			"ColumnResize"
#define XmCColumnWidths			"ColumnWidths"
#define XmCFill				"Fill"
#define XmCFixedColumns			"FixedColumns"
#define XmCFixedRows			"FixedRows"
#define XmCGridType			"GridType"
#if XmVersion >= 1002
#define XmCHighlightedCells		"HighlightedCells"
#endif
#define XmCLabels			"Labels"
#define XmCLeftColumn			"LeftColumn"
#define XmCMatrixScrollBarDisplayPolicy	"MatrixScrollBarDisplayPolicy"
#define XmCReverseSelect		"ReverseSelect"
#define XmCRowLabelWidth		"RowLabelWidth"
#define XmCSelectedCells		"SelectedCells"
#define XmCSelectScrollVisible		"SelectScrollVisible"
#define XmCShadowTypes			"ShadowTypes"
#define XmCTextBackground		"TextBackground"
#define XmCTextField			"TextField"
#define XmCTopRow			"TopRow"
#define XmCTrailingFixedColumns		"TrailingFixedColumns"
#define XmCTrailingFixedRows		"TrailingFixedRows"
#define XmCUserDatas			"UserDatas"
#define XmCVisibleColumns		"VisibleColumns"
#define XmCVisibleRows			"VisibleRows"

#ifndef XmRStringArray
#define XmRStringArray			"StringArray"
#endif

#define XmRAlignmentArray		"AlignmentArray"
#define XmRBooleanTable			"BooleanTable"
#define XmRCellTable			"CellTable"
#define XmRWidgetTable			"WidgetTable"
#define XmRGridType			"GridType"
#if XmVersion >= 1002
#define XmRHighlightTable		"HighlightTable"
#endif
#define XmRMatrixScrollBarDisplayPolicy "MatrixScrollBarDisplayPolicy"
#define XmRMaxLengthArray		"MaxLengthArray"
#define XmRPixelTable			"PixelTable"
#define XmRShadowTypeTable		"ShadowTypeTable"
#define XmRShadowTypeArray		"ShadowTypeArray"
#define XmRUserDataTable		"UserDataTable"
#define XmRUserDataArray		"UserDataArray"
#define XmRWidthArray			"WidthArray"


#ifndef XbaeIsXbaeMatrix
#define XbaeIsXbaeMatrix( w )	XtIsSubclass(w, xbaeMatrixWidgetClass)
#endif /* XbaeIsXbaeMatrix */

/* Class record constants */

externalref WidgetClass xbaeMatrixWidgetClass;

typedef struct _XbaeMatrixClassRec *XbaeMatrixWidgetClass;
typedef struct _XbaeMatrixRec *XbaeMatrixWidget;

/*
 * A few definitions we like to use, but those with R4 won't have.
 * From Xfuncproto.h.
 */

/*
 * Prototype wrapper
 */
#ifndef P
#if defined(__STDC__) || defined (__cplusplus)
#define P(x)		x
#else
#define P(x)		()
#define const
#define volatile
#endif
#endif

#ifndef XlibSpecificationRelease
# ifndef _XFUNCPROTOBEGIN
#   ifdef __cplusplus                      /* for C++ V2.0 */
#     define _XFUNCPROTOBEGIN extern "C" {
#     define _XFUNCPROTOEND }
#   else
#     define _XFUNCPROTOBEGIN
#     define _XFUNCPROTOEND
#   endif
# endif /* _XFUNCPROTOBEGIN */
#else
#include <X11/Xfuncproto.h>
#endif

/*
 * External interfaces to class methods
 */
_XFUNCPROTOBEGIN

extern void XbaeMatrixAddColumns P(( Widget w, int position, String *cols,
				     String *labels, short *widths,
				     int *max_lengths,
				     unsigned char *alignments,
				     unsigned char *label_alignments,
				     Pixel *colors, int num_columns ));
extern void XbaeMatrixAddRows P(( Widget w, int position, String *rows,
				  String *labels, Pixel *colors,
				  int num_rows ));
extern void XbaeMatrixCancelEdit P(( Widget w, Boolean unmap ));
extern Boolean XbaeMatrixCommitEdit P(( Widget w, Boolean unmap ));
extern void XbaeMatrixDeleteColumns P(( Widget w, int position,
					int num_columns ));
extern void XbaeMatrixDeleteRows P(( Widget w, int position, int num_rows ));
extern void XbaeMatrixDeselectAll P(( Widget w ));
extern void XbaeMatrixDeselectCell P(( Widget w, int row, int column ));
extern void XbaeMatrixDeselectColumn P(( Widget w, int column ));
extern void XbaeMatrixDeselectRow P(( Widget w, int row ));
extern void XbaeMatrixEditCell P(( Widget w, int row, int column ));
extern void XbaeMatrixFirstSelectedCell P(( Widget w, int *row, int *column ));
extern int XbaeMatrixFirstSelectedColumn P(( Widget w ));
extern int XbaeMatrixFirstSelectedRow P(( Widget w ));
extern String XbaeMatrixGetCell P(( Widget w, int row, int column ));
extern XtPointer XbaeMatrixGetCellUserData P(( Widget w, int row,
					       int column ));
extern XtPointer XbaeMatrixGetColumnUserData P(( Widget w, int column ));
extern void XbaeMatrixGetCurrentCell P(( Widget	w, int *row, int *column ));
extern int XbaeMatrixGetEventRowColumn P(( Widget w, XEvent *event,
					   int *row, int *column ));
extern int XbaeMatrixGetNumSelected P(( Widget ));
extern XtPointer XbaeMatrixGetRowUserData P(( Widget w, int row ));
extern Boolean XbaeMatrixIsCellSelected P(( Widget w, int row, int column ));
extern Boolean XbaeMatrixIsColumnSelected P(( Widget w, int column ));
extern Boolean XbaeMatrixIsRowSelected P(( Widget w, int row ));
extern void XbaeMatrixRefresh P(( Widget w ));
extern void XbaeMatrixSelectAll P(( Widget w ));
extern void XbaeMatrixSelectCell P(( Widget w, int row, int column ));
extern void XbaeMatrixSelectColumn P(( Widget w, int column ));
extern void XbaeMatrixSelectRow P(( Widget w, int row ));
#if XmVersion >= 1002
extern void XbaeMatrixHighlightCell P(( Widget w, int row, int column ));
extern void XbaeMatrixHighlightRow P(( Widget w, int row ));
extern void XbaeMatrixHighlightColumn P(( Widget w, int column ));
extern void XbaeMatrixUnhighlightCell P(( Widget w, int row, int column ));
extern void XbaeMatrixUnhighlightRow P(( Widget w, int row ));
extern void XbaeMatrixUnhighlightColumn P(( Widget w, int column ));
extern void XbaeMatrixUnhighlightAll P(( Widget w ));
#endif
extern void XbaeMatrixSetCell P(( Widget w, int row, int column,
				  const String value ));
extern void XbaeMatrixSetCellBackground P(( Widget w, int row, int column,
					    Pixel color ));
extern void XbaeMatrixSetCellColor P(( Widget w, int row, int column,
				       Pixel color ));
extern void XbaeMatrixSetCellUserData P(( Widget w, int row, int column,
					  XtPointer data ));
#if CELL_WIDGETS
extern void XbaeMatrixSetCellWidget P(( Widget w, int row, int column,
					Widget widget ));
#endif
extern void XbaeMatrixSetColumnBackgrounds P(( Widget w, int position,
					       Pixel *colors,
					       int num_colors ));
extern void XbaeMatrixSetColumnColors P(( Widget w, int position,
					  Pixel *colors, int num_colors ));
extern void XbaeMatrixSetColumnUserData P(( Widget w, int column,
					    XtPointer data ));
extern void XbaeMatrixSetRowBackgrounds P(( Widget w, int position,
					    Pixel *colors, int num_colors ));
extern void XbaeMatrixSetRowColors P(( Widget w, int position, Pixel *colors,
				       int num_colors ));
extern void XbaeMatrixSetRowUserData P(( Widget w, int row, XtPointer data ));

extern int XbaeMatrixVisibleColumns P(( Widget w ));
extern int XbaeMatrixVisibleRows P(( Widget w ));
extern int XbaeMatrixNumColumns P(( Widget w ));
extern int XbaeMatrixNumRows P(( Widget w ));
extern int XbaeMatrixXToCol P(( Widget w, int x ));
extern int XbaeMatrixYToRow P(( Widget w, int y ));

extern void XbaeMatrixDisableRedisplay P(( Widget w ));
extern void XbaeMatrixEnableRedisplay P(( Widget w, Boolean redisplay));

_XFUNCPROTOEND

typedef unsigned char	Alignment;
typedef Alignment *	AlignmentArray;
typedef String *	StringTable;
typedef short 		Width;
typedef Width *		WidthArray;
typedef int 		MaxLength;
typedef MaxLength *	MaxLengthArray;

/*
 * cell shadow types
 */
 
enum
{
    XmGRID_NONE,
    XmGRID_LINE,
    XmGRID_SHADOW_IN,
    XmGRID_SHADOW_OUT,
    XmGRID_ROW_SHADOW,
    XmGRID_COLUMN_SHADOW
};


/*
 * Enumeration for Matrix ScrollBar Display Policy
 */
enum
{
    XmDISPLAY_NONE,
    XmDISPLAY_AS_NEEDED,
    XmDISPLAY_STATIC
};


/*
 * Enumeration for type of a cell
 */
typedef enum {
    FixedCell, NonFixedCell, RowLabelCell, ColumnLabelCell
} CellType;

#if XmVersion >= 1002
/*
 * Enumeration for highlight reason/location
 */
enum {
    HighlightNone	= 0x0000,
    HighlightCell	= 0x0001,
    HighlightRow	= 0x0002,
    HighlightColumn	= 0x0004,
    HighlightOther	= 0x0008,
    UnhighlightCell	= 0x0010,
    UnhighlightRow	= 0x0020,
    UnhighlightColumn	= 0x0040,
    UnhighlightAll	= UnhighlightCell | UnhighlightRow | UnhighlightColumn
};
#endif

/*
 * Callback reasons.  Try to stay out of range of the Motif XmCR_* reasons.
 */
typedef enum _XbaeReasonType
{
    XbaeModifyVerifyReason = 102,
    XbaeEnterCellReason,
    XbaeLeaveCellReason,
    XbaeTraverseCellReason,
    XbaeSelectCellReason,
    XbaeDrawCellReason,
    XbaeWriteCellReason,
    XbaeResizeReason,
    XbaeResizeColumnReason,
    XbaeDefaultActionReason,
    XbaeProcessDragReason,
    XbaeLabelActivateReason
}
XbaeReasonType;

/*
 * DrawCell types.
 */
typedef enum
{
    XbaeString=1,
    XbaePixmap
}
XbaeCellType;

/*
 * Struct passed to modifyVerifyCallback
 */
typedef struct _XbaeMatrixModifyVerifyCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    XmTextVerifyCallbackStruct *verify;
    const char *prev_text;
}
XbaeMatrixModifyVerifyCallbackStruct;

/*
 * Struct passed to enterCellCallback
 */
typedef struct _XbaeMatrixEnterCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    Boolean select_text;
    Boolean doit;
}
XbaeMatrixEnterCellCallbackStruct;

/*
 * Struct passed to leaveCellCallback
 */
typedef struct _XbaeMatrixLeaveCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    String value;
    Boolean doit;
}
XbaeMatrixLeaveCellCallbackStruct;

/*
 * Struct passed to traverseCellCallback
 */
typedef struct _XbaeMatrixTraverseCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    int next_row, next_column;
    int fixed_rows, fixed_columns;
    int trailing_fixed_rows, trailing_fixed_columns;
    int num_rows, num_columns;
    String param;
    XrmQuark qparam;
}
XbaeMatrixTraverseCellCallbackStruct;

/*
 * Struct passed to selectCellCallback
 */
typedef struct _XbaeMatrixSelectCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    Boolean **selected_cells;
    String **cells;
    Cardinal num_params;
    String *params;
    XEvent *event;
}
XbaeMatrixSelectCellCallbackStruct;

/*
 * Struct passed to drawCellCallback
 */
typedef struct _XbaeMatrixDrawCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    int width, height;
    XbaeCellType type;
    String string;
    Pixmap pixmap;
    Pixmap mask;
    Pixel foreground, background;
}
XbaeMatrixDrawCellCallbackStruct;

/*
 * Struct passed to writeCellCallback
 */
typedef struct _XbaeMatrixWriteCellCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    XbaeCellType type;
    String string;
    Pixmap pixmap;
    Pixmap mask;
}
XbaeMatrixWriteCellCallbackStruct;


/*
 * Struct passed to resizeCallback
 */
typedef struct _XbaeMatrixResizeCallbackStruct
{
    XbaeReasonType reason;
    Dimension width;
    Dimension height;
}
XbaeMatrixResizeCallbackStruct;

/*
 * Struct passed to resizeColumnCallback
 *
 */
typedef struct _XbaeMatrixResizeColumnCallbackStruct
{
    XbaeReasonType reason;
    int which;
    int columns;    
    short *column_widths;
    XEvent *event;
}
XbaeMatrixResizeColumnCallbackStruct;


/*
 * Struct passed to processDragCallback
 */
typedef struct _XbaeMatrixProcessDragCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    String string;
    XbaeCellType type;
    Pixmap pixmap;
    Pixmap mask;
    Cardinal num_params;
    String *params;
    XEvent *event;
}
XbaeMatrixProcessDragCallbackStruct;


/*
 * Struct passed to defaultActionCallback
 */
typedef struct _XbaeMatrixDefaultActionCallbackStruct
{
    XbaeReasonType reason;
    int row, column;
    XEvent *event;
}
XbaeMatrixDefaultActionCallbackStruct;

/*
 * Struct passed to labelActivateCallback
 */
typedef struct _XbaeMatrixLabelActivateCallbackStruct
{
    XbaeReasonType reason;
    Boolean row_label;
    int row, column;
    String label;
}
XbaeMatrixLabelActivateCallbackStruct;


/* provide clean-up for those with R4 */
#ifndef XlibSpecificationRelease
# undef _Xconst
# undef _XFUNCPROTOBEGIN
# undef _XFUNCPROTOEND
#endif

#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _Xbae_Matrix_h */