]> www.wagner.pp.ru Git - oss/ck.git/blob - ck.h
Ck console graphics toolkit
[oss/ck.git] / ck.h
1 /*
2  * ck.h --
3  *
4  *      Declaration of all curses wish related things.
5  *
6  * Copyright (c) 1989-1994 The Regents of the University of California.
7  * Copyright (c) 1994-1995 Sun Microsystems, Inc.
8  * Copyright (c) 1995-2001 Christian Werner
9  *
10  * See the file "license.terms" for information on usage and redistribution
11  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12  */
13
14 #ifndef _CK_H
15 #define _CK_H
16
17 #ifndef _TCL
18 #include <tcl.h>
19 #endif
20
21 #if (TCL_MAJOR_VERSION < 7)
22 #error Tcl major version must be 7 or greater
23 #endif
24
25 #if (TCL_MAJOR_VERSION >= 8)
26 #define CK_MAJOR_VERSION 8
27 #if (TCL_MINOR_VERSION == 5)
28 #define CK_VERSION "8.5"
29 #define CK_MINOR_VERSION 5
30 #define CK_USE_UTF 1
31 #elif (TCL_MINOR_VERSION == 4)
32 #define CK_VERSION "8.4"
33 #define CK_MINOR_VERSION 4
34 #define CK_USE_UTF 1
35 #elif (TCL_MINOR_VERSION == 3)
36 #define CK_VERSION "8.3"
37 #define CK_MINOR_VERSION 3
38 #define CK_USE_UTF 1
39 #elif (TCL_MINOR_VERSION == 2)
40 #define CK_VERSION "8.2"
41 #define CK_MINOR_VERSION 2
42 #define CK_USE_UTF 1
43 #elif (TCL_MINOR_VERSION == 1)
44 #define CK_VERSION "8.1"
45 #define CK_MINOR_VERSION 1
46 #define CK_USE_UTF 1
47 #else
48 #define CK_VERSION "8.0"
49 #define CK_MINOR_VERSION 0
50 #define CK_USE_UTF 0
51 #endif
52 #else
53
54 #define CK_MAJOR_VERSION 4
55 #define CK_USE_UTF 0
56
57 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
58 #define CK_VERSION "4.0"
59 #define CK_MINOR_VERSION 0
60 #else
61 #define CK_VERSION "4.1"
62 #define CK_MINOR_VERSION 1
63 #endif
64 #endif
65
66 #ifndef RESOURCE_INCLUDED
67
68 #ifdef __STDC__
69 #include <stddef.h>
70 #endif
71
72 #ifdef USE_NCURSES
73 #include <ncurses.h>
74 #else
75 #include <curses.h>
76 #endif
77
78 /*
79  * Keyboard symbols (KeySym)
80  */
81
82 typedef int KeySym;
83 #define NoSymbol (-2)
84
85 /*
86  * Event structures.
87  */
88
89 typedef struct {
90     long type;
91     struct CkWindow *winPtr;
92 } CkAnyEvent;
93
94 typedef struct {
95     long type;
96     struct CkWindow *winPtr;
97     int keycode;
98 } CkKeyEvent;
99
100 typedef struct {
101     long type;
102     struct CkWindow *winPtr;
103     int button, x, y, rootx, rooty;
104 } CkMouseEvent;
105
106 typedef struct {
107     long type;
108     struct CkWindow *winPtr;    
109 } CkWindowEvent;
110
111 typedef union {
112     long type;
113     CkAnyEvent any;
114     CkKeyEvent key;
115     CkMouseEvent mouse;
116     CkWindowEvent win;
117 } CkEvent;
118
119 /*
120  * Event types/masks
121  */
122
123 #define CK_EV_KEYPRESS   0x00000001
124 #define CK_EV_MOUSE_DOWN 0x00000002
125 #define CK_EV_MOUSE_UP   0x00000004
126 #define CK_EV_UNMAP      0x00000010
127 #define CK_EV_MAP        0x00000020
128 #define CK_EV_EXPOSE     0x00000040
129 #define CK_EV_DESTROY    0x00000080
130 #define CK_EV_FOCUSIN    0x00000100
131 #define CK_EV_FOCUSOUT   0x00000200
132 #define CK_EV_BARCODE    0x10000000
133 #define CK_EV_ALL        0xffffffff
134
135 /*
136  * Additional types exported to clients.
137  */
138
139 typedef char *Ck_Uid;
140 typedef char *Ck_BindingTable;
141
142 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
143 typedef char *Tk_TimerToken;
144 #else
145 #define Tk_TimerToken Tcl_TimerToken
146 #endif
147
148 /*
149  *--------------------------------------------------------------
150  *
151  * Additional procedure types defined by curses wish.
152  *
153  *--------------------------------------------------------------
154  */
155       
156 typedef void (Ck_EventProc) _ANSI_ARGS_((ClientData clientData,
157                                 CkEvent *eventPtr));
158 typedef int  (Ck_GenericProc) _ANSI_ARGS_((ClientData clientData,
159                                 CkEvent *eventPtr));
160 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
161 typedef void (Ck_FreeProc) _ANSI_ARGS_((ClientData clientData));
162 #else
163 #define Ck_FreeProc Tcl_FreeProc
164 #endif
165
166 typedef void (Tk_FileProc) _ANSI_ARGS_((ClientData clientData, int mask));
167 typedef int (Tk_FileProc2) _ANSI_ARGS_((ClientData clientData, int mask,
168                                 int flags));
169 typedef void (Tk_IdleProc) _ANSI_ARGS_((ClientData clientData));
170 typedef void (Tk_TimerProc) _ANSI_ARGS_((ClientData clientData));
171
172 /*
173  * Each geometry manager (the packer, the placer, etc.) is represented
174  * by a structure of the following form, which indicates procedures
175  * to invoke in the geometry manager to carry out certain functions.
176  */
177
178 typedef void (Ck_GeomRequestProc) _ANSI_ARGS_((ClientData clientData,
179         struct CkWindow *winPtr));
180 typedef void (Ck_GeomLostSlaveProc) _ANSI_ARGS_((ClientData clientData,
181         struct CkWindow *winPtr));
182
183 typedef struct Ck_GeomMgr {
184     char *name;                 /* Name of the geometry manager (command
185                                  * used to invoke it, or name of widget
186                                  * class that allows embedded widgets). */
187     Ck_GeomRequestProc *requestProc;
188                                 /* Procedure to invoke when a slave's
189                                  * requested geometry changes. */
190     Ck_GeomLostSlaveProc *lostSlaveProc;
191                                 /* Procedure to invoke when a slave is
192                                  * taken away from one geometry manager
193                                  * by another.  NULL means geometry manager
194                                  * doesn't care when slaves are lost. */
195 } Ck_GeomMgr;
196
197
198 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
199
200 /*
201  * Bits to pass to Tk_CreateFileHandler to indicate what sorts
202  * of events are of interest: (must be synced w/ tk.h !!!)
203  */
204    
205 #define TK_READABLE     1
206 #define TK_WRITABLE     2
207 #define TK_EXCEPTION    4
208
209 /*
210  * Special return value from Tk_FileProc2 procedures indicating that
211  * an event was successfully processed.
212  */
213
214 #define TK_FILE_HANDLED -1
215
216 /*
217  * Flag values to pass to Tk_DoOneEvent to disable searches
218  * for some kinds of events:
219  */
220
221 #define TK_DONT_WAIT            1
222 #define TK_X_EVENTS             2
223 #define TK_FILE_EVENTS          4
224 #define TK_TIMER_EVENTS         8
225 #define TK_IDLE_EVENTS          0x10
226 #define TK_ALL_EVENTS           0x1e
227
228 #else
229
230 /*
231  * Flag values to pass to Tk_DoOneEvent to disable searches
232  * for some kinds of events:
233  */
234
235 #define TK_DONT_WAIT            TCL_DONT_WAIT
236 #define TK_X_EVENTS             TCL_WINDOW_EVENTS
237 #define TK_FILE_EVENTS          TCL_FILE_EVENTS
238 #define TK_TIMER_EVENTS         TCL_TIMER_EVENTS
239 #define TK_IDLE_EVENTS          TCL_IDLE_EVENTS
240 #define TK_ALL_EVENTS           TCL_ALL_EVENTS
241
242 #endif
243
244 /*
245  * One of the following structures exists for each event handler
246  * created by calling Ck_CreateEventHandler.  This information
247  * is used by ckEvent.c only.
248  */
249     
250 typedef struct CkEventHandler {
251     long mask;                          /* Events for which to invoke proc. */
252     Ck_EventProc *proc;                 /* Procedure to invoke when an event
253                                          * in mask occurs. */
254     ClientData clientData;              /* Argument to pass to proc. */
255     struct CkEventHandler *nextPtr;     /* Next in list of handlers
256                                          * associated with window (NULL means
257                                          * end of list). */
258 } CkEventHandler;
259  
260 /*
261  * Ck keeps the following data structure for the main
262  * window (created by a call to Ck_CreateMainWindow). It stores
263  * information that is shared by all of the windows associated
264  * with the application.
265  */
266
267 typedef struct CkMainInfo {
268     struct CkWindow *winPtr;    /* Pointer to main window. */
269     Tcl_Interp *interp;         /* Interpreter associated with application. */
270     Tcl_HashTable nameTable;    /* Hash table mapping path names to CkWindow
271                                  * structs for all windows related to this
272                                  * main window.  Managed by ckWindow.c. */
273     Tcl_HashTable winTable;     /* Ditto, for event handling. */
274     struct CkWindow *topLevPtr; /* Anchor for toplevel window list. */
275     struct CkWindow *focusPtr;  /* Identifies window that currently has the
276                                  * focus. NULL means nobody has the focus.
277                                  * Managed by ckFocus.c. */
278     Ck_BindingTable bindingTable;
279                                 /* Used in conjunction with "bind" command
280                                  * to bind events to Tcl commands. */
281     struct ElArray *optionRootPtr;
282                                 /* Top level of option hierarchy for this
283                                  * main window.  NULL means uninitialized.
284                                  * Managed by ckOption.c. */
285     int maxWidth, maxHeight;    /* Max dimensions of curses screen. */
286     int refreshCount;           /* Counts number of calls
287                                  * to Ck_EventuallyRefresh. */
288     int refreshDelay;           /* Delay in milliseconds between updates;
289                                  * see comment in ckWindow.c. */
290     double lastRefresh;         /* Delay computation for updates. */
291     Tk_TimerToken refreshTimer; /* Timer for delayed updates. */
292     ClientData mouseData;       /* Value used by mouse handling code. */
293     ClientData barcodeData;     /* Value used by bar code handling code. */
294     int flags;                  /* See definitions below. */
295 #if CK_USE_UTF
296     Tcl_Encoding isoEncoding;
297     Tcl_DString isoBuffer;
298 #endif
299 } CkMainInfo;
300
301 #define CK_HAS_COLOR        1
302 #define CK_REVERSE_KLUDGE   2
303 #define CK_HAS_MOUSE        4
304 #define CK_MOUSE_XTERM      8
305 #define CK_REFRESH_TIMER   16
306 #define CK_HAS_BARCODE     32
307 #define CK_NOCLR_ON_EXIT   64
308
309 /*
310  * Ck keeps one of the following structures for each window.
311  * This information is (mostly) managed by ckWindow.c.
312  */
313
314 typedef struct CkWindow {
315
316     /*
317      * Structural information:
318      */
319
320     WINDOW *window;             /* Curses window. NULL means window
321                                  * hasn't actually been created yet, or it's
322                                  * been deleted. */
323     struct CkWindow *childList; /* First in list of child windows,
324                                  * or NULL if no children. */
325     struct CkWindow *lastChildPtr;
326                                 /* Last in list of child windows, or NULL
327                                  * if no children. */
328     struct CkWindow *parentPtr; /* Pointer to parent window. */
329     struct CkWindow *nextPtr;   /* Next in list of children with
330                                  * same parent (NULL if end of list). */
331     struct CkWindow *topLevPtr; /* Next toplevel if this is toplevel. */
332     CkMainInfo *mainPtr;        /* Information shared by all windows
333                                  * associated with the main window. */
334
335     /*
336      * Name and type information for the window:
337      */
338
339     char *pathName;             /* Path name of window (concatenation
340                                  * of all names between this window and
341                                  * its top-level ancestor).  This is a
342                                  * pointer into an entry in mainPtr->nameTable.
343                                  */
344     Ck_Uid nameUid;             /* Name of the window within its parent
345                                  * (unique within the parent). */
346     Ck_Uid classUid;            /* Class of the window.  NULL means window
347                                  * hasn't been given a class yet. */
348
349     /*
350      * Information kept by the event manager (ckEvent.c):
351      */
352               
353     CkEventHandler *handlerList;/* First in list of event handlers
354                                  * declared for this window, or
355                                  * NULL if none. */
356
357     /*
358      * Information kept by the bind/bindtags mechanism (ckCmds.c):
359      */
360
361     ClientData *tagPtr;         /* Points to array of tags used for bindings
362                                  * on this window.  Each tag is a Ck_Uid.
363                                  * Malloc'ed.  NULL means no tags. */
364     int numTags;                /* Number of tags at *tagPtr. */
365
366     /*
367      * Information used by ckFocus.c for toplevel windows.
368      */
369
370     struct CkWindow *focusPtr;  /* If toplevel, this was the last child
371                                  * which had the focus. */
372
373     /*
374      * Information used by ckGeometry.c for geometry managers.
375      */
376
377     Ck_GeomMgr *geomMgrPtr;     /* Procedure to manage geometry, NULL
378                                  * means unmanaged. */
379     ClientData geomData;        /* Argument for geomProc. */
380     int reqWidth, reqHeight;    /* Requested width/height of window. */
381
382     /*
383      * Information used by ckOption.c to manage options for the
384      * window.
385      */
386
387     int optionLevel;            /* -1 means no option information is
388                                  * currently cached for this window.
389                                  * Otherwise this gives the level in
390                                  * the option stack at which info is
391                                  * cached. */
392
393     /*
394      * Geometry and other attributes of window.
395      */
396
397     int x, y;                   /* Top-left corner with respect to
398                                  * parent window. */
399     int width, height;          /* Width and height of window. */
400     int fg, bg;                 /* Foreground/background colors. */
401     int attr;                   /* Video attributes. */
402     int flags;                  /* Various flag values, see below. */
403
404
405 } CkWindow;
406
407 /*
408  * Flag values for CkWindow structures are:
409  *
410  * CK_MAPPED:                   1 means window is currently mapped,
411  *                              0 means unmapped.
412  * CK_BORDER:                   1 means the window has a one character
413  *                              cell wide border around it.
414  *                              0 means no border.
415  * CK_TOPLEVEL:                 1 means this is a toplevel window.
416  * CK_SHOW_CURSOR:              1 means show the terminal's cursor if
417  *                              this window has the focus.
418  * CK_RECURSIVE_DESTROY:        1 means a recursive destroy is in
419  *                              progress, so some cleanup operations
420  *                              can be omitted.
421  * CK_ALREADY_DEAD:             1 means the window is in the process of
422  *                              being destroyed already.
423  */
424
425 #define CK_MAPPED               1
426 #define CK_BORDER               2
427 #define CK_TOPLEVEL             4
428 #define CK_SHOW_CURSOR          8
429 #define CK_RECURSIVE_DESTROY    16
430 #define CK_ALREADY_DEAD         32
431 #define CK_DONTRESTRICTSIZE     64
432
433 /*
434  * Window stacking literals
435  */
436
437 #define CK_ABOVE        0
438 #define CK_BELOW        1
439
440 /*
441  * Window border structure.
442  */
443
444 typedef struct {
445     char *name;                 /* Name of border, malloc'ed. */
446     int gchar[9];               /* ACS chars making up border. */
447 } CkBorder;
448
449 /*
450  * Enumerated type for describing a point by which to anchor something:
451  */
452   
453 typedef enum {
454     CK_ANCHOR_N, CK_ANCHOR_NE, CK_ANCHOR_E, CK_ANCHOR_SE,
455     CK_ANCHOR_S, CK_ANCHOR_SW, CK_ANCHOR_W, CK_ANCHOR_NW,
456     CK_ANCHOR_CENTER
457 } Ck_Anchor;
458   
459 /*
460  * Enumerated type for describing a style of justification:
461  */
462   
463 typedef enum {
464     CK_JUSTIFY_LEFT, CK_JUSTIFY_RIGHT,
465     CK_JUSTIFY_CENTER, CK_JUSTIFY_FILL
466 } Ck_Justify;
467
468 /*
469  * Result values returned by Ck_GetScrollInfo:
470  */
471
472 #define CK_SCROLL_MOVETO        1
473 #define CK_SCROLL_PAGES         2
474 #define CK_SCROLL_UNITS         3
475 #define CK_SCROLL_ERROR         4
476
477 /*
478  * Flags passed to CkMeasureChars/CkDisplayChars:
479  */
480
481 #define CK_WHOLE_WORDS           1
482 #define CK_AT_LEAST_ONE          2
483 #define CK_PARTIAL_OK            4
484 #define CK_NEWLINES_NOT_SPECIAL  8
485 #define CK_IGNORE_TABS          16
486 #define CK_FILL_UNTIL_EOL       32
487
488 /*
489  * Priority levels to pass to Tk_AddOption:
490  */
491
492 #define CK_WIDGET_DEFAULT_PRIO  20
493 #define CK_STARTUP_FILE_PRIO    40
494 #define CK_USER_DEFAULT_PRIO    60
495 #define CK_INTERACTIVE_PRIO     80
496 #define CK_MAX_PRIO             100
497
498 /*
499  * Structure used to describe application-specific configuration
500  * options:  indicates procedures to call to parse an option and
501  * to return a text string describing an option.
502  */
503
504 typedef int (Ck_OptionParseProc) _ANSI_ARGS_((ClientData clientData,
505         Tcl_Interp *interp, CkWindow *winPtr, char *value, char *widgRec,
506         int offset));
507 typedef char *(Ck_OptionPrintProc) _ANSI_ARGS_((ClientData clientData,
508         CkWindow *winPtr, char *widgRec, int offset,
509         Tcl_FreeProc **freeProcPtr));
510
511 typedef struct Ck_CustomOption {
512     Ck_OptionParseProc *parseProc;      /* Procedure to call to parse an
513                                          * option and store it in converted
514                                          * form. */
515     Ck_OptionPrintProc *printProc;      /* Procedure to return a printable
516                                          * string describing an existing
517                                          * option. */
518     ClientData clientData;              /* Arbitrary one-word value used by
519                                          * option parser:  passed to
520                                          * parseProc and printProc. */
521 } Ck_CustomOption;
522
523 /*
524  * Structure used to specify information for Ck_ConfigureWidget.  Each
525  * structure gives complete information for one option, including
526  * how the option is specified on the command line, where it appears
527  * in the option database, etc.
528  */
529
530 typedef struct Ck_ConfigSpec {
531     int type;                   /* Type of option, such as CK_CONFIG_COLOR;
532                                  * see definitions below.  Last option in
533                                  * table must have type CK_CONFIG_END. */
534     char *argvName;             /* Switch used to specify option in argv.
535                                  * NULL means this spec is part of a group. */
536     char *dbName;               /* Name for option in option database. */
537     char *dbClass;              /* Class for option in database. */
538     char *defValue;             /* Default value for option if not
539                                  * specified in command line or database. */
540     int offset;                 /* Where in widget record to store value;
541                                  * use Ck_Offset macro to generate values
542                                  * for this. */
543     int specFlags;              /* Any combination of the values defined
544                                  * below;  other bits are used internally
545                                  * by ckConfig.c. */
546     Ck_CustomOption *customPtr; /* If type is CK_CONFIG_CUSTOM then this is
547                                  * a pointer to info about how to parse and
548                                  * print the option.  Otherwise it is
549                                  * irrelevant. */
550 } Ck_ConfigSpec;
551
552 /*
553  * Type values for Ck_ConfigSpec structures.  See the user
554  * documentation for details.
555  */
556
557 #define CK_CONFIG_BOOLEAN       1
558 #define CK_CONFIG_INT           2
559 #define CK_CONFIG_DOUBLE        3
560 #define CK_CONFIG_STRING        4
561 #define CK_CONFIG_UID           5
562 #define CK_CONFIG_COLOR         6
563 #define CK_CONFIG_BORDER        7
564 #define CK_CONFIG_JUSTIFY       8
565 #define CK_CONFIG_ANCHOR        9
566 #define CK_CONFIG_SYNONYM       10
567 #define CK_CONFIG_WINDOW        11
568 #define CK_CONFIG_COORD         12
569 #define CK_CONFIG_ATTR          13
570 #define CK_CONFIG_CUSTOM        14
571 #define CK_CONFIG_END           15
572
573 /*
574  * Macro to use to fill in "offset" fields of Ck_ConfigInfos.
575  * Computes number of bytes from beginning of structure to a
576  * given field.
577  */
578
579 #ifdef offsetof
580 #define Ck_Offset(type, field) ((int) offsetof(type, field))
581 #else
582 #define Ck_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
583 #endif
584
585 /*
586  * Possible values for flags argument to Ck_ConfigureWidget:
587  */
588
589 #define CK_CONFIG_ARGV_ONLY     1
590
591 /*
592  * Possible flag values for Ck_ConfigInfo structures.  Any bits at
593  * or above CK_CONFIG_USER_BIT may be used by clients for selecting
594  * certain entries.  Before changing any values here, coordinate with
595  * tkConfig.c (internal-use-only flags are defined there).
596  */
597
598 #define CK_CONFIG_COLOR_ONLY            1
599 #define CK_CONFIG_MONO_ONLY             2
600 #define CK_CONFIG_NULL_OK               4
601 #define CK_CONFIG_DONT_SET_DEFAULT      8
602 #define CK_CONFIG_OPTION_SPECIFIED      0x10
603 #define CK_CONFIG_USER_BIT              0x100
604
605 extern Ck_Uid ckNormalUid;
606 extern Ck_Uid ckActiveUid;
607 extern Ck_Uid ckDisabledUid;
608
609 /*
610  * Internal procedures.
611  */
612
613 #if defined(_WIN32) || defined(WIN32)
614 #   ifdef BUILD_ck
615 #      undef EXTERN
616 #      define EXTERN __declspec(dllexport)
617 #   endif
618 #endif
619
620
621 EXTERN int      CkAllKeyNames _ANSI_ARGS_((Tcl_Interp *interp));
622 EXTERN int      CkBarcodeCmd _ANSI_ARGS_((ClientData clientData,
623                     Tcl_Interp *interp, int argc, char **argv));
624 EXTERN void     CkBindEventProc _ANSI_ARGS_((CkWindow *winPtr,
625                     CkEvent *eventPtr));
626 EXTERN int      CkCopyAndGlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
627                     char *string));
628 EXTERN void     CkDisplayChars _ANSI_ARGS_((CkMainInfo *mainPtr,
629                     WINDOW *window, char *string,
630                     int numChars, int x, int y, int tabOrigin, int flags));
631 EXTERN void     CkEventDeadWindow _ANSI_ARGS_((CkWindow *winPtr));
632 EXTERN void     CkFreeBindingTags _ANSI_ARGS_((CkWindow *winPtr));
633 EXTERN char *   CkGetBarcodeData _ANSI_ARGS_((CkMainInfo *mainPtr));
634
635 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
636 EXTERN int      CkHandleInput _ANSI_ARGS_((ClientData clientData, int mask,
637                     int flags));        
638 #else
639 EXTERN void     CkHandleInput _ANSI_ARGS_((ClientData clientData, int mask));
640 #endif
641
642 EXTERN int      CkInitFrame _ANSI_ARGS_((Tcl_Interp *interp, CkWindow *winPtr,
643                     int argc, char **argv));
644 EXTERN char *   CkKeysymToString _ANSI_ARGS_((KeySym keySym, int printControl));
645 EXTERN int      CkMeasureChars _ANSI_ARGS_((CkMainInfo *mainPtr,
646                     char *source, int maxChars,
647                     int startX, int maxX, int tabOrigin, int flags,
648                     int *nextPtr, int *nextCPtr));
649 EXTERN void     CkOptionClassChanged _ANSI_ARGS_((CkWindow *winPtr));
650 EXTERN void     CkOptionDeadWindow _ANSI_ARGS_((CkWindow *winPtr));
651 EXTERN KeySym   CkStringToKeysym _ANSI_ARGS_((char *name));
652 EXTERN int      CkTermHasKey _ANSI_ARGS_((Tcl_Interp *interp, char *name));
653 EXTERN void     CkUnderlineChars _ANSI_ARGS_((CkMainInfo *mainPtr,
654                     WINDOW *window, char *string,
655                     int numChars, int x, int y, int tabOrigin, int flags,
656                     int first, int last));
657
658 #if !((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4))
659
660 /*
661  * Resource tracking from tkPreserve.c has moved to Tcl version 7.5:
662  */
663
664 #define Ck_EventuallyFree Tcl_EventuallyFree
665 #define Ck_Preserve Tcl_Preserve
666 #define Ck_Release Tcl_Release
667
668 #endif
669
670 /*
671  * Exported procedures.
672  */
673
674 EXTERN void     Ck_AddOption _ANSI_ARGS_((CkWindow *winPtr, char *name,
675                     char *value, int priority));
676 EXTERN void     Ck_BindEvent _ANSI_ARGS_((Ck_BindingTable bindingTable,
677                     CkEvent *eventPtr, CkWindow *winPtr, int numObjects,
678                     ClientData *objectPtr));
679 EXTERN void     Ck_ClearToBot _ANSI_ARGS_((CkWindow *winPtr, int x, int y));
680 EXTERN void     Ck_ClearToEol _ANSI_ARGS_((CkWindow *winPtr, int x, int y));
681 EXTERN int      Ck_ConfigureInfo _ANSI_ARGS_((Tcl_Interp *interp,
682                     CkWindow *winPtr, Ck_ConfigSpec *specs, char *widgRec,
683                     char *argvName, int flags));
684 EXTERN int      Ck_ConfigureValue _ANSI_ARGS_((Tcl_Interp *interp,
685                     CkWindow *winPtr, Ck_ConfigSpec *specs, char *widgRec,
686                     char *argvName, int flags));
687 EXTERN int      Ck_ConfigureWidget _ANSI_ARGS_((Tcl_Interp *interp,
688                     CkWindow *winPtr, Ck_ConfigSpec *specs,
689                     int argc, char **argv, char *widgRec, int flags));
690 EXTERN int      Ck_CreateBinding _ANSI_ARGS_((Tcl_Interp *interp,
691                     Ck_BindingTable bindingTable, ClientData object,
692                     char *eventString, char *command, int append));
693 EXTERN Ck_BindingTable Ck_CreateBindingTable _ANSI_ARGS_((Tcl_Interp *interp));
694 EXTERN void     Ck_CreateEventHandler _ANSI_ARGS_((CkWindow *winPtr, long mask,
695                     Ck_EventProc *proc, ClientData clientData));
696 EXTERN void     Ck_CreateGenericHandler _ANSI_ARGS_((Ck_GenericProc *proc,
697                     ClientData clientData));
698 EXTERN CkWindow *Ck_CreateMainWindow _ANSI_ARGS_((Tcl_Interp *interp,
699                     char *className));
700 EXTERN CkWindow *Ck_CreateWindow _ANSI_ARGS_((Tcl_Interp *interp,
701                     CkWindow *parentPtr, char *name, int toplevel));
702 EXTERN CkWindow *Ck_CreateWindowFromPath _ANSI_ARGS_((Tcl_Interp *interp,
703                     CkWindow *anywin, char *pathName, int toplevel));
704 EXTERN void     Ck_DeleteAllBindings _ANSI_ARGS_((Ck_BindingTable bindingTable,
705                     ClientData object));
706 EXTERN int      Ck_DeleteBinding _ANSI_ARGS_((Tcl_Interp *interp,
707                     Ck_BindingTable bindingTable, ClientData object,
708                     char *eventString));
709 EXTERN void     Ck_DeleteBindingTable
710                     _ANSI_ARGS_((Ck_BindingTable bindingTable));
711 EXTERN void     Ck_DeleteEventHandler _ANSI_ARGS_((CkWindow *winPtr, long mask,
712                     Ck_EventProc *proc, ClientData clientData));
713 EXTERN void     Ck_DeleteGenericHandler _ANSI_ARGS_((Ck_GenericProc *proc,
714                     ClientData clientData));
715 EXTERN void     Ck_DestroyWindow _ANSI_ARGS_((CkWindow *winPtr));
716 EXTERN void     Ck_DrawBorder _ANSI_ARGS_((CkWindow *winPtr,
717                     CkBorder *borderPtr, int x, int y, int width, int height));
718 #if ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4))
719 EXTERN void     Ck_EventuallyFree _ANSI_ARGS_((ClientData clientData,
720                     Ck_FreeProc *freeProc));
721 #endif
722 EXTERN void     Ck_EventuallyRefresh _ANSI_ARGS_((CkWindow *winPtr));
723 EXTERN void     Ck_FreeBorder _ANSI_ARGS_((CkBorder *borderPtr));
724 EXTERN void     Ck_FreeOptions _ANSI_ARGS_((Ck_ConfigSpec *specs,
725                     char *widgrec, int needFlags));
726 EXTERN void     Ck_GeometryRequest _ANSI_ARGS_((CkWindow *winPtr,
727                     int reqWidth, int reqHeight));
728 EXTERN void     Ck_GetAllBindings _ANSI_ARGS_((Tcl_Interp *interp,
729                     Ck_BindingTable bindingTable, ClientData object));
730 EXTERN int      Ck_GetAnchor _ANSI_ARGS_((Tcl_Interp *interp, char *string,
731                     Ck_Anchor *anchorPtr));
732 EXTERN int      Ck_GetAttr _ANSI_ARGS_((Tcl_Interp *interp, char *name,
733                     int *attrPtr));
734 EXTERN char *   Ck_GetBinding _ANSI_ARGS_((Tcl_Interp *inter,
735                     Ck_BindingTable bindingTable, ClientData object,
736                     char *eventString));
737 EXTERN CkBorder *Ck_GetBorder _ANSI_ARGS_((Tcl_Interp *interp,
738                     char *string));
739 EXTERN int      Ck_GetColor _ANSI_ARGS_((Tcl_Interp *interp, char *name,
740                     int *colorPtr));
741 EXTERN int      Ck_GetCoord _ANSI_ARGS_((Tcl_Interp *interp, CkWindow *winPtr,
742                     char *string, int *intPtr));
743 EXTERN int      Ck_GetEncoding _ANSI_ARGS_((Tcl_Interp *interp));
744 EXTERN int      Ck_GetGChar _ANSI_ARGS_((Tcl_Interp *interp, char *name,
745                     int *gchar));
746 EXTERN int      Ck_GetJustify _ANSI_ARGS_((Tcl_Interp *interp, char *string,
747                     Ck_Justify *justifyPtr));
748 EXTERN Ck_Uid   Ck_GetOption _ANSI_ARGS_((CkWindow *winPtr, char *name,
749                     char *class));
750 EXTERN int      Ck_GetPair _ANSI_ARGS_((CkWindow *winPtr, int fg, int bg));
751 EXTERN void     Ck_GetRootGeometry _ANSI_ARGS_((CkWindow *winPtr, int *xPtr,
752                     int *yPtr, int *widthPtr, int *heightPtr));
753 EXTERN int      Ck_GetScrollInfo _ANSI_ARGS_((Tcl_Interp *interp,
754                     int argc, char **argv, double *dblPtr, int *intPtr));
755 EXTERN Ck_Uid   Ck_GetUid _ANSI_ARGS_((char *string));
756 EXTERN CkWindow *Ck_GetWindowXY _ANSI_ARGS_((CkMainInfo *mainPtr, int *xPtr,
757                     int *yPtr, int mode));
758 EXTERN void     Ck_HandleEvent _ANSI_ARGS_((CkMainInfo *mainPtr,
759                     CkEvent *eventPtr));
760 EXTERN int      Ck_Init _ANSI_ARGS_((Tcl_Interp *interp));
761 EXTERN void     Ck_Main _ANSI_ARGS_((int argc, char **argv,
762                     int (*appInitProc)()));
763 EXTERN void     Ck_MainLoop _ANSI_ARGS_((void));
764 EXTERN CkWindow *Ck_MainWindow _ANSI_ARGS_((Tcl_Interp *interp));
765 EXTERN void     Ck_MaintainGeometry _ANSI_ARGS_((CkWindow *slave,
766                     CkWindow *master, int x, int y, int width,
767                     int height));
768 EXTERN void     Ck_MakeWindowExist _ANSI_ARGS_((CkWindow *winPtr));
769 EXTERN void     Ck_ManageGeometry _ANSI_ARGS_((CkWindow *winPtr,
770                             Ck_GeomMgr *mgrPtr, ClientData clientData));
771 EXTERN void     Ck_MapWindow _ANSI_ARGS_((CkWindow *winPtr));
772 EXTERN void     Ck_MoveWindow _ANSI_ARGS_((CkWindow *winPtr, int x, int y));
773 EXTERN char *   Ck_NameOfAnchor _ANSI_ARGS_((Ck_Anchor anchor));
774 EXTERN char *   Ck_NameOfAttr _ANSI_ARGS_((int attr));
775 EXTERN char *   Ck_NameOfBorder _ANSI_ARGS_((CkBorder *borderPtr));
776 EXTERN char *   Ck_NameOfColor _ANSI_ARGS_((int color));
777 EXTERN char *   Ck_NameOfJustify _ANSI_ARGS_((Ck_Justify justify));
778 EXTERN CkWindow *Ck_NameToWindow _ANSI_ARGS_((Tcl_Interp *interp,
779                     char *pathName, CkWindow *winPtr));
780 #if ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4))
781 EXTERN void     Ck_Preserve _ANSI_ARGS_((ClientData clientData));
782 EXTERN void     Ck_Release _ANSI_ARGS_((ClientData clientData));
783 #endif
784 EXTERN void     Ck_ResizeWindow _ANSI_ARGS_((CkWindow *winPtr, int width,
785                     int height));
786 EXTERN int      Ck_RestackWindow _ANSI_ARGS_((CkWindow *winPtr, int aboveBelow,
787                     CkWindow *otherPtr));
788 EXTERN void     Ck_SetClass _ANSI_ARGS_((CkWindow *winPtr, char *className));
789 EXTERN int      Ck_SetEncoding _ANSI_ARGS_((Tcl_Interp *interp, char *name));
790 EXTERN void     Ck_SetFocus _ANSI_ARGS_((CkWindow *winPtr));
791 EXTERN int      Ck_SetGChar _ANSI_ARGS_((Tcl_Interp *interp, char *name,
792                     int gchar));
793 EXTERN void     Ck_SetHWCursor _ANSI_ARGS_((CkWindow *winPtr, int newState));
794 EXTERN void     Ck_SetInternalBorder _ANSI_ARGS_((CkWindow *winPtr,
795                     int onoff));
796 EXTERN void     Ck_SetWindowAttr _ANSI_ARGS_((CkWindow *winPtr, int fg,
797                     int bg, int attr));
798 EXTERN void     Ck_UnmaintainGeometry _ANSI_ARGS_((CkWindow *slave,
799                     CkWindow *master));
800 EXTERN void     Ck_UnmapWindow _ANSI_ARGS_((CkWindow *winPtr));
801
802 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION <= 4)
803 /*
804  * Event handling procedures.
805  */
806
807 EXTERN void     Tk_BackgroundError _ANSI_ARGS_((Tcl_Interp *interp));
808 EXTERN void     Tk_CancelIdleCall _ANSI_ARGS_((Tk_IdleProc *proc,
809                     ClientData clientData));
810 EXTERN void     Tk_CreateFileHandler _ANSI_ARGS_((int fd, int mask,
811                     Tk_FileProc *proc, ClientData clientData));
812 EXTERN void     Tk_CreateFileHandler2 _ANSI_ARGS_((int fd,
813                     Tk_FileProc2 *proc, ClientData clientData));
814 EXTERN Tk_TimerToken Tk_CreateTimerHandler _ANSI_ARGS_((int milliseconds,
815                     Tk_TimerProc *proc, ClientData clientData));
816 EXTERN void     Tk_DeleteFileHandler _ANSI_ARGS_((int fd));
817 EXTERN void     Tk_DeleteTimerHandler _ANSI_ARGS_((Tk_TimerToken token));
818 EXTERN int      Tk_DoOneEvent _ANSI_ARGS_((int flags));
819 EXTERN void     Tk_DoWhenIdle _ANSI_ARGS_((Tk_IdleProc *proc,
820                     ClientData clientData));
821 EXTERN void     Tk_DoWhenIdle2 _ANSI_ARGS_((Tk_IdleProc *proc,
822                     ClientData clientData));
823 EXTERN void     Tk_Sleep _ANSI_ARGS_((int ms));
824
825 #endif
826
827 /*
828  * Command procedures.
829  */
830
831 EXTERN int      Ck_BellCmd _ANSI_ARGS_((ClientData clientData,
832                     Tcl_Interp *interp, int argc, char **argv));
833 EXTERN int      Ck_BindCmd _ANSI_ARGS_((ClientData clientData,
834                     Tcl_Interp *interp, int argc, char **argv));
835 EXTERN int      Ck_BindtagsCmd _ANSI_ARGS_((ClientData clientData,
836                     Tcl_Interp *interp, int argc, char **argv));
837 EXTERN int      Ck_CursesCmd _ANSI_ARGS_((ClientData clientData,
838                     Tcl_Interp *interp, int argc, char **argv));
839 EXTERN int      Ck_DestroyCmd _ANSI_ARGS_((ClientData clientData,
840                     Tcl_Interp *interp, int argc, char **argv));
841 EXTERN int      Ck_ExitCmd _ANSI_ARGS_((ClientData clientData,
842                     Tcl_Interp *interp, int argc, char **argv));
843 EXTERN int      Ck_FocusCmd _ANSI_ARGS_((ClientData clientData,
844                     Tcl_Interp *interp, int argc, char **argv));
845 EXTERN int      Ck_GridCmd _ANSI_ARGS_((ClientData clientData,
846                     Tcl_Interp *interp, int argc, char **argv));
847 EXTERN int      Ck_LowerCmd _ANSI_ARGS_((ClientData clientData,
848                     Tcl_Interp *interp, int argc, char **argv));
849 EXTERN int      Ck_OptionCmd _ANSI_ARGS_((ClientData clientData,
850                     Tcl_Interp *interp, int argc, char **argv));
851 EXTERN int      Ck_PackCmd _ANSI_ARGS_((ClientData clientData,
852                     Tcl_Interp *interp, int argc, char **argv));
853 EXTERN int      Ck_PlaceCmd _ANSI_ARGS_((ClientData clientData,
854                     Tcl_Interp *interp, int argc, char **argv));
855 EXTERN int      Ck_RaiseCmd _ANSI_ARGS_((ClientData clientData,
856                     Tcl_Interp *interp, int argc, char **argv));
857 EXTERN int      Ck_RecorderCmd _ANSI_ARGS_((ClientData clientData,
858                     Tcl_Interp *interp, int argc, char **argv));
859 EXTERN int      Ck_TkwaitCmd _ANSI_ARGS_((ClientData clientData,
860                     Tcl_Interp *interp, int argc, char **argv));
861 EXTERN int      Ck_UpdateCmd _ANSI_ARGS_((ClientData clientData,
862                     Tcl_Interp *interp, int argc, char **argv));
863 EXTERN int      Ck_WinfoCmd _ANSI_ARGS_((ClientData clientData,
864                     Tcl_Interp *interp, int argc, char **argv));
865
866 EXTERN int      Tk_AfterCmd _ANSI_ARGS_((ClientData clientData,
867                     Tcl_Interp *interp, int argc, char **argv));
868 EXTERN int      Tk_FileeventCmd _ANSI_ARGS_((ClientData clientData,
869                     Tcl_Interp *interp, int argc, char **argv));
870
871 /*
872  * Widget creation procedures.
873  */
874
875 EXTERN int      Ck_ButtonCmd _ANSI_ARGS_((ClientData clientData,
876                     Tcl_Interp *interp, int argc, char **argv));
877 EXTERN int      Ck_EntryCmd _ANSI_ARGS_((ClientData clientData,
878                     Tcl_Interp *interp, int argc, char **argv));
879 EXTERN int      Ck_FrameCmd _ANSI_ARGS_((ClientData clientData,
880                     Tcl_Interp *interp, int argc, char **argv));
881 EXTERN int      Ck_ListboxCmd _ANSI_ARGS_((ClientData clientData,
882                     Tcl_Interp *interp, int argc, char **argv));
883 EXTERN int      Ck_MenuCmd _ANSI_ARGS_((ClientData clientData,
884                     Tcl_Interp *interp, int argc, char **argv));
885 EXTERN int      Ck_MenubuttonCmd _ANSI_ARGS_((ClientData clientData,
886                     Tcl_Interp *interp, int argc, char **argv));
887 EXTERN int      Ck_MessageCmd _ANSI_ARGS_((ClientData clientData,
888                     Tcl_Interp *interp, int argc, char **argv));
889 EXTERN int      Ck_ScrollbarCmd _ANSI_ARGS_((ClientData clientData,
890                     Tcl_Interp *interp, int argc, char **argv));
891 EXTERN int      Ck_TextCmd _ANSI_ARGS_((ClientData clientData,
892                     Tcl_Interp *interp, int argc, char **argv));
893 EXTERN int      Ck_TreeCmd _ANSI_ARGS_((ClientData clientData,
894                     Tcl_Interp *interp, int argc, char **argv));
895
896 #endif  /* RESOURCE_INCLUDED */
897 #endif  /* _CK_H */