1 |
578 |
markom |
/*
|
2 |
|
|
* ------------------------------------------------------------------------
|
3 |
|
|
* PACKAGE: [incr Tk]
|
4 |
|
|
* DESCRIPTION: Building mega-widgets with [incr Tcl]
|
5 |
|
|
*
|
6 |
|
|
* [incr Tk] provides a framework for building composite "mega-widgets"
|
7 |
|
|
* using [incr Tcl] classes. It defines a set of base classes that are
|
8 |
|
|
* specialized to create all other widgets.
|
9 |
|
|
*
|
10 |
|
|
* ADDING [incr Tk] TO A Tcl-BASED APPLICATION:
|
11 |
|
|
*
|
12 |
|
|
* To add [incr Tk] facilities to a Tcl application, modify the
|
13 |
|
|
* Tcl_AppInit() routine as follows:
|
14 |
|
|
*
|
15 |
|
|
* 1) Include the header files for [incr Tcl] and [incr Tk] near
|
16 |
|
|
* the top of the file containing Tcl_AppInit():
|
17 |
|
|
*
|
18 |
|
|
* #include "itcl.h"
|
19 |
|
|
* #include "itk.h"
|
20 |
|
|
*
|
21 |
|
|
* 2) Within the body of Tcl_AppInit(), add the following lines:
|
22 |
|
|
*
|
23 |
|
|
* if (Itcl_Init(interp) == TCL_ERROR) {
|
24 |
|
|
* return TCL_ERROR;
|
25 |
|
|
* }
|
26 |
|
|
* if (Itk_Init(interp) == TCL_ERROR) {
|
27 |
|
|
* return TCL_ERROR;
|
28 |
|
|
* }
|
29 |
|
|
*
|
30 |
|
|
* 3) Link your application with libitcl.a and libitk.a
|
31 |
|
|
*
|
32 |
|
|
* NOTE: An example file "tkAppInit.c" containing the changes shown
|
33 |
|
|
* above is included in this distribution.
|
34 |
|
|
*
|
35 |
|
|
* ========================================================================
|
36 |
|
|
* AUTHOR: Michael J. McLennan
|
37 |
|
|
* Bell Labs Innovations for Lucent Technologies
|
38 |
|
|
* mmclennan@lucent.com
|
39 |
|
|
* http://www.tcltk.com/itcl
|
40 |
|
|
*
|
41 |
|
|
* RCS: $Id: itk.h,v 1.1.1.1 2002-01-16 10:24:47 markom Exp $
|
42 |
|
|
* ========================================================================
|
43 |
|
|
* Copyright (c) 1993-1998 Lucent Technologies, Inc.
|
44 |
|
|
* ------------------------------------------------------------------------
|
45 |
|
|
* See the file "license.terms" for information on usage and redistribution
|
46 |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
47 |
|
|
*/
|
48 |
|
|
#ifndef ITK_H
|
49 |
|
|
#define ITK_H
|
50 |
|
|
|
51 |
|
|
/*
|
52 |
|
|
* A special definition used to allow this header file to be included
|
53 |
|
|
* in resource files so that they can get obtain version information from
|
54 |
|
|
* this file. Resource compilers don't like all the C stuff, like typedefs
|
55 |
|
|
* and procedure declarations, that occur below.
|
56 |
|
|
*/
|
57 |
|
|
|
58 |
|
|
#ifndef RESOURCE_INCLUDED
|
59 |
|
|
|
60 |
|
|
#include "itclInt.h"
|
61 |
|
|
#include "tk.h"
|
62 |
|
|
|
63 |
|
|
#ifdef BUILD_itk
|
64 |
|
|
# undef TCL_STORAGE_CLASS
|
65 |
|
|
# define TCL_STORAGE_CLASS DLLEXPORT
|
66 |
|
|
#endif
|
67 |
|
|
|
68 |
|
|
/*
|
69 |
|
|
* List of options in alphabetical order:
|
70 |
|
|
*/
|
71 |
|
|
typedef struct ItkOptList {
|
72 |
|
|
Tcl_HashTable *options; /* list containing the real options */
|
73 |
|
|
Tcl_HashEntry **list; /* gives ordering of options */
|
74 |
|
|
int len; /* number of entries in order list */
|
75 |
|
|
int max; /* maximum size of order list */
|
76 |
|
|
} ItkOptList;
|
77 |
|
|
|
78 |
|
|
/*
|
79 |
|
|
* List of options created in the class definition:
|
80 |
|
|
*/
|
81 |
|
|
typedef struct ItkClassOptTable {
|
82 |
|
|
Tcl_HashTable options; /* option storage with fast lookup */
|
83 |
|
|
ItkOptList order; /* gives ordering of options */
|
84 |
|
|
} ItkClassOptTable;
|
85 |
|
|
|
86 |
|
|
/*
|
87 |
|
|
* Each option created in the class definition:
|
88 |
|
|
*/
|
89 |
|
|
typedef struct ItkClassOption {
|
90 |
|
|
ItclMember *member; /* info about this option */
|
91 |
|
|
char *resName; /* resource name in X11 database */
|
92 |
|
|
char *resClass; /* resource class name in X11 database */
|
93 |
|
|
char *init; /* initial value for option */
|
94 |
|
|
} ItkClassOption;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
/*
|
98 |
|
|
* Exported functions:
|
99 |
|
|
*/
|
100 |
|
|
EXTERN int Itk_Init _ANSI_ARGS_((Tcl_Interp *interp));
|
101 |
|
|
EXTERN int Itk_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
|
102 |
|
|
|
103 |
|
|
/*
|
104 |
|
|
* Functions used internally by this package:
|
105 |
|
|
*/
|
106 |
|
|
EXTERN int Itk_ConfigBodyCmd _ANSI_ARGS_((ClientData cdata,
|
107 |
|
|
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
|
108 |
|
|
EXTERN int Itk_UsualCmd _ANSI_ARGS_((ClientData cdata,
|
109 |
|
|
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
|
110 |
|
|
|
111 |
|
|
/*
|
112 |
|
|
* Functions for managing options included in class definitions:
|
113 |
|
|
*/
|
114 |
|
|
EXTERN int Itk_ClassOptionDefineCmd _ANSI_ARGS_((ClientData cdata,
|
115 |
|
|
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
|
116 |
|
|
EXTERN int Itk_ClassOptionIllegalCmd _ANSI_ARGS_((ClientData cdata,
|
117 |
|
|
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
|
118 |
|
|
|
119 |
|
|
EXTERN int Itk_ConfigClassOption _ANSI_ARGS_((Tcl_Interp *interp,
|
120 |
|
|
ItclObject *contextObj, ClientData cdata, char* newVal));
|
121 |
|
|
|
122 |
|
|
EXTERN ItkClassOptTable* Itk_CreateClassOptTable _ANSI_ARGS_((
|
123 |
|
|
Tcl_Interp *interp, ItclClass *cdefn));
|
124 |
|
|
EXTERN ItkClassOptTable* Itk_FindClassOptTable _ANSI_ARGS_((
|
125 |
|
|
ItclClass *cdefn));
|
126 |
|
|
EXTERN void Itk_DeleteClassOptTable _ANSI_ARGS_((Tcl_Interp *interp,
|
127 |
|
|
ItclClass *cdefn));
|
128 |
|
|
|
129 |
|
|
EXTERN int Itk_CreateClassOption _ANSI_ARGS_((Tcl_Interp *interp,
|
130 |
|
|
ItclClass *cdefn, char *switchName, char *resName, char *resClass,
|
131 |
|
|
char *defVal, char *config, ItkClassOption **optPtr));
|
132 |
|
|
EXTERN ItkClassOption* Itk_FindClassOption _ANSI_ARGS_((
|
133 |
|
|
ItclClass *cdefn, char *switchName));
|
134 |
|
|
EXTERN void Itk_DelClassOption _ANSI_ARGS_((ItkClassOption *opt));
|
135 |
|
|
|
136 |
|
|
/*
|
137 |
|
|
* Functions needed for the Archetype base class:
|
138 |
|
|
*/
|
139 |
|
|
EXTERN int Itk_ArchetypeInit _ANSI_ARGS_((Tcl_Interp* interp));
|
140 |
|
|
|
141 |
|
|
/*
|
142 |
|
|
* Functions for maintaining the ordered option list:
|
143 |
|
|
*/
|
144 |
|
|
EXTERN void Itk_OptListInit _ANSI_ARGS_((ItkOptList* olist,
|
145 |
|
|
Tcl_HashTable *options));
|
146 |
|
|
EXTERN void Itk_OptListFree _ANSI_ARGS_((ItkOptList* olist));
|
147 |
|
|
|
148 |
|
|
EXTERN void Itk_OptListAdd _ANSI_ARGS_((ItkOptList* olist,
|
149 |
|
|
Tcl_HashEntry *entry));
|
150 |
|
|
EXTERN void Itk_OptListRemove _ANSI_ARGS_((ItkOptList* olist,
|
151 |
|
|
Tcl_HashEntry *entry));
|
152 |
|
|
|
153 |
|
|
# undef TCL_STORAGE_CLASS
|
154 |
|
|
# define TCL_STORAGE_CLASS DLLIMPORT
|
155 |
|
|
|
156 |
|
|
#endif /* RESOURCE INCLUDED */
|
157 |
|
|
#endif /* ITK_H */
|