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 Lesser 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser 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-2000. 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>
34 #define STRICT /* We want strict type checks */
39 #include <gdk/win32/gdkwindow-win32.h>
40 #include <gdk/win32/gdkpixmap-win32.h>
44 #endif /* __cplusplus */
46 /* Make up for some minor w32api header lossage */
48 /* PS_JOIN_MASK is missing */
50 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
53 /* CLR_INVALID is missing */
55 #define CLR_INVALID CLR_NONE
58 /* Some charsets are missing */
60 #define JOHAB_CHARSET 130
62 #ifndef VIETNAMESE_CHARSET
63 #define VIETNAMESE_CHARSET 163
67 #define FS_VIETNAMESE 0x100
70 /* Some virtual keycodes are missing */
72 #define VK_OEM_PLUS 0xBB
76 #define VK_OEM_COMMA 0xBC
80 #define VK_OEM_MINUS 0xBD
84 #define VK_OEM_PERIOD 0xBE
100 #define VK_OEM_5 0xDC
103 #define VK_OEM_6 0xDD
106 #define VK_OEM_7 0xDE
109 #define VK_OEM_8 0xDF
112 /* Missing messages */
113 #ifndef WM_MOUSEWHEEL
114 #define WM_MOUSEWHEEL 0X20A
117 #define WM_GETOBJECT 0x3D
119 #ifndef WM_NCXBUTTONDOWN
120 #define WM_NCXBUTTONDOWN 0xAB
122 #ifndef WM_NCXBUTTONUP
123 #define WM_NCXBUTTONUP 0xAC
125 #ifndef WM_NCXBUTTONDBLCLK
126 #define WM_NCXBUTTONDBLCLK 0xAD
128 #ifndef WM_MENURBUTTONUP
129 #define WM_MENURBUTTONUP 0x122
132 #define WM_MENUDRAG 0x123
134 #ifndef WM_MENUGETOBJECT
135 #define WM_MENUGETOBJECT 0x124
137 #ifndef WM_UNINITMENUPOPUP
138 #define WM_UNINITMENUPOPUP 0x125
140 #ifndef WM_MENUCOMMAND
141 #define WM_MENUCOMMAND 0x126
143 #ifndef WM_CHANGEUISTATE
144 #define WM_CHANGEUISTATE 0x127
146 #ifndef WM_UPDATEUISTATE
147 #define WM_UPDATEUISTATE 0x128
149 #ifndef WM_QUERYUISTATE
150 #define WM_QUERYUISTATE 0x129
152 #ifndef WM_XBUTTONDOWN
153 #define WM_XBUTTONDOWN 0x20B
156 #define WM_XBUTTONUP 0x20C
158 #ifndef WM_XBUTTONDBLCLK
159 #define WM_XBUTTONDBLCLK 0x20D
161 #ifndef WM_IME_REQUEST
162 #define WM_IME_REQUEST 0x288
164 #ifndef WM_MOUSEHOVER
165 #define WM_MOUSEHOVER 0x2A1
167 #ifndef WM_MOUSELEAVE
168 #define WM_MOUSELEAVE 0x2A3
170 #ifndef WM_NCMOUSEHOVER
171 #define WM_NCMOUSEHOVER 0x2A0
173 #ifndef WM_NCMOUSELEAVE
174 #define WM_NCMOUSELEAVE 0x2A2
176 #ifndef WM_APPCOMMAND
177 #define WM_APPCOMMAND 0x319
179 #ifndef WM_HANDHELDFIRST
180 #define WM_HANDHELDFIRST 0x358
182 #ifndef WM_HANDHELDLAST
183 #define WM_HANDHELDLAST 0x35F
186 #define WM_AFXFIRST 0x360
189 #define WM_AFXLAST 0x37F
193 #define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
196 #include <gdk/gdkprivate.h>
198 /* Define corresponding Windows types for some X11 types, just for laziness. */
199 typedef PALETTEENTRY XColor;
201 /* Some structs are somewhat useful to emulate internally, just to
202 * keep the code less #ifdefed.
205 HPALETTE palette; /* Palette handle used when drawing. */
206 guint size; /* Number of entries in the palette. */
207 gboolean stale; /* 1 if palette needs to be realized,
210 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
211 gulong sizepalette; /* SIZEPALETTE if rc_palette */
212 } ColormapStruct, *Colormap;
222 unsigned long red_max;
223 unsigned long red_mult;
224 unsigned long green_max;
225 unsigned long green_mult;
226 unsigned long blue_max;
227 unsigned long blue_mult;
228 unsigned long base_pixel;
231 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
232 typedef struct _GdkCursorPrivate GdkCursorPrivate;
233 typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
234 typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
235 typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
236 typedef struct _GdkVisualPrivate GdkVisualPrivate;
238 struct _GdkCursorPrivate
244 struct _GdkWin32SingleFont
252 struct _GdkFontPrivateWin32
255 GSList *fonts; /* List of GdkWin32SingleFonts */
259 struct _GdkVisualPrivate
265 struct _GdkColormapPrivateWin32
272 DWORD last_sync_time;
275 struct _GdkImagePrivateWin32
280 typedef struct _GdkGCWin32 GdkGCWin32;
281 typedef struct _GdkGCWin32Class GdkGCWin32Class;
283 #define GDK_TYPE_GC_WIN32 (gdk_gc_win32_get_type ())
284 #define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
285 #define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
286 #define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
287 #define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
288 #define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
292 GdkGC parent_instance;
294 /* A Windows Device Context (DC) is not equivalent to an X11
295 * GC. We can use a DC only in the window for which it was
296 * allocated, or (in the case of a memory DC) with the bitmap that
297 * has been selected into it. Thus, we have to release and
298 * reallocate a DC each time the GdkGC is used to paint into a new
299 * window or pixmap. We thus keep all the necessary values in the
304 GdkRegion *clip_region;
307 GdkGCValuesMask values_mask;
309 gulong foreground; /* Pixel values from GdkColor, */
310 gulong background; /* not Win32 COLORREFs */
317 GdkSubwindowMode subwindow_mode;
318 gint graphics_exposures;
321 HANDLE hwnd; /* If a HDC is allocated, for which window,
322 * or what bitmap is selected into it
327 struct _GdkGCWin32Class
329 GdkGCClass parent_class;
332 GType gdk_gc_win32_get_type (void);
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_WINDOW_HWND(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
338 #define GDK_PIXMAP_HBITMAP(pixmap) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)pixmap)->impl)->handle)
339 #define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? (GDK_WINDOW_HWND (win)) : (GDK_PIXMAP_HBITMAP (win)))
340 #define GDK_IMAGE_HBM(image) (((GdkImagePrivateWin32 *) GDK_IMAGE (image)->windowing_data)->hbm)
341 #define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateWin32 *) cmap->windowing_data)
342 #define GDK_COLORMAP_WIN32COLORMAP(cmap) (((GdkColormapPrivateWin32 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap)
343 #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
345 GDKVAR gchar *gdk_progclass;
346 GDKVAR ATOM gdk_selection_property;
348 /* Functions to create GDK pixmaps and windows from their native equivalents */
349 GdkPixmap *gdk_pixmap_foreign_new (GdkNativeWindow anid);
350 GdkWindow *gdk_window_foreign_new (GdkNativeWindow anid);
352 /* Return the Gdk* for a particular HANDLE */
353 gpointer gdk_win32_handle_table_lookup (GdkNativeWindow handle);
355 #define gdk_window_lookup(hwnd) (GdkWindow*) gdk_win32_handle_table_lookup (hwnd)
356 #define gdk_pixmap_lookup(hbm) (GdkPixmap*) gdk_win32_handle_table_lookup (hbm)
358 /* Return a device context to draw in a drawable, given a GDK GC,
359 * and a mask indicating which GC values might be used (for efficiency,
360 * no need to muck around with text-related stuff if we aren't going
361 * to output text, for instance).
363 HDC gdk_win32_hdc_get (GdkDrawable *drawable,
365 GdkGCValuesMask usage);
367 /* Each HDC returned from gdk_win32_hdc_get must be released with
370 void gdk_win32_hdc_release (GdkDrawable *drawable,
372 GdkGCValuesMask usage);
376 #endif /* __cplusplus */
378 #endif /* __GDK_WIN32_H__ */