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