Don't use -import argument as fprintf format
[nedit.git] / Microline / XmL / GridP.h
blob5f5e900a343cb7a1f43a79b635f800f689f7e620
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Microline Widget Library, originally made available under the NPL by Neuron Data <http://www.neurondata.com>.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * In addition, as a special exception to the GNU GPL, the copyright holders
38 * give permission to link the code of this program with the Motif and Open
39 * Motif libraries (or with modified versions of these that use the same
40 * license), and distribute linked combinations including the two. You
41 * must obey the GNU General Public License in all respects for all of
42 * the code used other than linking with Motif/Open Motif. If you modify
43 * this file, you may extend this exception to your version of the file,
44 * but you are not obligated to do so. If you do not wish to do so,
45 * delete this exception statement from your version.
47 * ***** END LICENSE BLOCK ***** */
50 #ifndef XmLGridPH
51 #define XmLGridPH
53 #include <Xm/XmP.h>
54 #include <stdlib.h>
55 #ifndef MOTIF11
56 #include <Xm/ManagerP.h>
57 #include <Xm/DrawP.h>
58 #include <Xm/DragC.h>
59 #include <Xm/DropTrans.h>
60 #endif
62 #include "Grid.h"
64 #ifdef XmL_ANSIC
66 void _XmLGridLayout(XmLGridWidget g);
68 void _XmLGridCellDrawBackground(XmLGridCell cell, Widget w,
69 XRectangle *clipRect, XmLGridDrawStruct *ds);
70 void _XmLGridCellDrawBorders(XmLGridCell cell, Widget w,
71 XRectangle *clipRect, XmLGridDrawStruct *ds);
72 void _XmLGridCellDrawValue(XmLGridCell cell, Widget w,
73 XRectangle *clipRect, XmLGridDrawStruct *ds);
74 typedef int (*XmLGridPreLayoutProc)(XmLGridWidget g, int isVert);
76 typedef XmLGridRow (*XmLGridRowNewProc)(Widget grid);
77 typedef void (*XmLGridRowFreeProc)(XmLGridRow);
78 typedef void (*XmLGridGetRowValueMaskProc)(XmLGridWidget g,
79 char *s, long *mask);
80 typedef void (*XmLGridGetRowValueProc)(XmLGridWidget g, XmLGridRow row,
81 XtArgVal value, long mask);
82 typedef int (*XmLGridSetRowValuesProc)(XmLGridWidget g,
83 XmLGridRow row, long mask);
85 typedef XmLGridColumn (*XmLGridColumnNewProc)(Widget grid);
86 typedef void (*XmLGridColumnFreeProc)(XmLGridColumn);
87 typedef void (*XmLGridGetColumnValueMaskProc)(XmLGridWidget g,
88 char *s, long *mask);
89 typedef void (*XmLGridGetColumnValueProc)(XmLGridWidget g, XmLGridColumn col,
90 XtArgVal value, long mask);
91 typedef int (*XmLGridSetColumnValuesProc)(XmLGridWidget g,
92 XmLGridColumn col, long mask);
94 typedef int (*XmLGridSetCellValuesResizeProc)(XmLGridWidget g,
95 XmLGridRow row, XmLGridColumn col, XmLGridCell cell, long mask);
96 typedef int (*XmLGridCellActionProc)(XmLGridCell, Widget,
97 XmLGridCallbackStruct *);
99 #else
101 void _XmLGridLayout();
103 void _XmLGridCellDrawBackground();
104 void _XmLGridCellDrawBorders();
105 void _XmLGridCellDrawValue();
106 typedef int (*XmLGridPreLayoutProc)();
108 typedef XmLGridRow (*XmLGridRowNewProc)();
109 typedef void (*XmLGridRowFreeProc)() ;
110 typedef void (*XmLGridGetRowValueMaskProc)();
111 typedef void (*XmLGridGetRowValueProc)();
112 typedef int (*XmLGridSetRowValuesProc)();
114 typedef XmLGridColumn (*XmLGridColumnNewProc)() ;
115 typedef void (*XmLGridColumnFreeProc)() ;
116 typedef void (*XmLGridGetColumnValueMaskProc)();
117 typedef void (*XmLGridGetColumnValueProc)();
118 typedef int (*XmLGridSetColumnValuesProc)();
120 typedef int (*XmLGridSetCellValuesResizeProc)();
121 typedef int (*XmLGridCellActionProc)();
123 #endif
125 #define XmLGridClassPartOfWidget(w) \
126 ((XmLGridWidgetClass)XtClass(w))->grid_class
128 #define XmInheritGridPreLayout ((XmLGridPreLayoutProc)_XtInherit)
130 #define XmInheritGridRowNew ((XmLGridRowNewProc)_XtInherit)
131 #define XmInheritGridRowFree ((XmLGridRowFreeProc)_XtInherit)
132 #define XmInheritGridGetRowValueMask ((XmLGridGetRowValueMaskProc)_XtInherit)
133 #define XmInheritGridGetRowValue ((XmLGridGetRowValueProc)_XtInherit)
134 #define XmInheritGridSetRowValues ((XmLGridSetRowValuesProc)_XtInherit)
136 #define XmInheritGridColumnNew ((XmLGridColumnNewProc)_XtInherit)
137 #define XmInheritGridColumnFree ((XmLGridColumnFreeProc)_XtInherit)
138 #define XmInheritGridGetColumnValueMask \
139 ((XmLGridGetColumnValueMaskProc)_XtInherit)
140 #define XmInheritGridGetColumnValue ((XmLGridGetColumnValueProc)_XtInherit)
141 #define XmInheritGridSetColumnValues ((XmLGridSetColumnValuesProc)_XtInherit)
143 #define XmInheritGridSetCellValuesResize \
144 ((XmLGridSetCellValuesResizeProc)_XtInherit)
145 #define XmInheritGridCellAction ((XmLGridCellActionProc)_XtInherit)
147 /* row value mask for get/set values */
148 #define XmLGridRowHeight (1L<<0)
149 #define XmLGridRowSizePolicy (1L<<1)
150 #define XmLGridRowUserData (1L<<2)
151 #define XmLGridRowValueMaskLen 3
153 /* column value mask for get/set values */
154 #define XmLGridColumnWidth (1L<<0)
155 #define XmLGridColumnSizePolicy (1L<<1)
156 #define XmLGridColumnUserData (1L<<2)
157 #define XmLGridColumnResizable (1L<<3)
158 #define XmLGridColumnHidden (1L<<4)
159 #define XmLGridColumnSortType (1L<<5)
160 #define XmLGridColumnValueMaskLen 6
162 /* flags for XmLGridCell flags member */
163 #define XmLGridCellSelectedFlag (1 << 0)
164 #define XmLGridCellValueSetFlag (1 << 1)
165 #define XmLGridCellInRowSpanFlag (1 << 2)
166 #define XmLGridCellInColumnSpanFlag (1 << 3)
167 #define XmLGridCellDrawSortFlag (1 << 4)
168 #define XmLGridCellSortAscendingFlag (1 << 5)
170 /* cell value mask for get/set values */
171 #define XmLGridCellAlignment (1L<<0)
172 #define XmLGridCellBackground (1L<<1)
173 #define XmLGridCellBottomBorderColor (1L<<2)
174 #define XmLGridCellBottomBorderType (1L<<3)
175 #define XmLGridCellColumnSpan (1L<<4)
176 #define XmLGridCellEditable (1L<<5)
177 #define XmLGridCellFontList (1L<<6)
178 #define XmLGridCellForeground (1L<<7)
179 #define XmLGridCellLeftBorderColor (1L<<8)
180 #define XmLGridCellLeftBorderType (1L<<9)
181 #define XmLGridCellMarginBottom (1L<<10)
182 #define XmLGridCellMarginLeft (1L<<11)
183 #define XmLGridCellMarginRight (1L<<12)
184 #define XmLGridCellMarginTop (1L<<13)
185 #define XmLGridCellPixmapF (1L<<14)
186 #define XmLGridCellPixmapMask (1L<<15)
187 #define XmLGridCellRightBorderColor (1L<<16)
188 #define XmLGridCellRightBorderType (1L<<17)
189 #define XmLGridCellRowSpan (1L<<18)
190 #define XmLGridCellString (1L<<19)
191 #define XmLGridCellToggleSet (1L<<20)
192 #define XmLGridCellTopBorderColor (1L<<21)
193 #define XmLGridCellTopBorderType (1L<<22)
194 #define XmLGridCellType (1L<<23)
195 #define XmLGridCellUserData (1L<<24)
197 /* This is now a resource */
198 /* #define XmLICON_SPACING 4 */
200 enum { DrawAll, DrawHScroll, DrawVScroll, DrawRow, DrawCol, DrawCell };
201 enum { SelectRow, SelectCol, SelectCell };
202 enum { CursorNormal, CursorHResize, CursorVResize };
203 enum { InNormal, InSelect, InResize, InMove };
204 enum { DragLeft = 1, DragRight = 2, DragUp = 4, DragDown = 8 };
206 typedef struct
208 int x, y, width, height;
209 int row, col, nrow, ncol;
210 } GridReg;
212 typedef struct
214 int row, col;
215 } GridDropLoc;
217 typedef struct
219 unsigned char alignment;
220 Pixel background;
221 Pixel bottomBorderColor;
222 char bottomBorderType;
223 Dimension bottomMargin;
224 int columnSpan;
225 Boolean editable;
226 short fontHeight;
227 XmFontList fontList;
228 short fontWidth;
229 Pixel foreground;
230 Pixel leftBorderColor;
231 char leftBorderType;
232 Dimension leftMargin;
233 int refCount;
234 Pixel rightBorderColor;
235 char rightBorderType;
236 Dimension rightMargin;
237 int rowSpan;
238 Pixel topBorderColor;
239 char topBorderType;
240 Dimension topMargin;
241 unsigned char type;
242 void *userData;
243 } XmLGridCellRefValues;
245 typedef struct
247 Pixmap pixmap, pixmask;
248 Dimension width, height;
249 } XmLGridCellPixmap;
251 typedef struct
253 XmString string;
254 XmLGridCellPixmap pix;
255 } XmLGridCellIcon;
257 typedef struct _XmLGridCellPart
259 XmLGridCellRefValues *refValues;
260 unsigned char flags;
261 void *value;
262 } XmLGridCellPart;
264 struct _XmLGridCellRec
266 XmLGridCellPart cell;
269 typedef struct _XmLGridRowPart
271 int pos; /* required first for Array autonumber */
272 Dimension height;
273 unsigned char sizePolicy;
274 Boolean selected;
275 XtPointer userData;
276 Dimension heightInPixels;
277 unsigned int heightInPixelsValid:1;
278 Widget grid;
279 int visPos;
280 XmLArray cellArray;
281 } XmLGridRowPart;
283 struct _XmLGridRowRec
285 XmLGridRowPart grid;
288 typedef struct _XmLGridColumnPart
290 int pos; /* required first for Array autonumber */
291 Dimension width;
292 unsigned char sizePolicy;
293 Boolean selected;
294 XtPointer userData;
295 XmLGridCellRefValues *defCellValues;
296 Widget grid;
297 Dimension widthInPixels;
298 unsigned int widthInPixelsValid:1;
299 Boolean resizable;
300 int visPos;
302 /* xfe additions */
303 Boolean hidden;
304 unsigned char sort;
305 } XmLGridColumnPart;
307 struct _XmLGridColumnRec
309 XmLGridColumnPart grid;
312 typedef struct _XmLGridPart
314 /* resource values */
315 int leftFixedCount, rightFixedCount;
316 int headingRowCount, footerRowCount;
317 int topFixedCount, bottomFixedCount;
318 int headingColCount, footerColCount;
319 Dimension leftFixedMargin, rightFixedMargin;
320 Dimension topFixedMargin, bottomFixedMargin;
321 Dimension scrollBarMargin;
322 Dimension highlightThickness;
323 Dimension toggleSize;
324 Dimension globalPixmapWidth, globalPixmapHeight;
325 unsigned char selectionPolicy;
326 Boolean layoutFrozen, immediateDraw;
327 int debugLevel;
328 unsigned char vsPolicy, hsPolicy;
329 unsigned char hsbDisplayPolicy, vsbDisplayPolicy;
330 int rowCount, colCount;
331 int hiddenRowCount, hiddenColCount;
332 int shadowRegions;
333 unsigned char shadowType;
334 Widget hsb, vsb, text;
335 XmFontList fontList;
336 Pixel blankBg, selectBg, selectFg;
337 Pixel defaultCellBg, defaultCellFg;
338 Pixel toggleTopColor, toggleBotColor;
339 int visibleCols, visibleRows;
340 char *simpleHeadings, *simpleWidths;
341 XtTranslations editTrans, traverseTrans;
342 Boolean allowRowHide, allowColHide;
343 Boolean allowRowResize, allowColResize;
344 Boolean allowDrag, allowDrop;
345 Boolean autoSelect;
346 Boolean highlightRowMode;
347 Boolean useAvgWidth;
348 int scrollRow, scrollCol, cScrollRow, cScrollCol;
349 XtCallbackList addCallback, deleteCallback;
350 XtCallbackList cellDrawCallback, cellFocusCallback;
351 XtCallbackList cellDropCallback, cellPasteCallback;
352 XtCallbackList activateCallback, editCallback;
353 XtCallbackList selectCallback, deselectCallback;
354 XtCallbackList resizeCallback, scrollCallback;
356 XtCallbackList enterCellCallback;
357 XtCallbackList leaveCellCallback;
358 XtCallbackList enterGridCallback;
359 XtCallbackList leaveGridCallback;
361 /* XFE Additions */
362 XtCallbackList popupCallback;
363 Boolean hideUnhideButtons;
364 Boolean singleClickActivation;
365 Widget hideButton;
366 Widget unhideButton;
367 XtTranslations hideButtonTrans;
368 XtTranslations unhideButtonTrans;
370 Boolean inResize;
372 Boolean useTextWidget;
374 Dimension iconSpacing;
376 Dimension minColWidth;
378 int lastCursorMotionRow;
379 int lastCursorMotionCol;
381 unsigned char colSortType;
383 /* private data */
384 GC gc;
385 Cursor hResizeCursor, vResizeCursor;
386 XFontStruct *fallbackFont;
387 char ignoreModifyVerify;
388 char focusIn, inEdit, inMode;
389 char singleColScrollMode;
390 int singleColScrollPos;
391 char cursorDefined, textHidden, resizeIsVert;
392 char mayHaveRowSpans;
393 int layoutStack;
394 char needsHorizLayout, needsVertLayout;
395 char recalcHorizVisPos, recalcVertVisPos;
396 char vertVisChangedHint;
397 char dragTimerSet;
398 XtIntervalId dragTimerId;
399 int resizeRow, resizeCol, resizeLineXY;
400 int extendRow, extendCol, extendToRow, extendToCol;
401 Boolean extendSelect;
402 int lastSelectRow, lastSelectCol;
403 Time lastSelectTime;
404 int focusRow, focusCol;
405 XmLArray rowArray;
406 XmLArray colArray;
407 GridReg reg[9];
408 GridDropLoc dropLoc;
410 /* resources use by SetSubValues and GetSubValues */
411 Boolean cellDefaults;
412 int cellRow, cellCol;
413 int cellColRangeStart, cellColRangeEnd;
414 int cellRowRangeStart, cellRowRangeEnd;
415 int rowStep, colStep;
416 unsigned char rowType, colType;
417 Boolean colHidden;
419 /* cell resources */
420 XmString cellString;
421 Boolean cellToggleSet;
422 Pixmap cellPixmap, cellPixmapMask;
423 Dimension cellPixmapWidth, cellPixmapHeight;
424 XmLGridCellRefValues cellValues, *defCellValues;
426 /* row resources */
427 Dimension rowHeight;
428 unsigned char rowSizePolicy;
429 Boolean rowSelected;
430 XtPointer rowUserData;
432 /* column resources */
433 Dimension colWidth;
434 unsigned char colSizePolicy;
435 Boolean colSelected;
436 XtPointer colUserData;
437 Boolean colResizable;
439 /* xfe additions */
440 /* Edit timer is used for inplace editing */
441 char editTimerSet;
442 XtIntervalId editTimerId;
443 } XmLGridPart;
445 typedef struct _XmLGridRec
447 CorePart core;
448 CompositePart composite;
449 ConstraintPart constraint;
450 XmManagerPart manager;
451 XmLGridPart grid;
452 } XmLGridRec;
454 typedef struct _XmLGridClassPart
456 int initialRows;
457 int initialCols;
458 XmLGridPreLayoutProc preLayoutProc;
459 int rowRecSize;
460 XmLGridRowNewProc rowNewProc;
461 XmLGridRowFreeProc rowFreeProc;
462 XmLGridGetRowValueMaskProc getRowValueMaskProc;
463 XmLGridGetRowValueProc getRowValueProc;
464 XmLGridSetRowValuesProc setRowValuesProc;
465 int columnRecSize;
466 XmLGridColumnNewProc columnNewProc;
467 XmLGridColumnFreeProc columnFreeProc;
468 XmLGridGetColumnValueMaskProc getColumnValueMaskProc;
469 XmLGridGetColumnValueProc getColumnValueProc;
470 XmLGridSetColumnValuesProc setColumnValuesProc;
471 XmLGridSetCellValuesResizeProc setCellValuesResizeProc;
472 XmLGridCellActionProc cellActionProc;
473 } XmLGridClassPart;
475 typedef struct _XmLGridClassRec
477 CoreClassPart core_class;
478 CompositeClassPart composite_class;
479 ConstraintClassPart constraint_class;
480 XmManagerClassPart manager_class;
481 XmLGridClassPart grid_class;
482 } XmLGridClassRec;
484 extern XmLGridClassRec xmlGridClassRec;
486 typedef struct _XmLGridConstraintPart
488 int unused;
489 } XmLGridConstraintPart;
491 typedef struct _XmLGridConstraintRec
493 XmManagerConstraintPart manager;
494 XmLGridConstraintPart grid;
495 } XmLGridConstraintRec, *XmLGridConstraintPtr;
497 #endif