1 |
dashley |
71 |
/* $Header$ */ |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
* tkColor.h -- |
5 |
|
|
* |
6 |
|
|
* Declarations of data types and functions used by the |
7 |
|
|
* Tk color module. |
8 |
|
|
* |
9 |
|
|
* Copyright (c) 1996-1997 by Sun Microsystems, Inc. |
10 |
|
|
* |
11 |
|
|
* See the file "license.terms" for information on usage and redistribution |
12 |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
13 |
|
|
* |
14 |
|
|
* RCS: @(#) $Id: tkcolor.h,v 1.1.1.1 2001/06/13 04:58:33 dtashley Exp $ |
15 |
|
|
*/ |
16 |
|
|
|
17 |
|
|
#ifndef _TKCOLOR |
18 |
|
|
#define _TKCOLOR |
19 |
|
|
|
20 |
|
|
#include "tkInt.h" |
21 |
|
|
|
22 |
|
|
#ifdef BUILD_tk |
23 |
|
|
# undef TCL_STORAGE_CLASS |
24 |
|
|
# define TCL_STORAGE_CLASS DLLEXPORT |
25 |
|
|
#endif |
26 |
|
|
|
27 |
|
|
/* |
28 |
|
|
* One of the following data structures is used to keep track of |
29 |
|
|
* each color that is being used by the application; typically there |
30 |
|
|
* is a colormap entry allocated for each of these colors. |
31 |
|
|
*/ |
32 |
|
|
|
33 |
|
|
#define TK_COLOR_BY_NAME 1 |
34 |
|
|
#define TK_COLOR_BY_VALUE 2 |
35 |
|
|
|
36 |
|
|
#define COLOR_MAGIC ((unsigned int) 0x46140277) |
37 |
|
|
|
38 |
|
|
typedef struct TkColor { |
39 |
|
|
XColor color; /* Information about this color. */ |
40 |
|
|
unsigned int magic; /* Used for quick integrity check on this |
41 |
|
|
* structure. Must always have the |
42 |
|
|
* value COLOR_MAGIC. */ |
43 |
|
|
GC gc; /* Simple gc with this color as foreground |
44 |
|
|
* color and all other fields defaulted. |
45 |
|
|
* May be None. */ |
46 |
|
|
Screen *screen; /* Screen where this color is valid. Used |
47 |
|
|
* to delete it, and to find its display. */ |
48 |
|
|
Colormap colormap; /* Colormap from which this entry was |
49 |
|
|
* allocated. */ |
50 |
|
|
Visual *visual; /* Visual associated with colormap. */ |
51 |
|
|
int resourceRefCount; /* Number of active uses of this color (each |
52 |
|
|
* active use corresponds to a call to |
53 |
|
|
* Tk_AllocColorFromObj or Tk_GetColor). |
54 |
|
|
* If this count is 0, then this TkColor |
55 |
|
|
* structure is no longer valid and it isn't |
56 |
|
|
* present in a hash table: it is being |
57 |
|
|
* kept around only because there are objects |
58 |
|
|
* referring to it. The structure is freed |
59 |
|
|
* when resourceRefCount and objRefCount |
60 |
|
|
* are both 0. */ |
61 |
|
|
int objRefCount; /* The number of Tcl objects that reference |
62 |
|
|
* this structure. */ |
63 |
|
|
int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE */ |
64 |
|
|
Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this |
65 |
|
|
* structure. (for use in deleting entry). */ |
66 |
|
|
struct TkColor *nextPtr; /* Points to the next TkColor structure with |
67 |
|
|
* the same color name. Colors with the |
68 |
|
|
* same name but different screens or |
69 |
|
|
* colormaps are chained together off a |
70 |
|
|
* single entry in nameTable. For colors in |
71 |
|
|
* valueTable (those allocated by |
72 |
|
|
* Tk_GetColorByValue) this field is always |
73 |
|
|
* NULL. */ |
74 |
|
|
} TkColor; |
75 |
|
|
|
76 |
|
|
/* |
77 |
|
|
* Common APIs exported from all platform-specific implementations. |
78 |
|
|
*/ |
79 |
|
|
|
80 |
|
|
#ifndef TkpFreeColor |
81 |
|
|
extern void TkpFreeColor _ANSI_ARGS_((TkColor *tkColPtr)); |
82 |
|
|
#endif |
83 |
|
|
extern TkColor * TkpGetColor _ANSI_ARGS_((Tk_Window tkwin, |
84 |
|
|
Tk_Uid name)); |
85 |
|
|
extern TkColor * TkpGetColorByValue _ANSI_ARGS_((Tk_Window tkwin, |
86 |
|
|
XColor *colorPtr)); |
87 |
|
|
|
88 |
|
|
# undef TCL_STORAGE_CLASS |
89 |
|
|
# define TCL_STORAGE_CLASS DLLIMPORT |
90 |
|
|
|
91 |
|
|
#endif /* _TKCOLOR */ |
92 |
|
|
|
93 |
|
|
/* End of tkcolor.h */ |