1 | /*
|
---|
2 | * bltTkInt.h --
|
---|
3 | *
|
---|
4 | * Contains copies of internal Tk structures.
|
---|
5 | *
|
---|
6 | * Copyright 1993-1998 Lucent Technologies, Inc.
|
---|
7 | *
|
---|
8 | * Permission to use, copy, modify, and distribute this software and
|
---|
9 | * its documentation for any purpose and without fee is hereby
|
---|
10 | * granted, provided that the above copyright notice appear in all
|
---|
11 | * copies and that both that the copyright notice and warranty
|
---|
12 | * disclaimer appear in supporting documentation, and that the names
|
---|
13 | * of Lucent Technologies any of their entities not be used in
|
---|
14 | * advertising or publicity pertaining to distribution of the software
|
---|
15 | * without specific, written prior permission.
|
---|
16 | *
|
---|
17 | * Lucent Technologies disclaims all warranties with regard to this
|
---|
18 | * software, including all implied warranties of merchantability and
|
---|
19 | * fitness. In no event shall Lucent Technologies be liable for any
|
---|
20 | * special, indirect or consequential damages or any damages
|
---|
21 | * whatsoever resulting from loss of use, data or profits, whether in
|
---|
22 | * an action of contract, negligence or other tortuous action, arising
|
---|
23 | * out of or in connection with the use or performance of this
|
---|
24 | * software.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef _BLT_TKINT_H
|
---|
28 | #define _BLT_TKINT_H
|
---|
29 |
|
---|
30 | typedef struct {
|
---|
31 | Tk_Uid family; /* Font family. The most important field. */
|
---|
32 | int pointsize; /* Pointsize of font, 0 for default size, or
|
---|
33 | * negative number meaning pixel size. */
|
---|
34 | int weight; /* Weight flag; see below for def'n. */
|
---|
35 | int slant; /* Slant flag; see below for def'n. */
|
---|
36 | int underline; /* Non-zero for underline font. */
|
---|
37 | int overstrike; /* Non-zero for overstrike font. */
|
---|
38 | } TkFontAttributes;
|
---|
39 |
|
---|
40 | typedef struct {
|
---|
41 | int ascent; /* From baseline to top of font. */
|
---|
42 | int descent; /* From baseline to bottom of font. */
|
---|
43 | int maxWidth; /* Width of widest character in font. */
|
---|
44 | int fixed; /* Non-zero if this is a fixed-width font,
|
---|
45 | * 0 otherwise. */
|
---|
46 | } TkFontMetrics;
|
---|
47 |
|
---|
48 |
|
---|
49 | typedef struct TkFontStruct {
|
---|
50 | /*
|
---|
51 | * Fields used and maintained exclusively by generic code.
|
---|
52 | */
|
---|
53 | #if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
|
---|
54 | int resourceRefCount; /* Number of active uses of this font (each
|
---|
55 | * active use corresponds to a call to
|
---|
56 | * Tk_AllocFontFromTable or Tk_GetFont).
|
---|
57 | * If this count is 0, then this TkFont
|
---|
58 | * structure is no longer valid and it isn't
|
---|
59 | * present in a hash table: it is being
|
---|
60 | * kept around only because there are objects
|
---|
61 | * referring to it. The structure is freed
|
---|
62 | * when resourceRefCount and objRefCount
|
---|
63 | * are both 0. */
|
---|
64 | int objRefCount; /* The number of Tcl objects that reference
|
---|
65 | * this structure. */
|
---|
66 | #else
|
---|
67 | int refCount; /* Number of users of the TkFont. */
|
---|
68 | #endif
|
---|
69 | Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
|
---|
70 | * used when deleting it. */
|
---|
71 | Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
|
---|
72 | * corresponds to the named font that the
|
---|
73 | * tkfont was based on, or NULL if the tkfont
|
---|
74 | * was not based on a named font. */
|
---|
75 | #if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
|
---|
76 | Screen *screen; /* The screen where this font is valid. */
|
---|
77 | #endif /* TK_VERSION_NUMBER >= 8.1.0 */
|
---|
78 | int tabWidth; /* Width of tabs in this font (pixels). */
|
---|
79 | int underlinePos; /* Offset from baseline to origin of
|
---|
80 | * underline bar (used for drawing underlines
|
---|
81 | * on a non-underlined font). */
|
---|
82 | int underlineHeight; /* Height of underline bar (used for drawing
|
---|
83 | * underlines on a non-underlined font). */
|
---|
84 |
|
---|
85 | /*
|
---|
86 | * Fields in the generic font structure that are filled in by
|
---|
87 | * platform-specific code.
|
---|
88 | */
|
---|
89 |
|
---|
90 | Font fid; /* For backwards compatibility with XGCValues
|
---|
91 | * structures. Remove when TkGCValues is
|
---|
92 | * implemented. */
|
---|
93 | TkFontAttributes fa; /* Actual font attributes obtained when the
|
---|
94 | * the font was created, as opposed to the
|
---|
95 | * desired attributes passed in to
|
---|
96 | * TkpGetFontFromAttributes(). The desired
|
---|
97 | * metrics can be determined from the string
|
---|
98 | * that was used to create this font. */
|
---|
99 | TkFontMetrics fm; /* Font metrics determined when font was
|
---|
100 | * created. */
|
---|
101 | #if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
|
---|
102 | struct TkFontStruct *nextPtr; /* Points to the next TkFont structure with
|
---|
103 | * the same name. All fonts with the
|
---|
104 | * same name (but different displays) are
|
---|
105 | * chained together off a single entry in
|
---|
106 | * a hash table. */
|
---|
107 | #endif /* TK_VERSION_NUMBER >= 8.1.0 */
|
---|
108 | } TkFont;
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * This structure is used by the Mac and Window porting layers as
|
---|
112 | * the internal representation of a clip_mask in a GC.
|
---|
113 | */
|
---|
114 | typedef struct TkRegionStruct *TkRegion;
|
---|
115 |
|
---|
116 | typedef struct {
|
---|
117 | int type; /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
|
---|
118 | union {
|
---|
119 | Pixmap pixmap;
|
---|
120 | TkRegion region;
|
---|
121 | } value;
|
---|
122 | } TkpClipMask;
|
---|
123 |
|
---|
124 | #define TKP_CLIP_PIXMAP 0
|
---|
125 | #define TKP_CLIP_REGION 1
|
---|
126 |
|
---|
127 | #ifdef WIN32
|
---|
128 | /*
|
---|
129 | * The TkWinDrawable is the internal implementation of an X Drawable (either
|
---|
130 | * a Window or a Pixmap). The following constants define the valid Drawable
|
---|
131 | * types.
|
---|
132 | */
|
---|
133 |
|
---|
134 | #define TWD_BITMAP 1
|
---|
135 | #define TWD_WINDOW 2
|
---|
136 | #define TWD_WINDC 3
|
---|
137 |
|
---|
138 | typedef struct TkWindowStruct TkWindow;
|
---|
139 |
|
---|
140 | typedef struct {
|
---|
141 | int type;
|
---|
142 | HWND handle;
|
---|
143 | TkWindow *winPtr;
|
---|
144 | } TkWinWindow;
|
---|
145 |
|
---|
146 | typedef struct {
|
---|
147 | int type;
|
---|
148 | HBITMAP handle;
|
---|
149 | Colormap colormap;
|
---|
150 | int depth;
|
---|
151 | } TkWinBitmap;
|
---|
152 |
|
---|
153 | typedef struct {
|
---|
154 | int type;
|
---|
155 | HDC hdc;
|
---|
156 | } TkWinDC;
|
---|
157 |
|
---|
158 | typedef union {
|
---|
159 | int type;
|
---|
160 | TkWinWindow window;
|
---|
161 | TkWinBitmap bitmap;
|
---|
162 | TkWinDC winDC;
|
---|
163 | } TkWinDrawable;
|
---|
164 |
|
---|
165 | /*
|
---|
166 | * The TkWinDCState is used to save the state of a device context
|
---|
167 | * so that it can be restored later.
|
---|
168 | */
|
---|
169 |
|
---|
170 | typedef struct {
|
---|
171 | HPALETTE palette;
|
---|
172 | int bkmode; /* This field was added in Tk
|
---|
173 | * 8.3.1. Be careful that you don't
|
---|
174 | * use this structure in a context
|
---|
175 | * where its size is important. */
|
---|
176 | } TkWinDCState;
|
---|
177 |
|
---|
178 | extern HDC TkWinGetDrawableDC(Display *display, Drawable drawable,
|
---|
179 | TkWinDCState * state);
|
---|
180 | extern HDC TkWinReleaseDrawableDC(Drawable drawable, HDC dc,
|
---|
181 | TkWinDCState * state);
|
---|
182 |
|
---|
183 | extern HWND Tk_GetHWND _ANSI_ARGS_((Window window));
|
---|
184 |
|
---|
185 | extern HINSTANCE Tk_GetHINSTANCE _ANSI_ARGS_((void));
|
---|
186 |
|
---|
187 | extern Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hWnd));
|
---|
188 |
|
---|
189 | #endif /* WIN32 */
|
---|
190 |
|
---|
191 | /*
|
---|
192 | * The Border structure used internally by the Tk_3D* routines.
|
---|
193 | * The following is a copy of it from tk3d.c.
|
---|
194 | */
|
---|
195 |
|
---|
196 | typedef struct TkBorderStruct {
|
---|
197 | Screen *screen; /* Screen on which the border will be used. */
|
---|
198 | Visual *visual; /* Visual for all windows and pixmaps using
|
---|
199 | * the border. */
|
---|
200 | int depth; /* Number of bits per pixel of drawables where
|
---|
201 | * the border will be used. */
|
---|
202 | Colormap colormap; /* Colormap out of which pixels are
|
---|
203 | * allocated. */
|
---|
204 | int refCount; /* Number of different users of
|
---|
205 | * this border. */
|
---|
206 | #if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
|
---|
207 | int objRefCount; /* The number of Tcl objects that reference
|
---|
208 | * this structure. */
|
---|
209 | #endif /* TK_VERSION_NUMBER >= 8.1.0 */
|
---|
210 | XColor *bgColor; /* Background color (intensity between
|
---|
211 | * lightColorPtr and darkColorPtr). */
|
---|
212 | XColor *darkColor; /* Color for darker areas (must free when
|
---|
213 | * deleting structure). NULL means shadows
|
---|
214 | * haven't been allocated yet.*/
|
---|
215 | XColor *lightColor; /* Color used for lighter areas of border
|
---|
216 | * (must free this when deleting structure).
|
---|
217 | * NULL means shadows haven't been allocated
|
---|
218 | * yet. */
|
---|
219 | Pixmap shadow; /* Stipple pattern to use for drawing
|
---|
220 | * shadows areas. Used for displays with
|
---|
221 | * <= 64 colors or where colormap has filled
|
---|
222 | * up. */
|
---|
223 | GC bgGC; /* Used (if necessary) to draw areas in
|
---|
224 | * the background color. */
|
---|
225 | GC darkGC; /* Used to draw darker parts of the
|
---|
226 | * border. None means the shadow colors
|
---|
227 | * haven't been allocated yet.*/
|
---|
228 | GC lightGC; /* Used to draw lighter parts of
|
---|
229 | * the border. None means the shadow colors
|
---|
230 | * haven't been allocated yet. */
|
---|
231 | Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in
|
---|
232 | * order to delete structure). */
|
---|
233 | struct TkBorderStruct *nextPtr; /* Points to the next TkBorder structure with
|
---|
234 | * the same color name. Borders with the
|
---|
235 | * same name but different screens or
|
---|
236 | * colormaps are chained together off a
|
---|
237 | * single entry in borderTable. */
|
---|
238 | } TkBorder;
|
---|
239 |
|
---|
240 | #endif /* BLT_TKINT_H */
|
---|