1 /* 2 * tkWinInt.h -- 3 * 4 * This file contains declarations that are shared among the 5 * Windows-specific parts of Tk, but aren't used by the rest of 6 * Tk. 7 * 8 * Copyright (c) 1995-1997 Sun Microsystems, Inc. 9 * 10 * See the file "license.terms" for information on usage and redistribution 11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 * 13 * RCS: @(#) Id 14 */ 15 16 #ifndef _TKWININT 17 #define _TKWININT 18 19 #ifndef _TKINT 20 #include "tkInt.h" 21 #endif 22 23 /* 24 * Include platform specific public interfaces. 25 */ 26 27 #ifndef _TKWIN 28 #include "tkWin.h" 29 #endif 30 31 #ifndef _TKPORT 32 #include "tkPort.h" 33 #endif 34 35 36 /* 37 * Define constants missing from older Win32 SDK header files. 38 */ 39 40 #ifndef WS_EX_TOOLWINDOW 41 #define WS_EX_TOOLWINDOW 0x00000080L 42 #endif 43 44 typedef struct TkFontAttributes TkFontAttributes; 45 46 /* 47 * The TkWinDCState is used to save the state of a device context 48 * so that it can be restored later. 49 */ 50 51 typedef struct TkWinDCState { 52 HPALETTE palette; 53 } TkWinDCState; 54 55 /* 56 * The TkWinDrawable is the internal implementation of an X Drawable (either 57 * a Window or a Pixmap). The following constants define the valid Drawable 58 * types. 59 */ 60 61 #define TWD_BITMAP 1 62 #define TWD_WINDOW 2 63 #define TWD_WINDC 3 64 65 typedef struct { 66 int type; 67 HWND handle; 68 TkWindow *winPtr; 69 } TkWinWindow; 70 71 typedef struct { 72 int type; 73 HBITMAP handle; 74 Colormap colormap; 75 int depth; 76 } TkWinBitmap; 77 78 typedef struct { 79 int type; 80 HDC hdc; 81 }TkWinDC; 82 83 typedef union { 84 int type; 85 TkWinWindow window; 86 TkWinBitmap bitmap; 87 TkWinDC winDC; 88 } TkWinDrawable; 89 90 /* 91 * The following macros are used to retrieve internal values from a Drawable. 92 */ 93 94 #define TkWinGetHWND(w) (((TkWinDrawable *) w)->window.handle) 95 #define TkWinGetWinPtr(w) (((TkWinDrawable*)w)->window.winPtr) 96 #define TkWinGetHBITMAP(w) (((TkWinDrawable*)w)->bitmap.handle) 97 #define TkWinGetColormap(w) (((TkWinDrawable*)w)->bitmap.colormap) 98 #define TkWinGetHDC(w) (((TkWinDrawable *) w)->winDC.hdc) 99 100 /* 101 * The following structure is used to encapsulate palette information. 102 */ 103 104 typedef struct { 105 HPALETTE palette; /* Palette handle used when drawing. */ 106 UINT size; /* Number of entries in the palette. */ 107 int stale; /* 1 if palette needs to be realized, 108 * otherwise 0. If the palette is stale, 109 * then an idle handler is scheduled to 110 * realize the palette. */ 111 Tcl_HashTable refCounts; /* Hash table of palette entry reference counts 112 * indexed by pixel value. */ 113 } TkWinColormap; 114 115 /* 116 * The following macro retrieves the Win32 palette from a colormap. 117 */ 118 119 #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette) 120 121 /* 122 * The following macros define the class names for Tk Window types. 123 */ 124 125 #define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel" 126 #define TK_WIN_CHILD_CLASS_NAME "TkChild" 127 128 /* 129 * The following variable indicates whether we are restricted to Win32s 130 * GDI calls. 131 */ 132 133 extern int tkpIsWin32s; 134 135 /* 136 * The following variable is a translation table between X gc functions and 137 * Win32 raster op modes. 138 */ 139 140 extern int tkpWinRopModes[]; 141 142 /* 143 * The following defines are used with TkWinGetBorderPixels to get the 144 * extra 2 border colors from a Tk_3DBorder. 145 */ 146 147 #define TK_3D_LIGHT2 TK_3D_DARK_GC+1 148 #define TK_3D_DARK2 TK_3D_DARK_GC+2 149 150 /* 151 * Internal procedures used by more than one source file. 152 */ 153 154 #include "tkIntPlatDecls.h" 155 156 extern LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, 157 WPARAM wParam, LPARAM lParam)); 158 159 #endif /* _TKWININT */ 160 161