1 /*
2 * tkcompat.h --
3 *
4 * Tk4.2 / 8.0 compatibility declarations
5 *
6 * Copyright (c) 1997-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * @(#) $Header: /usr/mash/src/repository/mash/mash-1/compat/tkcompat.h,v 1.4 2002/02/03 03:14:22 lim Exp $
34 */
35
36 #ifndef MASH_TKCOMPAT_H
37 #define MASH_TKCOMPAT_H
38
39 #ifndef TK_MAJOR_VERSION
40 #error "you need to include tk.h first"
41 #endif
42
43 /*
44 * Tk4.2 / 8.0 compatibility code
45 *
46 * Note that they are not fool-proof implementations, but just enough
47 * to get by
48 */
49 #if TK_MAJOR_VERSION < 8
50
51 #include <X11/Xlib.h>
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 typedef XFontStruct* Tk_Font;
58 #define Tk_FontId(pXFontStruct) (pXFontStruct->fid)
59 #define Tk_TextWidth(pf, str, len) XTextWidth(pf, str, len)
60
61 /*
62 * The following structure is used by Tk_GetFontMetrics() to return
63 * information about the properties of a Tk_Font.
64 */
65
66 typedef struct Tk_FontMetrics {
67 int ascent; /* The amount in pixels that the tallest
68 * letter sticks up above the baseline, plus
69 * any extra blank space added by the designer
70 * of the font. */
71 int descent; /* The largest amount in pixels that any
72 * letter sticks below the baseline, plus any
73 * extra blank space added by the designer of
74 * the font. */
75 int linespace; /* The sum of the ascent and descent. How
76 * far apart two lines of text in the same
77 * font should be placed so that none of the
78 * characters in one line overlap any of the
79 * characters in the other line. */
80 } Tk_FontMetrics;
81
82 extern void Tk_GetFontMetrics(Tk_Font font, Tk_FontMetrics *fmPtr);
83
84 #define Tk_DrawChars(display, drawable, gc, tkfont, string, length, x, y) \
85 XDrawString(display, drawable, gc, x, y, string, length)
86
87 #define Tk_GetFont Tk_GetFontStruct
88 #define Tk_FreeFont Tk_FreeFontStruct
89 #define Tk_NameOfFont Tk_NameOfFontStruct
90 #define Tk_GetHINSTANCE TkWinGetAppInstance
91
92 #ifdef __cplusplus
93 };
94 #endif
95
96
97 #endif /* TK_MAJOR_VERSION < 8 */
98
99 #endif /* #ifdef TKCOMPAT_H */
100
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.