1 |
578 |
markom |
/*
|
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 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: tkWinInt.h,v 1.1.1.1 2002-01-16 10:26:02 markom Exp $
|
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 |
|
|
/*
|
32 |
|
|
* Define constants missing from older Win32 SDK header files.
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
|
|
#ifndef WS_EX_TOOLWINDOW
|
36 |
|
|
#define WS_EX_TOOLWINDOW 0x00000080L
|
37 |
|
|
#endif
|
38 |
|
|
|
39 |
|
|
#ifndef __GNUC__
|
40 |
|
|
/* gcc won't let us do this--it causes a conflict with the typedef in
|
41 |
|
|
tkFont.h (as it should). */
|
42 |
|
|
typedef struct TkFontAttributes TkFontAttributes;
|
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 |
|
|
} TkWinDCState;
|
53 |
|
|
|
54 |
|
|
/*
|
55 |
|
|
* The TkWinDrawable is the internal implementation of an X Drawable (either
|
56 |
|
|
* a Window or a Pixmap). The following constants define the valid Drawable
|
57 |
|
|
* types.
|
58 |
|
|
*/
|
59 |
|
|
|
60 |
|
|
#define TWD_BITMAP 1
|
61 |
|
|
#define TWD_WINDOW 2
|
62 |
|
|
#define TWD_WINDC 3
|
63 |
|
|
|
64 |
|
|
typedef struct {
|
65 |
|
|
int type;
|
66 |
|
|
HWND handle;
|
67 |
|
|
TkWindow *winPtr;
|
68 |
|
|
} TkWinWindow;
|
69 |
|
|
|
70 |
|
|
typedef struct {
|
71 |
|
|
int type;
|
72 |
|
|
HBITMAP handle;
|
73 |
|
|
Colormap colormap;
|
74 |
|
|
int depth;
|
75 |
|
|
} TkWinBitmap;
|
76 |
|
|
|
77 |
|
|
typedef struct {
|
78 |
|
|
int type;
|
79 |
|
|
HDC hdc;
|
80 |
|
|
}TkWinDC;
|
81 |
|
|
|
82 |
|
|
typedef union {
|
83 |
|
|
int type;
|
84 |
|
|
TkWinWindow window;
|
85 |
|
|
TkWinBitmap bitmap;
|
86 |
|
|
TkWinDC winDC;
|
87 |
|
|
} TkWinDrawable;
|
88 |
|
|
|
89 |
|
|
/*
|
90 |
|
|
* The following macros are used to retrieve internal values from a Drawable.
|
91 |
|
|
*/
|
92 |
|
|
|
93 |
|
|
#define TkWinGetHWND(w) (((TkWinDrawable *) w)->window.handle)
|
94 |
|
|
#define TkWinGetWinPtr(w) (((TkWinDrawable*)w)->window.winPtr)
|
95 |
|
|
#define TkWinGetHBITMAP(w) (((TkWinDrawable*)w)->bitmap.handle)
|
96 |
|
|
#define TkWinGetColormap(w) (((TkWinDrawable*)w)->bitmap.colormap)
|
97 |
|
|
#define TkWinGetHDC(w) (((TkWinDrawable *) w)->winDC.hdc)
|
98 |
|
|
|
99 |
|
|
/*
|
100 |
|
|
* The following structure is used to encapsulate palette information.
|
101 |
|
|
*/
|
102 |
|
|
|
103 |
|
|
typedef struct {
|
104 |
|
|
HPALETTE palette; /* Palette handle used when drawing. */
|
105 |
|
|
UINT size; /* Number of entries in the palette. */
|
106 |
|
|
int stale; /* 1 if palette needs to be realized,
|
107 |
|
|
* otherwise 0. If the palette is stale,
|
108 |
|
|
* then an idle handler is scheduled to
|
109 |
|
|
* realize the palette. */
|
110 |
|
|
Tcl_HashTable refCounts; /* Hash table of palette entry reference counts
|
111 |
|
|
* indexed by pixel value. */
|
112 |
|
|
} TkWinColormap;
|
113 |
|
|
|
114 |
|
|
/*
|
115 |
|
|
* The following macro retrieves the Win32 palette from a colormap.
|
116 |
|
|
*/
|
117 |
|
|
|
118 |
|
|
#define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette)
|
119 |
|
|
|
120 |
|
|
/*
|
121 |
|
|
* The following macros define the class names for Tk Window types.
|
122 |
|
|
*/
|
123 |
|
|
|
124 |
|
|
#define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel"
|
125 |
|
|
#define TK_WIN_CHILD_CLASS_NAME "TkChild"
|
126 |
|
|
|
127 |
|
|
/*
|
128 |
|
|
* The following variable indicates whether we are restricted to Win32s
|
129 |
|
|
* GDI calls.
|
130 |
|
|
*/
|
131 |
|
|
|
132 |
|
|
extern int tkpIsWin32s;
|
133 |
|
|
|
134 |
|
|
/*
|
135 |
|
|
* The following variable is a translation table between X gc functions and
|
136 |
|
|
* Win32 raster op modes.
|
137 |
|
|
*/
|
138 |
|
|
|
139 |
|
|
extern int tkpWinRopModes[];
|
140 |
|
|
|
141 |
|
|
/*
|
142 |
|
|
* The following defines are used with TkWinGetBorderPixels to get the
|
143 |
|
|
* extra 2 border colors from a Tk_3DBorder.
|
144 |
|
|
*/
|
145 |
|
|
|
146 |
|
|
#define TK_3D_LIGHT2 TK_3D_DARK_GC+1
|
147 |
|
|
#define TK_3D_DARK2 TK_3D_DARK_GC+2
|
148 |
|
|
|
149 |
|
|
/*
|
150 |
|
|
* Internal procedures used by more than one source file.
|
151 |
|
|
*/
|
152 |
|
|
|
153 |
|
|
extern LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
|
154 |
|
|
WPARAM wParam, LPARAM lParam));
|
155 |
|
|
extern void TkWinClipboardRender _ANSI_ARGS_((TkDisplay *dispPtr,
|
156 |
|
|
UINT format));
|
157 |
|
|
extern LRESULT TkWinEmbeddedEventProc _ANSI_ARGS_((HWND hwnd,
|
158 |
|
|
UINT message, WPARAM wParam, LPARAM lParam));
|
159 |
|
|
extern void TkWinFillRect _ANSI_ARGS_((HDC dc, int x, int y,
|
160 |
|
|
int width, int height, int pixel));
|
161 |
|
|
extern COLORREF TkWinGetBorderPixels _ANSI_ARGS_((Tk_Window tkwin,
|
162 |
|
|
Tk_3DBorder border, int which));
|
163 |
|
|
extern HDC TkWinGetDrawableDC _ANSI_ARGS_((Display *display,
|
164 |
|
|
Drawable d, TkWinDCState* state));
|
165 |
|
|
extern int TkWinGetModifierState _ANSI_ARGS_((void));
|
166 |
|
|
extern HPALETTE TkWinGetSystemPalette _ANSI_ARGS_((void));
|
167 |
|
|
extern HWND TkWinGetWrapperWindow _ANSI_ARGS_((Tk_Window tkwin));
|
168 |
|
|
extern int TkWinHandleMenuEvent _ANSI_ARGS_((HWND *phwnd,
|
169 |
|
|
UINT *pMessage, WPARAM *pwParam, LPARAM *plParam,
|
170 |
|
|
LRESULT *plResult));
|
171 |
|
|
extern int TkWinIndexOfColor _ANSI_ARGS_((XColor *colorPtr));
|
172 |
|
|
extern void TkWinPointerDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
|
173 |
|
|
extern void TkWinPointerEvent _ANSI_ARGS_((HWND hwnd, int x,
|
174 |
|
|
int y));
|
175 |
|
|
extern void TkWinPointerInit _ANSI_ARGS_((void));
|
176 |
|
|
extern LRESULT TkWinReflectMessage _ANSI_ARGS_((HWND hwnd,
|
177 |
|
|
UINT message, WPARAM wParam, LPARAM lParam));
|
178 |
|
|
extern void TkWinReleaseDrawableDC _ANSI_ARGS_((Drawable d,
|
179 |
|
|
HDC hdc, TkWinDCState* state));
|
180 |
|
|
extern LRESULT TkWinResendEvent _ANSI_ARGS_((WNDPROC wndproc,
|
181 |
|
|
HWND hwnd, XEvent *eventPtr));
|
182 |
|
|
extern HPALETTE TkWinSelectPalette _ANSI_ARGS_((HDC dc,
|
183 |
|
|
Colormap colormap));
|
184 |
|
|
extern void TkWinSetMenu _ANSI_ARGS_((Tk_Window tkwin,
|
185 |
|
|
HMENU hMenu));
|
186 |
|
|
extern void TkWinSetWindowPos _ANSI_ARGS_((HWND hwnd,
|
187 |
|
|
HWND siblingHwnd, int pos));
|
188 |
|
|
extern void TkWinUpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
|
189 |
|
|
extern void TkWinWmCleanup _ANSI_ARGS_((HINSTANCE hInstance));
|
190 |
|
|
extern HWND TkWinWmFindEmbedAssociation _ANSI_ARGS_((
|
191 |
|
|
TkWindow *winPtr));
|
192 |
|
|
extern void TkWinWmStoreEmbedAssociation _ANSI_ARGS_((
|
193 |
|
|
TkWindow *winPtr, HWND hwnd));
|
194 |
|
|
extern void TkWinXCleanup _ANSI_ARGS_((HINSTANCE hInstance));
|
195 |
|
|
extern void TkWinXInit _ANSI_ARGS_((HINSTANCE hInstance));
|
196 |
|
|
|
197 |
|
|
/* CYGNUS LOCAL. */
|
198 |
|
|
extern void TkWinNCMetricsChanged _ANSI_ARGS_((Tk_Window tkwin));
|
199 |
|
|
extern void TkWinSysColorChange _ANSI_ARGS_((void));
|
200 |
|
|
|
201 |
|
|
#endif /* _TKWININT */
|
202 |
|
|
|