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
67 #define WM_GETOBJECT 0x3D
70 #ifndef WM_NCXBUTTONDOWN
71 #define WM_NCXBUTTONDOWN 0xAB
72 #define WM_NCXBUTTONUP 0xAC
73 #define WM_NCXBUTTONDBLCLK 0xAD
76 #ifndef WM_CHANGEUISTATE
77 #define WM_CHANGEUISTATE 0x127
78 #define WM_UPDATEUISTATE 0x128
79 #define WM_QUERYUISTATE 0x129
82 #ifndef WM_XBUTTONDOWN
83 #define WM_XBUTTONDOWN 0x20B
84 #define WM_XBUTTONUP 0x20C
85 #define WM_XBUTTONDBLCLK 0x20D
88 #ifndef WM_IME_REQUEST
89 #define WM_IME_REQUEST 0x288
92 #ifndef WM_NCMOUSEHOVER
93 #define WM_NCMOUSEHOVER 0x2A0
94 #define WM_NCMOUSELEAVE 0x2A2
98 #define WM_APPCOMMAND 0x319
102 #include <gdk/gdkprivate.h>
103 #include "gdkwin32.h"
105 /* Define corresponding Windows types for some X11 types, just for laziness. */
106 typedef PALETTEENTRY XColor;
108 /* Define some of the X11 constants also here, again just for laziness */
113 /* Grabbing status */
114 #define GrabSuccess 0
115 #define AlreadyGrabbed 2
117 /* Some structs are somewhat useful to emulate internally, just to
118 * keep the code less #ifdefed.
121 HPALETTE palette; /* Palette handle used when drawing. */
122 guint size; /* Number of entries in the palette. */
123 gboolean stale; /* 1 if palette needs to be realized,
126 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
127 gulong sizepalette; /* SIZEPALETTE if rc_palette */
128 } ColormapStruct, *Colormap;
138 unsigned long red_max;
139 unsigned long red_mult;
140 unsigned long green_max;
141 unsigned long green_mult;
142 unsigned long blue_max;
143 unsigned long blue_mult;
144 unsigned long base_pixel;
147 typedef struct _GdkGCWin32Data GdkGCWin32Data;
148 typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
149 typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
150 typedef struct _GdkWin32PositionInfo GdkWin32PositionInfo;
151 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
152 typedef struct _GdkCursorPrivate GdkCursorPrivate;
153 typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
154 typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
155 typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
156 typedef struct _GdkVisualPrivate GdkVisualPrivate;
157 typedef struct _GdkRegionPrivate GdkRegionPrivate;
158 typedef struct _GdkICPrivate GdkICPrivate;
160 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
161 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
162 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
164 struct _GdkGCWin32Data
166 GdkRegion *clip_region;
168 /* A Windows Device Context (DC) is not equivalent to an X11
169 * GC. We can use a DC only in the window for which it was
170 * allocated, or (in the case of a memory DC) with the bitmap that
171 * has been selected into it. Thus, we have to release and
172 * reallocate a DC each time the GdkGC is used to paint into a new
173 * window or pixmap. We thus keep all the necessary values in the
174 * GdkGCWin32Data struct.
178 GdkGCValuesMask values_mask;
179 gulong foreground; /* Pixel values from GdkColor, */
180 gulong background; /* not Win32 COLORREFs */
186 GdkSubwindowMode subwindow_mode;
187 gint graphics_exposures;
190 HANDLE hwnd; /* If a DC is allocated, for which window
191 * or what bitmap is selected into it
196 struct _GdkDrawableWin32Data
201 struct _GdkWin32PositionInfo
207 gint x_offset; /* Offsets to add to Win32 coordinates */
208 gint y_offset; /* within window to get GDK coodinates */
211 gboolean no_bg : 1; /* Set when the window background is
212 * temporarily unset during resizing
214 GdkRectangle clip_rect; /* visible rectangle of window */
217 struct _GdkWindowWin32Data
219 GdkDrawableWin32Data drawable;
221 GdkWin32PositionInfo position_info;
223 /* We must keep the event mask here to filter them ourselves */
226 /* Values for bg_type */
227 #define GDK_WIN32_BG_NORMAL 0
228 #define GDK_WIN32_BG_PIXEL 1
229 #define GDK_WIN32_BG_PIXMAP 2
230 #define GDK_WIN32_BG_PARENT_RELATIVE 3
231 #define GDK_WIN32_BG_TRANSPARENT 4
233 /* We draw the background ourselves at WM_ERASEBKGND */
236 GdkPixmap *bg_pixmap;
240 /* Window size hints */
243 gint hint_min_width, hint_min_height;
244 gint hint_max_width, hint_max_height;
246 gboolean extension_events_selected;
249 CHARSETINFO charset_info;
252 struct _GdkCursorPrivate
258 struct _GdkWin32SingleFont
266 struct _GdkFontPrivateWin32
269 GSList *fonts; /* List of GdkWin32SingleFonts */
273 struct _GdkVisualPrivate
279 struct _GdkColormapPrivateWin32
281 GdkColormapPrivate base;
287 DWORD last_sync_time;
290 struct _GdkImagePrivateWin32
292 GdkImagePrivate base;
296 #define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
297 #define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root)
298 #define GDK_DISPLAY() NULL
299 #define GDK_DRAWABLE_XID(win) (GDK_DRAWABLE_WIN32DATA(win)->xid)
300 #define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate *) image)->ximage)
301 #define GDK_COLORMAP_XDISPLAY(cmap) NULL
302 #define GDK_COLORMAP_WIN32COLORMAP(cmap)(((GdkColormapPrivateWin32 *) cmap)->xcolormap)
303 #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
305 #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
306 #define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
308 GDKVAR gchar *gdk_progclass;
309 GDKVAR ATOM gdk_selection_property;
311 /* Functions to create GDK pixmaps and windows from their native equivalents */
312 GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
313 GdkWindow *gdk_window_foreign_new (guint32 anid);
315 /* Return the Gdk* for a particular HANDLE */
316 gpointer gdk_xid_table_lookup (HANDLE handle);
318 #endif /* __GDK_WIN32_H__ */