home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _8b36eb1a1e6e57e08c160ed160ba39ba < prev    next >
Text File  |  2004-06-01  |  3KB  |  90 lines

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