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