2
* Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
3
* Copyright(c) 1995-99 Andrew Lister
5
* Permission to use, copy, modify and distribute this material for
6
* any purpose and without fee is hereby granted, provided that the
7
* above copyright notice and this permission notice appear in all
8
* copies, and that the name of Bellcore not be used in advertising
9
* or publicity pertaining to this material without the specific,
10
* prior written permission of an authorized representative of
13
* BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
14
* PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
15
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
* FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
17
* FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
18
* SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
19
* ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
20
* LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
21
* ING TO THE SOFTWARE.
23
* MatrixWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
29
* MatrixP.h - Private definitions for Matrix widget
32
#ifndef _Xbae_MatrixP_h
33
#define _Xbae_MatrixP_h
38
# include <Xm/ManagerP.h>
44
#if defined(__STDC__) || defined (__cplusplus)
54
* A few definitions we like to use, but those with R4 won't have.
55
* From Xfuncproto.h in R5.
58
#ifndef XlibSpecificationRelease
59
# ifndef _XFUNCPROTOBEGIN
60
# ifdef __cplusplus /* for C++ V2.0 */
61
# define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
62
# define _XFUNCPROTOEND }
64
# define _XFUNCPROTOBEGIN
65
# define _XFUNCPROTOEND
67
# endif /* _XFUNCPROTOBEGIN */
69
#include <X11/Xfuncproto.h>
73
* New types for the class methods
77
typedef void (*XbaeMatrixSetCellProc) P((XbaeMatrixWidget, int, int,
78
const String, Boolean));
80
typedef String (*XbaeMatrixGetCellProc) P((XbaeMatrixWidget, int, int));
82
typedef void (*XbaeMatrixEditCellProc) P((XbaeMatrixWidget, XEvent *,
83
int, int, String *, Cardinal));
85
typedef void (*XbaeMatrixSelectCellProc) P((XbaeMatrixWidget, int, int));
87
typedef void (*XbaeMatrixSelectRowProc) P((XbaeMatrixWidget, int));
89
typedef void (*XbaeMatrixSelectColumnProc) P((XbaeMatrixWidget, int));
91
typedef void (*XbaeMatrixDeselectAllProc) P((XbaeMatrixWidget));
93
typedef void (*XbaeMatrixSelectAllProc) P((XbaeMatrixWidget));
95
typedef void (*XbaeMatrixDeselectCellProc) P((XbaeMatrixWidget, int, int));
97
typedef void (*XbaeMatrixDeselectRowProc) P((XbaeMatrixWidget, int));
99
typedef void (*XbaeMatrixDeselectColumnProc) P((XbaeMatrixWidget, int));
101
typedef Boolean (*XbaeMatrixCommitEditProc) P((XbaeMatrixWidget, XEvent *,
104
typedef void (*XbaeMatrixCancelEditProc) P((XbaeMatrixWidget, Boolean));
106
typedef void (*XbaeMatrixAddRowsProc) P((XbaeMatrixWidget, int, String *,
107
String *, Pixel *, Pixel *, int));
109
typedef void (*XbaeMatrixDeleteRowsProc) P((XbaeMatrixWidget, int, int));
111
typedef void (*XbaeMatrixAddColumnsProc) P((XbaeMatrixWidget, int, String *,
112
String *, short *, int *,
113
unsigned char*, unsigned char *,
114
Pixel *, Pixel *, int));
116
typedef void (*XbaeMatrixDeleteColumnsProc) P((XbaeMatrixWidget, int, int));
118
typedef void (*XbaeMatrixSetRowColorsProc) P((XbaeMatrixWidget, int, Pixel *,
121
typedef void (*XbaeMatrixSetColumnColorsProc) P((XbaeMatrixWidget, int,
122
Pixel *, int, Boolean));
124
typedef void (*XbaeMatrixSetCellColorProc) P((XbaeMatrixWidget, int, int,
130
* Different than the traversal directions in Xm.h
132
#define NOT_TRAVERSING -1
135
* New fields for the Matrix widget class record
138
XbaeMatrixSetCellProc set_cell;
139
XbaeMatrixGetCellProc get_cell;
140
XbaeMatrixEditCellProc edit_cell;
141
XbaeMatrixSelectCellProc select_cell;
142
XbaeMatrixSelectRowProc select_row;
143
XbaeMatrixSelectColumnProc select_column;
144
XbaeMatrixDeselectAllProc deselect_all;
145
XbaeMatrixSelectAllProc select_all;
146
XbaeMatrixDeselectCellProc deselect_cell;
147
XbaeMatrixDeselectRowProc deselect_row;
148
XbaeMatrixDeselectColumnProc deselect_column;
149
XbaeMatrixCommitEditProc commit_edit;
150
XbaeMatrixCancelEditProc cancel_edit;
151
XbaeMatrixAddRowsProc add_rows;
152
XbaeMatrixDeleteRowsProc delete_rows;
153
XbaeMatrixAddColumnsProc add_columns;
154
XbaeMatrixDeleteColumnsProc delete_columns;
155
XbaeMatrixSetRowColorsProc set_row_colors;
156
XbaeMatrixSetColumnColorsProc set_column_colors;
157
XbaeMatrixSetCellColorProc set_cell_color;
159
} XbaeMatrixClassPart;
162
* Full class record declaration
164
typedef struct _XbaeMatrixClassRec {
165
CoreClassPart core_class;
166
CompositeClassPart composite_class;
167
ConstraintClassPart constraint_class;
168
XmManagerClassPart manager_class;
169
XbaeMatrixClassPart matrix_class;
170
} XbaeMatrixClassRec;
172
externalref XbaeMatrixClassRec xbaeMatrixClassRec;
176
* Inheritance constants for set/get/edit methods
178
#define XbaeInheritGetCell ((XbaeMatrixGetCellProc) _XtInherit)
179
#define XbaeInheritSetCell ((XbaeMatrixSetCellProc) _XtInherit)
180
#define XbaeInheritEditCell ((XbaeMatrixEditCellProc) _XtInherit)
181
#define XbaeInheritSelectCell ((XbaeMatrixSelectCellProc) _XtInherit)
182
#define XbaeInheritSelectRow ((XbaeMatrixSelectRowProc) _XtInherit)
183
#define XbaeInheritSelectColumn ((XbaeMatrixSelectColumnProc) _XtInherit)
184
#if XmVersion >= 1002
185
#define XbaeInheritHighlightCell ((XbaeMatrixHighlightCellProc) _XtInherit)
186
#define XbaeInheritHighlightRow ((XbaeMatrixHighlightRowProc) _XtInherit)
187
#define XbaeInheritHighlightColumn ((XbaeMatrixHighlightColumnProc) _XtInherit)
189
#define XbaeInheritDeselectAll ((XbaeMatrixDeselectAllProc) _XtInherit)
190
#define XbaeInheritSelectAll ((XbaeMatrixSelectAllProc) _XtInherit)
191
#define XbaeInheritDeselectCell ((XbaeMatrixDeselectCellProc) _XtInherit)
192
#define XbaeInheritDeselectRow ((XbaeMatrixDeselectRowProc) _XtInherit)
193
#define XbaeInheritDeselectColumn ((XbaeMatrixDeselectColumnProc) _XtInherit)
194
#define XbaeInheritCommitEdit ((XbaeMatrixCommitEditProc) _XtInherit)
195
#define XbaeInheritCancelEdit ((XbaeMatrixCancelEditProc) _XtInherit)
196
#define XbaeInheritAddRows ((XbaeMatrixAddRowsProc) _XtInherit)
197
#define XbaeInheritDeleteRows ((XbaeMatrixDeleteRowsProc) _XtInherit)
198
#define XbaeInheritAddColumns ((XbaeMatrixAddColumnsProc) _XtInherit)
199
#define XbaeInheritDeleteColumns ((XbaeMatrixDeleteColumnsProc)_XtInherit)
200
#define XbaeInheritSetRowColors ((XbaeMatrixSetRowColorsProc)_XtInherit)
201
#define XbaeInheritSetColumnColors ((XbaeMatrixSetColumnColorsProc)_XtInherit)
202
#define XbaeInheritSetCellColor ((XbaeMatrixSetCellColorProc)_XtInherit)
205
* New data structures for the ScrollMgr code
207
typedef struct _SmScrollNode {
210
struct _SmScrollNode *next;
211
struct _SmScrollNode *prev;
212
} SmScrollNodeRec, *SmScrollNode;
214
typedef struct _SmScrollMgr {
218
SmScrollNode scroll_queue;
220
} SmScrollMgrRec, *SmScrollMgr;
223
* Rectangle struct used for internal calculations. (x1,y1) are the upper
224
* left corner, (x2,y2) are the lower right.
226
typedef struct _Rectangle
234
* Data structure for column labels
236
typedef struct _ColumnLabelLines {
239
} ColumnLabelLinesRec, *ColumnLabelLines;
242
* New fields for the Matrix widget record
248
Boolean allow_column_resize; /* can columns dynamically resize? */
249
Boolean bold_labels; /* draw bold row/column labels? */
250
Boolean button_labels; /* draw labels as buttons? */
251
Boolean fill; /* fill available space? */
252
Boolean trailing_attached_right; /* trailing columns fixed to right */
253
Boolean trailing_attached_bottom; /* trailing rows fixed to bottom */
254
Boolean reverse_select; /* reverse colours - selected cells? */
255
Boolean scroll_select; /* flag to scroll a selected cell */
256
Boolean **selected_cells; /* 2D array of selected cells */
257
Boolean show_arrows; /* sow arrows when text obscured? */
258
Boolean *column_button_labels; /* which column labels are butons */
259
Boolean *row_button_labels; /* which row labels are butons */
260
Boolean traverse_fixed; /* allow traversal to fixed cells? */
261
Boolean calc_cursor_position; /* calculate insert pos from click */
262
unsigned char cell_shadow_type; /* cell shadow type */
263
unsigned char **cell_shadow_types; /* 2D array of per cell shadow type */
264
unsigned char *column_alignments; /* alignment of each column */
265
unsigned char *column_label_alignments;/* alignment of each column label */
266
unsigned char *column_shadow_types; /* 1D array of per col shadow types */
267
unsigned char grid_type; /* shadowed in/shadowed out/plain */
268
unsigned char hsb_display_policy; /* horiz scroll bar display policy */
269
unsigned char row_label_alignment; /* alignment of row labels */
270
unsigned char *row_shadow_types; /* 1D array of per row shadow types */
271
unsigned char scrollbar_placement; /* placement of the scrollbars */
272
unsigned char selection_policy; /* as for XmList */
273
unsigned char shadow_type; /* matrix window shadow type */
274
#if XmVersion >= 1002
275
unsigned char **highlighted_cells; /* 2D array of highlighted cells */
277
unsigned char vsb_display_policy; /* vert scroll bar display policy */
279
String **cells; /* 2D array of strings */
280
String *column_labels; /* array of labels above each column */
281
String *row_labels; /* array of labels next to each row */
283
XtPointer **cell_user_data; /* 2D array of per cell user data */
284
XtPointer *column_user_data; /* 1D array of per column user data */
285
XtPointer *row_user_data; /* 1D array of per row user data */
287
short *column_widths; /* width of each column in chars */
288
short row_label_width; /* max width of row labels in chars */
290
int alt_row_count; /* # of rows for e/o background */
291
int columns; /* number of cells per row */
292
int *column_max_lengths; /* max length of each col in chars */
293
int double_click_interval; /* interval between clicks */
294
int left_column; /* horizontal origin (in col space) */
295
int rows; /* number of rows per column */
296
int top_row; /* vertical origin (in row space) */
298
Dimension cell_highlight_thickness; /* hilite thickness for textField */
299
Dimension cell_margin_height; /* margin height for textField */
300
Dimension cell_margin_width; /* margin width for textField */
301
Dimension cell_shadow_thickness; /* shadow thickness for each cell */
302
Dimension fixed_columns; /* number of leading fixed columns */
303
Dimension fixed_rows; /* number of leading fixed rows */
304
Dimension space; /* spacing for scrollbars */
305
Dimension text_shadow_thickness; /* shadow thickness for text field */
306
Dimension trailing_fixed_columns; /* number of trailing fixed columns */
307
Dimension trailing_fixed_rows; /* number of trailing fixed rows */
308
Dimension visible_columns; /* number of columns to make visible */
309
Dimension visible_rows; /* number of rows to make visible */
311
Pixel button_label_background; /* color of button label background */
312
Pixel **cell_background; /* 2D array of Pixels */
313
Pixel **colors; /* 2D array of Pixels */
314
Pixel column_label_color; /* color of column label */
315
Pixel even_row_background; /* even row background color */
316
Pixel grid_line_color; /* color of grid, for XmGrid_LINE */
317
Pixel odd_row_background; /* odd row background color */
318
Pixel row_label_color; /* color of row label */
319
Pixel selected_background; /* background for selected cells */
320
Pixel selected_foreground; /* foreground for selected cells */
321
Pixel text_background; /* background for the "text" field */
323
XtTranslations text_translations; /* translations for textField widget */
325
XtCallbackList default_action_callback; /* called for a double click */
326
XtCallbackList draw_cell_callback; /* called when a cell is drawn */
327
XtCallbackList enter_cell_callback; /* called when a cell is entered */
328
XtCallbackList label_activate_callback; /* called when label pressed */
329
XtCallbackList leave_cell_callback; /* called when a cell is left */
330
XtCallbackList modify_verify_callback; /* verify change to textField */
331
/* and a draw_cell_callback is set */
333
XtCallbackList process_drag_callback; /* called when a drag is initiated */
335
XtCallbackList resize_callback; /* called when Matrix is resized */
336
XtCallbackList resize_column_callback; /* called when column is resized */
337
XtCallbackList select_cell_callback; /* called when cells are selected */
338
XtCallbackList traverse_cell_callback; /* next cell to traverse to */
339
XtCallbackList write_cell_callback; /*called when a cell needs to be set*/
341
XmFontList font_list; /* fontList of widget and textField */
342
XmFontList label_font_list; /* fontList of labels */
348
#if XmVersion >= 1002
349
unsigned char highlight_location; /* What is being highlighted */
351
short first_row_offset; /* hidden first row */
352
int cell_visible_height; /* height of visible cells in pixels */
353
int column_label_maxlines; /* max # lines in column labels */
354
int *column_positions; /* pixel position of each column */
355
int current_column; /* column of the text field */
356
int current_row; /* row of the text field */
357
int horiz_origin; /* horiz origin (in pixel space) */
358
int label_baseline; /* baseline of label */
359
int last_column; /* The last selected column */
360
int last_row; /* The last selected row */
361
int num_selected_cells; /* The number selected cells */
362
int text_baseline; /* baseline of text in each cell */
363
int traversing; /* direction we are traversing */
365
unsigned int non_fixed_total_width; /* width of cell area in pixels */
366
unsigned int current_clip; /* current clip mask setting */
367
unsigned int disable_redisplay; /* disable redisplay counter */
369
Dimension desired_height; /* height widget wants to be */
370
Dimension desired_width; /* width widget wants to be */
372
Time last_click_time; /* when last ButtonPress occurred */
374
Widget text_field; /* the text field */
375
Widget horizontal_sb; /* the horizontal scrollbar */
376
Widget vertical_sb; /* the vertical scrollbar */
377
Widget clip_window; /* the clip child */
378
Widget left_clip; /* clips for scrolling fixed cells */
382
Widget current_parent; /* Current textField parent window */
384
Widget **cell_widgets; /* array of widgets for cells */
387
GC cell_bottom_shadow_clip_gc; /* GC for clipped bottom shadow */
388
GC cell_grid_line_gc;
389
GC cell_top_shadow_clip_gc; /* GC for clipped top shadow */
390
GC draw_gc; /* GC for drawing cells */
391
GC grid_line_gc; /* GC for grid line */
392
GC label_clip_gc; /* GC for clipped labels */
393
GC label_gc; /* GC for drawing labels */
394
GC pixmap_gc; /* GC for drawing pixmap cells */
395
GC resize_bottom_shadow_gc;
396
GC resize_top_shadow_gc;
398
ColumnLabelLines column_label_lines; /* structs for multi line labels */
400
XFontStruct *font_struct; /* fontStruct from fontList */
401
XFontStruct *label_font_struct; /* fontStruct from fontList */
403
SmScrollMgr clip_scroll_mgr; /* ScrollMgr for Clip */
404
SmScrollMgr matrix_scroll_mgr; /* ScrollMgr for Matrix */
406
XFontSet font_set; /* fontSet from fontList */
411
XFontSet label_font_set; /* fontSet from fontList */
413
short label_font_width;
414
short label_font_height;
420
* Full instance record declaration
422
typedef struct _XbaeMatrixRec {
424
CompositePart composite;
425
ConstraintPart constraint;
426
XmManagerPart manager;
427
XbaeMatrixPart matrix;
430
/* provide clean-up for those with R4 */
431
#ifndef XlibSpecificationRelease
433
# undef _XFUNCPROTOBEGIN
434
# undef _XFUNCPROTOEND
438
#endif /* _Xbae_MatrixP_h */