1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __GDK_WIN32_H__
28 #define __GDK_WIN32_H__
30 #include <gdk/gdkprivate.h>
31 #include <gdk/gdkcursor.h>
33 #define STRICT /* We want strict type checks */
37 /* Make up for some minor w32api header lossage */
39 /* PS_JOIN_MASK is missing */
41 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
44 /* CLR_INVALID is missing */
46 #define CLR_INVALID CLR_NONE
49 /* Some charsets are missing */
51 #define JOHAB_CHARSET 130
53 #ifndef VIETNAMESE_CHARSET
54 #define VIETNAMESE_CHARSET 163
58 #define FS_VIETNAMESE 0x100
62 #define VK_OEM_PLUS 0xBB
66 /* Missing messages */
68 #define WM_MOUSEWHEEL 0X20A
71 #define WM_GETOBJECT 0x3D
73 #ifndef WM_NCXBUTTONDOWN
74 #define WM_NCXBUTTONDOWN 0xAB
76 #ifndef WM_NCXBUTTONUP
77 #define WM_NCXBUTTONUP 0xAC
79 #ifndef WM_NCXBUTTONDBLCLK
80 #define WM_NCXBUTTONDBLCLK 0xAD
82 #ifndef WM_MENURBUTTONUP
83 #define WM_MENURBUTTONUP 0x122
86 #define WM_MENUDRAG 0x123
88 #ifndef WM_MENUGETOBJECT
89 #define WM_MENUGETOBJECT 0x124
91 #ifndef WM_UNINITMENUPOPUP
92 #define WM_UNINITMENUPOPUP 0x125
94 #ifndef WM_MENUCOMMAND
95 #define WM_MENUCOMMAND 0x126
97 #ifndef WM_CHANGEUISTATE
98 #define WM_CHANGEUISTATE 0x127
100 #ifndef WM_UPDATEUISTATE
101 #define WM_UPDATEUISTATE 0x128
103 #ifndef WM_QUERYUISTATE
104 #define WM_QUERYUISTATE 0x129
106 #ifndef WM_XBUTTONDOWN
107 #define WM_XBUTTONDOWN 0x20B
110 #define WM_XBUTTONUP 0x20C
112 #ifndef WM_XBUTTONDBLCLK
113 #define WM_XBUTTONDBLCLK 0x20D
115 #ifndef WM_IME_REQUEST
116 #define WM_IME_REQUEST 0x288
118 #ifndef WM_MOUSEHOVER
119 #define WM_MOUSEHOVER 0x2A1
121 #ifndef WM_MOUSELEAVE
122 #define WM_MOUSELEAVE 0x2A3
124 #ifndef WM_NCMOUSEHOVER
125 #define WM_NCMOUSEHOVER 0x2A0
127 #ifndef WM_NCMOUSELEAVE
128 #define WM_NCMOUSELEAVE 0x2A2
130 #ifndef WM_APPCOMMAND
131 #define WM_APPCOMMAND 0x319
133 #ifndef WM_HANDHELDFIRST
134 #define WM_HANDHELDFIRST 0x358
136 #ifndef WM_HANDHELDLAST
137 #define WM_HANDHELDLAST 0x35F
140 #define WM_AFXFIRST 0x360
143 #define WM_AFXLAST 0x37F
147 #define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
150 #include <gdk/gdkprivate.h>
152 /* Define corresponding Windows types for some X11 types, just for laziness. */
153 typedef PALETTEENTRY XColor;
155 /* Some structs are somewhat useful to emulate internally, just to
156 * keep the code less #ifdefed.
159 HPALETTE palette; /* Palette handle used when drawing. */
160 guint size; /* Number of entries in the palette. */
161 gboolean stale; /* 1 if palette needs to be realized,
164 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
165 gulong sizepalette; /* SIZEPALETTE if rc_palette */
166 } ColormapStruct, *Colormap;
176 unsigned long red_max;
177 unsigned long red_mult;
178 unsigned long green_max;
179 unsigned long green_mult;
180 unsigned long blue_max;
181 unsigned long blue_mult;
182 unsigned long base_pixel;
185 typedef struct _GdkGCWin32Data GdkGCWin32Data;
186 typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
187 typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
188 typedef struct _GdkWin32PositionInfo GdkWin32PositionInfo;
189 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
190 typedef struct _GdkCursorPrivate GdkCursorPrivate;
191 typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
192 typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
193 typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
194 typedef struct _GdkVisualPrivate GdkVisualPrivate;
195 typedef struct _GdkRegionPrivate GdkRegionPrivate;
196 typedef struct _GdkICPrivate GdkICPrivate;
198 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
199 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
200 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
202 struct _GdkGCWin32Data
204 GdkRegion *clip_region;
206 /* A Windows Device Context (DC) is not equivalent to an X11
207 * GC. We can use a DC only in the window for which it was
208 * allocated, or (in the case of a memory DC) with the bitmap that
209 * has been selected into it. Thus, we have to release and
210 * reallocate a DC each time the GdkGC is used to paint into a new
211 * window or pixmap. We thus keep all the necessary values in the
212 * GdkGCWin32Data struct.
216 GdkGCValuesMask values_mask;
217 gulong foreground; /* Pixel values from GdkColor, */
218 gulong background; /* not Win32 COLORREFs */
224 GdkSubwindowMode subwindow_mode;
225 gint graphics_exposures;
228 HANDLE hwnd; /* If a DC is allocated, for which window
229 * or what bitmap is selected into it
234 struct _GdkDrawableWin32Data
239 struct _GdkWin32PositionInfo
245 gint x_offset; /* Offsets to add to Win32 coordinates */
246 gint y_offset; /* within window to get GDK coodinates */
249 gboolean no_bg : 1; /* Set when the window background is
250 * temporarily unset during resizing
252 GdkRectangle clip_rect; /* visible rectangle of window */
255 struct _GdkWindowWin32Data
257 GdkDrawableWin32Data drawable;
259 GdkWin32PositionInfo position_info;
261 /* We must keep the event mask here to filter them ourselves */
264 /* Values for bg_type */
265 #define GDK_WIN32_BG_NORMAL 0
266 #define GDK_WIN32_BG_PIXEL 1
267 #define GDK_WIN32_BG_PIXMAP 2
268 #define GDK_WIN32_BG_PARENT_RELATIVE 3
269 #define GDK_WIN32_BG_TRANSPARENT 4
271 /* We draw the background ourselves at WM_ERASEBKGND */
274 GdkPixmap *bg_pixmap;
278 /* Window size hints */
281 gint hint_min_width, hint_min_height;
282 gint hint_max_width, hint_max_height;
284 gboolean extension_events_selected;
287 CHARSETINFO charset_info;
290 struct _GdkCursorPrivate
296 struct _GdkWin32SingleFont
304 struct _GdkFontPrivateWin32
307 GSList *fonts; /* List of GdkWin32SingleFonts */
311 struct _GdkVisualPrivate
317 struct _GdkColormapPrivateWin32
319 GdkColormapPrivate base;
325 DWORD last_sync_time;
328 struct _GdkImagePrivateWin32
330 GdkImagePrivate base;
334 #define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
335 #define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root)
336 #define GDK_DISPLAY() NULL
337 #define GDK_DRAWABLE_XID(win) (GDK_DRAWABLE_WIN32DATA(win)->xid)
338 #define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate *) image)->ximage)
339 #define GDK_COLORMAP_XDISPLAY(cmap) NULL
340 #define GDK_COLORMAP_WIN32COLORMAP(cmap)(((GdkColormapPrivateWin32 *) cmap)->xcolormap)
341 #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
343 #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
344 #define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
346 GDKVAR gchar *gdk_progclass;
347 GDKVAR ATOM gdk_selection_property;
349 /* Functions to create GDK pixmaps and windows from their native equivalents */
350 GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
351 GdkWindow *gdk_window_foreign_new (guint32 anid);
353 /* Return the Gdk* for a particular HANDLE */
354 gpointer gdk_xid_table_lookup (HANDLE handle);
356 #endif /* __GDK_WIN32_H__ */