| 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 |
* Copyright (c) 1998-2000 by Scriptics Corporation. |
| 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: tkWinInt.h,v 1.14 2003/02/26 02:47:05 hobbs Exp $ |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef _TKWININT |
| 18 |
#define _TKWININT |
| 19 |
|
| 20 |
/* |
| 21 |
* Include platform specific public interfaces. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef _TKINT |
| 25 |
#include "tkInt.h" |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifndef _TKWIN |
| 29 |
#include "tkWin.h" |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifndef _TKPORT |
| 33 |
#include "tkPort.h" |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
/* |
| 38 |
* Define constants missing from older Win32 SDK header files. |
| 39 |
*/ |
| 40 |
|
| 41 |
#ifndef WS_EX_TOOLWINDOW |
| 42 |
#define WS_EX_TOOLWINDOW 0x00000080L |
| 43 |
#endif |
| 44 |
|
| 45 |
/* |
| 46 |
* The TkWinDCState is used to save the state of a device context |
| 47 |
* so that it can be restored later. |
| 48 |
*/ |
| 49 |
|
| 50 |
typedef struct TkWinDCState { |
| 51 |
HPALETTE palette; |
| 52 |
int bkmode; |
| 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 |
#define TK_WIN_OWNDC_CLASS_NAME "TkOwnDC" |
| 128 |
|
| 129 |
/* |
| 130 |
* The following variable is a translation table between X gc functions and |
| 131 |
* Win32 raster and BitBlt op modes. |
| 132 |
*/ |
| 133 |
|
| 134 |
extern int tkpWinRopModes[]; |
| 135 |
extern int tkpWinBltModes[]; |
| 136 |
|
| 137 |
/* |
| 138 |
* The following defines are used with TkWinGetBorderPixels to get the |
| 139 |
* extra 2 border colors from a Tk_3DBorder. |
| 140 |
*/ |
| 141 |
|
| 142 |
#define TK_3D_LIGHT2 TK_3D_DARK_GC+1 |
| 143 |
#define TK_3D_DARK2 TK_3D_DARK_GC+2 |
| 144 |
|
| 145 |
/* |
| 146 |
* Internal procedures used by more than one source file. |
| 147 |
*/ |
| 148 |
|
| 149 |
#include "tkIntPlatDecls.h" |
| 150 |
|
| 151 |
/* |
| 152 |
* We need to specially add the TkWinChildProc because of the special |
| 153 |
* prototype it has (doesn't fit into stubs schema) |
| 154 |
*/ |
| 155 |
#ifdef BUILD_tk |
| 156 |
#undef TCL_STORAGE_CLASS |
| 157 |
#define TCL_STORAGE_CLASS DLLEXPORT |
| 158 |
#endif |
| 159 |
|
| 160 |
EXTERN LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, |
| 161 |
WPARAM wParam, LPARAM lParam)); |
| 162 |
|
| 163 |
/* |
| 164 |
* Special proc needed as tsd accessor function between |
| 165 |
* tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard |
| 166 |
*/ |
| 167 |
EXTERN void TkWinUpdatingClipboard(int mode); |
| 168 |
|
| 169 |
/* |
| 170 |
* The following structure keeps track of whether we are using the |
| 171 |
* multi-byte or the wide-character interfaces to the operating system. |
| 172 |
* System calls should be made through the following function table. |
| 173 |
* |
| 174 |
* While some system calls need to use this A/W jump-table, it is not |
| 175 |
* necessary for all calls to do it, which is why you won't see this |
| 176 |
* used throughout the Tk code, but only in key areas. -- hobbs |
| 177 |
*/ |
| 178 |
|
| 179 |
typedef struct TkWinProcs { |
| 180 |
int useWide; |
| 181 |
LRESULT (WINAPI *callWindowProc)(WNDPROC lpPrevWndFunc, HWND hWnd, |
| 182 |
UINT Msg, WPARAM wParam, LPARAM lParam); |
| 183 |
LRESULT (WINAPI *defWindowProc)(HWND hWnd, UINT Msg, WPARAM wParam, |
| 184 |
LPARAM lParam); |
| 185 |
ATOM (WINAPI *registerClass)(CONST WNDCLASS *lpWndClass); |
| 186 |
BOOL (WINAPI *setWindowText)(HWND hWnd, LPCTSTR lpString); |
| 187 |
HWND (WINAPI *createWindowEx)(DWORD dwExStyle, LPCTSTR lpClassName, |
| 188 |
LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, |
| 189 |
int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, |
| 190 |
HINSTANCE hInstance, LPVOID lpParam); |
| 191 |
BOOL (WINAPI *insertMenu)(HMENU hMenu, UINT uPosition, UINT uFlags, |
| 192 |
UINT uIDNewItem, LPCTSTR lpNewItem); |
| 193 |
} TkWinProcs; |
| 194 |
|
| 195 |
EXTERN TkWinProcs *tkWinProcs; |
| 196 |
|
| 197 |
#undef TCL_STORAGE_CLASS |
| 198 |
#define TCL_STORAGE_CLASS DLLIMPORT |
| 199 |
|
| 200 |
/* |
| 201 |
* The following allows us to cache these encoding for multiple functions. |
| 202 |
*/ |
| 203 |
|
| 204 |
|
| 205 |
extern Tcl_Encoding TkWinGetKeyInputEncoding _ANSI_ARGS_((void)); |
| 206 |
extern Tcl_Encoding TkWinGetUnicodeEncoding _ANSI_ARGS_((void)); |
| 207 |
|
| 208 |
extern void LangNoteDC _ANSI_ARGS_((HDC dc,int inc)); |
| 209 |
|
| 210 |
#endif /* _TKWININT */ |
| 211 |
|