OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [generic/] [tix.h] - Blame information for rev 1781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tix.h --
3
 *
4
 *      This is the standard header file for all tix C code. It
5
 *      defines many macros and utility functions to make it easier to
6
 *      write TCL commands and TK widgets in C. No more needs to write
7
 *      2000 line functions!
8
 *
9
 * Copyright (c) 1996, Expert Interface Technologies
10
 *
11
 * See the file "license.terms" for information on usage and redistribution
12
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
 *
14
 */
15
 
16
#ifndef _TIX_H_
17
#define _TIX_H_
18
 
19
#ifndef TIX_VERSION
20
#define TIX_VERSION     "4.1"
21
#endif
22
#define TIX_PATCHLEVEL  "4.1.0"
23
#define TIX_PATCH_LEVEL TIX_PATCHLEVEL
24
 
25
#define TIX_RELEASE     "4.1.0.005"
26
 
27
#ifndef RC_INVOKED
28
 
29
#ifndef _TCL
30
#include <tcl.h>
31
#endif
32
 
33
#ifndef _TK
34
#include <tk.h>
35
#endif
36
 
37
 
38
#if defined(__WIN32__) || defined(_WIN32) || defined (__BORLAND) || defined(_Windows)
39
#ifndef _WINDOWS
40
#define _WINDOWS
41
#endif
42
#endif
43
 
44
#ifdef BUILD_tix
45
# undef TCL_STORAGE_CLASS
46
# define TCL_STORAGE_CLASS DLLEXPORT
47
#endif
48
 
49
#ifdef __cplusplus
50
extern "C" {
51
#endif
52
 
53
#if (TCL_MAJOR_VERSION > 7)
54
#  define TCL_7_5_OR_LATER
55
#else
56
#  if ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 5))
57
#    define TCL_7_5_OR_LATER
58
#  endif
59
#endif
60
 
61
 
62
#if (TK_MAJOR_VERSION > 4)
63
#  define TK_4_1_OR_LATER
64
#else
65
#  if ((TK_MAJOR_VERSION == 4) && (TK_MINOR_VERSION >= 1))
66
#    define TK_4_1_OR_LATER
67
#  endif
68
#endif /* TK_MAJOR_VERSION ... */
69
 
70
#if (TK_MAJOR_VERSION >= 8)
71
#  define TK_8_0_OR_LATER
72
#endif
73
 
74
#ifdef TK_4_1_OR_LATER
75
    /* TK 4.1 or later */
76
#  define Tix_FreeProc Tcl_FreeProc
77
 
78
#else
79
    /* TK 4.0 */
80
#  define Tix_FreeProc Tk_FreeProc
81
 
82
    /* These portable features were not defined in previous versions of
83
     * TK but are used in Tix. Let's define them here.
84
     */
85
#  define TkPutImage(a, b, c, d, e, f, g, h, i, j, k, l) \
86
        XPutImage(c, d, e, f, g, h, i, j, k, l)
87
 
88
#  define TkStringToKeysym XStringToKeysym 
89
 
90
#endif /* TK_4_1_OR_LATER */
91
 
92
 
93
#define TIX_STDIN_ALWAYS        0
94
#define TIX_STDIN_OPTIONAL      1
95
#define TIX_STDIN_NONE          2
96
 
97
typedef struct {
98
    char *name;                 /* Name of command. */
99
    int (*cmdProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
100
                                int argc, char **argv));
101
                                /* Command procedure. */
102
} Tix_TclCmd;
103
 
104
 
105
/*----------------------------------------------------------------------
106
 *
107
 *
108
 *                      SUB-COMMAND HANDLING
109
 *
110
 *
111
 *----------------------------------------------------------------------
112
 */
113
typedef int (*Tix_CmdProc) _ANSI_ARGS_((ClientData clientData,
114
        Tcl_Interp *interp, int argc, char ** argv));
115
typedef int (*Tix_SubCmdProc) _ANSI_ARGS_((ClientData clientData,
116
        Tcl_Interp *interp, int argc, char ** argv));
117
typedef int (*Tix_CheckArgvProc) _ANSI_ARGS_((ClientData clientData,
118
        Tcl_Interp *interp, int argc, char ** argv));
119
 
120
typedef struct _Tix_CmdInfo {
121
    int         numSubCmds;
122
    int         minargc;
123
    int         maxargc;
124
    char      * info;
125
} Tix_CmdInfo;
126
 
127
typedef struct _Tix_SubCmdInfo {
128
    int                 namelen;
129
    char              * name;
130
    int                 minargc;
131
    int                 maxargc;
132
    Tix_SubCmdProc      proc;
133
    char              * info;
134
    Tix_CheckArgvProc   checkArgvProc;
135
} Tix_SubCmdInfo;
136
 
137
/*
138
 * Tix_ArraySize --
139
 *
140
 *      Find out the number of elements inside a C array. The argument "x"
141
 * must be a valid C array. Pointers don't work.
142
 */
143
#define Tix_ArraySize(x) (sizeof(x) / sizeof(x[0]))
144
 
145
/*
146
 * This is used for Tix_CmdInfo.maxargc and Tix_SubCmdInfo.maxargc,
147
 * indicating that this command takes a variable number of arguments.
148
 */
149
#define TIX_VAR_ARGS           -1
150
 
151
/*
152
 * TIX_DEFAULT_LEN --
153
 *
154
 * Use this for Tix_SubCmdInfo.namelen and Tix_ExecSubCmds() will try to
155
 * determine the length of the subcommand name for you.
156
 */
157
#define TIX_DEFAULT_LEN        -1
158
 
159
/*
160
 * TIX_DEFAULT_SUB_CMD --
161
 *
162
 * Use this for Tix_SubCmdInfo.name. This will match any subcommand name,
163
 * including the empty string, when Tix_ExecSubCmds() finds a subcommand
164
 * to execute.
165
 */
166
#define TIX_DEFAULT_SUBCMD      0
167
 
168
/*
169
 * TIX_DECLARE_CMD --
170
 *
171
 * This is just a handy macro to declare a C function to use as a
172
 * command function.
173
 */
174
#define TIX_DECLARE_CMD(func) \
175
    int func _ANSI_ARGS_((ClientData clientData,\
176
        Tcl_Interp *interp, int argc, char ** argv))
177
 
178
/*
179
 * TIX_DECLARE_SUBCMD --
180
 *
181
 * This is just a handy macro to declare a C function to use as a
182
 * sub command function.
183
 */
184
#define TIX_DECLARE_SUBCMD(func) \
185
    int func _ANSI_ARGS_((ClientData clientData,\
186
        Tcl_Interp *interp, int argc, char ** argv))
187
 
188
/*
189
 * TIX_DEFINE_CMD --
190
 *
191
 * This is just a handy macro to define a C function to use as a
192
 * command function.
193
 */
194
#define TIX_DEFINE_CMD(func) \
195
int func(clientData, interp, argc, argv) \
196
    ClientData clientData;      /* Main window associated with  \
197
                                 * interpreter. */              \
198
    Tcl_Interp *interp;         /* Current interpreter. */      \
199
    int argc;                   /* Number of arguments. */      \
200
    char **argv;                /* Argument strings. */
201
 
202
 
203
/*----------------------------------------------------------------------
204
 * Link-list functions --
205
 *
206
 *      These functions makes it easy to use link lists in C code.
207
 *
208
 *----------------------------------------------------------------------
209
 */
210
typedef struct Tix_ListInfo {
211
    int nextOffset;             /* offset of the "next" pointer in a list
212
                                 * item */
213
    int prevOffset;             /* offset of the "next" pointer in a list
214
                                 * item */
215
} Tix_ListInfo;
216
 
217
 
218
/* Singly-linked list */
219
typedef struct Tix_LinkList {
220
    int numItems;               /* number of items in this list */
221
    char * head;                /* (general pointer) head of the list */
222
    char * tail;                /* (general pointer) tail of the list */
223
} Tix_LinkList;
224
 
225
typedef struct Tix_ListIterator {
226
    char * last;
227
    char * curr;
228
    unsigned int started : 1;   /* True if the search operation has
229
                                 * already started for this list */
230
    unsigned int deleted : 1;   /* True if a delete operation has been
231
                                 * performed on the current item (in this
232
                                 * case the curr pointer has already been
233
                                 * adjusted
234
                                 */
235
} Tix_ListIterator;
236
 
237
#define Tix_IsLinkListEmpty(list)  ((list.numItems) == 0)
238
#define TIX_UNIQUE 1
239
#define TIX_UNDEFINED -1
240
 
241
/*----------------------------------------------------------------------
242
 * General Single Link List --
243
 *
244
 *      The next pointer can be anywhere inside a link.
245
 *----------------------------------------------------------------------
246
 */
247
 
248
EXTERN void             Tix_LinkListInit _ANSI_ARGS_((Tix_LinkList * lPtr));
249
EXTERN void             Tix_LinkListAppend _ANSI_ARGS_((Tix_ListInfo * infoPtr,
250
                            Tix_LinkList * lPtr, char * itemPtr, int flags));
251
EXTERN void             Tix_LinkListStart _ANSI_ARGS_((Tix_ListInfo * infoPtr,
252
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
253
EXTERN void             Tix_LinkListNext _ANSI_ARGS_((Tix_ListInfo * infoPtr,
254
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
255
EXTERN void             Tix_LinkListDelete _ANSI_ARGS_((Tix_ListInfo * infoPtr,
256
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
257
EXTERN int              Tix_LinkListDeleteRange _ANSI_ARGS_((
258
                            Tix_ListInfo * infoPtr, Tix_LinkList * lPtr,
259
                            char * fromPtr, char * toPtr,
260
                            Tix_ListIterator * liPtr));
261
EXTERN int              Tix_LinkListFind _ANSI_ARGS_((
262
                            Tix_ListInfo * infoPtr, Tix_LinkList * lPtr,
263
                            char * itemPtr, Tix_ListIterator * liPtr));
264
EXTERN int              Tix_LinkListFindAndDelete _ANSI_ARGS_((
265
                            Tix_ListInfo * infoPtr, Tix_LinkList * lPtr,
266
                            char * itemPtr, Tix_ListIterator * liPtr));
267
EXTERN void             Tix_LinkListInsert _ANSI_ARGS_((
268
                            Tix_ListInfo * infoPtr,
269
                            Tix_LinkList * lPtr, char * itemPtr,
270
                            Tix_ListIterator * liPtr));
271
EXTERN void             Tix_LinkListIteratorInit _ANSI_ARGS_((
272
                            Tix_ListIterator * liPtr));
273
 
274
#define Tix_LinkListDone(liPtr) ((liPtr)->curr == NULL)
275
 
276
 
277
/*----------------------------------------------------------------------
278
 * Simple Single Link List --
279
 *
280
 *      The next pointer is always offset 0 in the link structure.
281
 *----------------------------------------------------------------------
282
 */
283
 
284
EXTERN void             Tix_SimpleListInit _ANSI_ARGS_((Tix_LinkList * lPtr));
285
EXTERN void             Tix_SimpleListAppend _ANSI_ARGS_((
286
                            Tix_LinkList * lPtr, char * itemPtr, int flags));
287
EXTERN void             Tix_SimpleListStart _ANSI_ARGS_((
288
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
289
EXTERN void             Tix_SimpleListNext _ANSI_ARGS_((
290
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
291
EXTERN void             Tix_SimpleListDelete _ANSI_ARGS_((
292
                            Tix_LinkList * lPtr, Tix_ListIterator * liPtr));
293
EXTERN int              Tix_SimpleListDeleteRange _ANSI_ARGS_((
294
                            Tix_LinkList * lPtr,
295
                            char * fromPtr, char * toPtr,
296
                            Tix_ListIterator * liPtr));
297
EXTERN int              Tix_SimpleListFind _ANSI_ARGS_((
298
                            Tix_LinkList * lPtr,
299
                            char * itemPtr, Tix_ListIterator * liPtr));
300
EXTERN int              Tix_SimpleListFindAndDelete _ANSI_ARGS_((
301
                            Tix_LinkList * lPtr, char * itemPtr,
302
                            Tix_ListIterator * liPtr));
303
EXTERN void             Tix_SimpleListInsert _ANSI_ARGS_((
304
                            Tix_LinkList * lPtr, char * itemPtr,
305
                            Tix_ListIterator * liPtr));
306
EXTERN void             Tix_SimpleListIteratorInit _ANSI_ARGS_((
307
                            Tix_ListIterator * liPtr));
308
 
309
#define Tix_SimpleListDone(liPtr) ((liPtr)->curr == NULL)
310
 
311
/*----------------------------------------------------------------------
312
 *
313
 *
314
 *
315
 *                      CUSTOM CONFIG OPTIONS
316
 *
317
 *
318
 *----------------------------------------------------------------------
319
 */
320
#define TIX_RELIEF_RAISED       1
321
#define TIX_RELIEF_FLAT         2
322
#define TIX_RELIEF_SUNKEN       4
323
#define TIX_RELIEF_GROOVE       8
324
#define TIX_RELIEF_RIDGE        16
325
#define TIX_RELIEF_SOLID        32
326
 
327
typedef int Tix_Relief;
328
 
329
extern Tk_CustomOption tixConfigItemType;
330
extern Tk_CustomOption tixConfigItemStyle;
331
extern Tk_CustomOption tixConfigRelief;
332
 
333
/*
334
 * C functions exported by Tix
335
 */
336
 
337
EXTERN int              Tix_ArgcError _ANSI_ARGS_((Tcl_Interp *interp,
338
                            int argc, char ** argv, int prefixCount,
339
                            char *message));
340
EXTERN void             Tix_CreateCommands _ANSI_ARGS_((
341
                            Tcl_Interp *interp, Tix_TclCmd *commands,
342
                            ClientData clientData,
343
                            Tcl_CmdDeleteProc *deleteProc));
344
EXTERN Tk_Window        Tix_CreateSubWindow _ANSI_ARGS_((
345
                            Tcl_Interp * interp, Tk_Window tkwin,
346
                            char * subPath));
347
EXTERN int              Tix_DefinePixmap _ANSI_ARGS_((
348
                            Tcl_Interp * interp, Tk_Uid name, char **data));
349
EXTERN void             Tix_DrawAnchorLines _ANSI_ARGS_((
350
                            Display *display, Drawable drawable,
351
                            GC gc, int x, int y, int w, int h));
352
EXTERN int              Tix_EvalArgv _ANSI_ARGS_((
353
                            Tcl_Interp * interp, int argc, char ** argv));
354
EXTERN int              Tix_ExistMethod _ANSI_ARGS_((Tcl_Interp *interp,
355
                            char *context, char *method));
356
EXTERN void             Tix_Exit _ANSI_ARGS_((Tcl_Interp * interp, int code));
357
EXTERN Pixmap           Tix_GetRenderBuffer _ANSI_ARGS_((Display *display,
358
                            Drawable d, int width, int height, int depth));
359
 
360
#ifdef TCL_VARARGS
361
/*
362
 * The TCL_VARARGS macro is only defined in Tcl 7.5 or later
363
 */
364
EXTERN int              Tix_GlobalVarEval _ANSI_ARGS_(
365
                            TCL_VARARGS(Tcl_Interp *,interp));
366
#else
367
EXTERN int              Tix_GlobalVarEval _ANSI_ARGS_(
368
                            VARARGS(Tcl_Interp *interp));
369
#endif
370
 
371
EXTERN int              Tix_HandleSubCmds _ANSI_ARGS_((
372
                            Tix_CmdInfo * cmdInfo,
373
                            Tix_SubCmdInfo * subCmdInfo,
374
                            ClientData clientData, Tcl_Interp *interp,
375
                            int argc, char **argv));
376
EXTERN int              Tix_Init _ANSI_ARGS_((Tcl_Interp *interp));
377
 
378
EXTERN int              Tix_LoadTclLibrary _ANSI_ARGS_((
379
                            Tcl_Interp *interp, char *envName,
380
                            char *tclName, char *initFile,
381
                            char *defDir, char * appName));
382
EXTERN void             Tix_OpenStdin _ANSI_ARGS_((Tcl_Interp *interp));
383
EXTERN void             Tix_SetArgv _ANSI_ARGS_((Tcl_Interp *interp,
384
                            int argc, char **argv));
385
EXTERN void             Tix_SetRcFileName _ANSI_ARGS_((
386
                            Tcl_Interp * interp,  char * rcFileName));
387
 
388
 
389
/*
390
 * Commands exported by Tix
391
 *
392
 */
393
 
394
extern TIX_DECLARE_CMD(Tix_CallMethodCmd);
395
extern TIX_DECLARE_CMD(Tix_ChainMethodCmd);
396
extern TIX_DECLARE_CMD(Tix_ClassCmd);
397
extern TIX_DECLARE_CMD(Tix_DoWhenIdleCmd);
398
extern TIX_DECLARE_CMD(Tix_DoWhenMappedCmd);
399
extern TIX_DECLARE_CMD(Tix_FalseCmd);
400
extern TIX_DECLARE_CMD(Tix_FileCmd);
401
extern TIX_DECLARE_CMD(Tix_FlushXCmd);
402
extern TIX_DECLARE_CMD(Tix_FormCmd);
403
extern TIX_DECLARE_CMD(Tix_GridCmd);
404
extern TIX_DECLARE_CMD(Tix_GeometryRequestCmd);
405
extern TIX_DECLARE_CMD(Tix_Get3DBorderCmd);
406
extern TIX_DECLARE_CMD(Tix_GetBooleanCmd);
407
extern TIX_DECLARE_CMD(Tix_GetIntCmd);
408
extern TIX_DECLARE_CMD(Tix_GetMethodCmd);
409
extern TIX_DECLARE_CMD(Tix_HListCmd);
410
extern TIX_DECLARE_CMD(Tix_HandleOptionsCmd);
411
extern TIX_DECLARE_CMD(Tix_InputOnlyCmd);
412
extern TIX_DECLARE_CMD(Tix_ItemStyleCmd);
413
extern TIX_DECLARE_CMD(Tix_ManageGeometryCmd);
414
extern TIX_DECLARE_CMD(Tix_MapWindowCmd);
415
extern TIX_DECLARE_CMD(Tix_MoveResizeWindowCmd);
416
extern TIX_DECLARE_CMD(Tix_NoteBookFrameCmd);
417
extern TIX_DECLARE_CMD(Tix_RaiseWindowCmd);
418
extern TIX_DECLARE_CMD(Tix_ShellInputCmd);
419
extern TIX_DECLARE_CMD(Tix_StringSubCmd);
420
extern TIX_DECLARE_CMD(Tix_StrEqCmd);
421
extern TIX_DECLARE_CMD(Tix_TListCmd);
422
extern TIX_DECLARE_CMD(Tix_TmpLineCmd);
423
extern TIX_DECLARE_CMD(Tix_TrueCmd);
424
extern TIX_DECLARE_CMD(Tix_UnmapWindowCmd);
425
extern TIX_DECLARE_CMD(Tix_MwmCmd);
426
extern TIX_DECLARE_CMD(Tix_CreateWidgetCmd);
427
 
428
#define SET_RECORD(interp, record, var, value) \
429
        Tcl_SetVar2(interp, record, var, value, TCL_GLOBAL_ONLY)
430
 
431
#define GET_RECORD(interp, record, var) \
432
        Tcl_GetVar2(interp, record, var, TCL_GLOBAL_ONLY)
433
 
434
 
435
#define TIX_HASHKEY(k) ((sizeof(k)>sizeof(int))?((char*)&(k)):((char*)(k)))
436
 
437
/*----------------------------------------------------------------------
438
 * Compatibility section
439
 *----------------------------------------------------------------------        */
440
 
441
EXTERN char *           tixStrDup _ANSI_ARGS_((
442
                            CONST char * s));
443
 
444
#ifdef _WINDOWS
445
#ifndef NO_STRCASECMP
446
#define NO_STRCASECMP 1
447
#endif
448
#endif
449
 
450
#if defined(NO_STRCASECMP)
451
#  ifndef strcasecmp
452
#    define strcasecmp tixStrCaseCmp
453
#  endif
454
extern int              tixStrCaseCmp _ANSI_ARGS_((CONST char *s1,
455
                            CONST char *s2));
456
#endif
457
 
458
 
459
#ifdef __cplusplus
460
}
461
#endif
462
 
463
#undef TCL_STORAGE_CLASS
464
#define TCL_STORAGE_CLASS DLLIMPORT
465
 
466
#endif /* RC_INVOKED */
467
#endif /* _TIX_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.