1/*
2 * tk3d.h --
3 *
4 *	Declarations of types and functions shared by the 3d border module.
5 *
6 * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
7 *
8 * See the file "license.terms" for information on usage and redistribution of
9 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 *
11 * RCS: @(#) $Id$
12 */
13
14#ifndef _TK3D
15#define _TK3D
16
17#include <tkInt.h>
18
19#ifdef BUILD_tk
20# undef TCL_STORAGE_CLASS
21# define TCL_STORAGE_CLASS DLLEXPORT
22#endif
23
24/*
25 * One of the following data structures is allocated for each 3-D border
26 * currently in use. Structures of this type are indexed by borderTable, so
27 * that a single structure can be shared for several uses.
28 */
29
30typedef struct TkBorder {
31    Screen *screen;		/* Screen on which the border will be used. */
32    Visual *visual;		/* Visual for all windows and pixmaps using
33				 * the border. */
34    int depth;			/* Number of bits per pixel of drawables where
35				 * the border will be used. */
36    Colormap colormap;		/* Colormap out of which pixels are
37				 * allocated. */
38    int resourceRefCount;	/* Number of active uses of this color (each
39				 * active use corresponds to a call to
40				 * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder).
41				 * If this count is 0, then this structure is
42				 * no longer valid and it isn't present in
43				 * borderTable: it is being kept around only
44				 * because there are objects referring to it.
45				 * The structure is freed when
46				 * resourceRefCount and objRefCount are both
47				 * 0. */
48    int objRefCount;		/* The number of Tcl objects that reference
49				 * this structure. */
50    XColor *bgColorPtr;		/* Background color (intensity between
51				 * lightColorPtr and darkColorPtr). */
52    XColor *darkColorPtr;	/* Color for darker areas (must free when
53				 * deleting structure). NULL means shadows
54				 * haven't been allocated yet.*/
55    XColor *lightColorPtr;	/* Color used for lighter areas of border
56				 * (must free this when deleting structure).
57				 * NULL means shadows haven't been allocated
58				 * yet. */
59    Pixmap shadow;		/* Stipple pattern to use for drawing shadows
60				 * areas. Used for displays with <= 64 colors
61				 * or where colormap has filled up. */
62    GC bgGC;			/* Used (if necessary) to draw areas in the
63				 * background color. */
64    GC darkGC;			/* Used to draw darker parts of the border.
65				 * None means the shadow colors haven't been
66				 * allocated yet.*/
67    GC lightGC;			/* Used to draw lighter parts of the border.
68				 * None means the shadow colors haven't been
69				 * allocated yet. */
70    Tcl_HashEntry *hashPtr;	/* Entry in borderTable (needed in order to
71				 * delete structure). */
72    struct TkBorder *nextPtr;	/* Points to the next TkBorder structure with
73				 * the same color name. Borders with the same
74				 * name but different screens or colormaps are
75				 * chained together off a single entry in
76				 * borderTable. */
77} TkBorder;
78
79/*
80 * Maximum intensity for a color:
81 */
82
83#define MAX_INTENSITY 65535
84
85/*
86 * Declarations for platform specific interfaces used by this module.
87 */
88
89MODULE_SCOPE TkBorder	*TkpGetBorder(void);
90MODULE_SCOPE void	TkpGetShadows(TkBorder *borderPtr, Tk_Window tkwin);
91MODULE_SCOPE void	TkpFreeBorder(TkBorder *borderPtr);
92
93# undef TCL_STORAGE_CLASS
94# define TCL_STORAGE_CLASS DLLIMPORT
95
96#endif /* _TK3D */
97