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_PRIVATE_WIN32_H__
28 #define __GDK_PRIVATE_WIN32_H__
30 #define STRICT /* We want strict type checks */
34 /* Make up for some minor mingw32 lossage */
36 /* PS_JOIN_MASK is missing from the mingw32 headers */
38 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
41 /* CLR_INVALID is missing */
43 #define CLR_INVALID CLR_NONE
46 /* Some charsets are missing */
48 #define JOHAB_CHARSET 130
50 #ifndef VIETNAMESE_CHARSET
51 #define VIETNAMESE_CHARSET 163
55 #define FS_VIETNAMESE 0x100
59 #define VK_OEM_PLUS 0xBB
64 #include <gdk/gdktypes.h>
65 #include <gdk/gdkprivate.h>
67 #include <gdk/gdkcursor.h>
68 #include <gdk/gdkevents.h>
69 #include <gdk/gdkfont.h>
70 #include <gdk/gdkgc.h>
71 #include <gdk/gdkim.h>
72 #include <gdk/gdkimage.h>
73 #include <gdk/gdkvisual.h>
74 #include <gdk/gdkwindow.h>
78 #endif /* __cplusplus */
80 /* Define corresponding Windows types for some X11 types, just for laziness.
83 typedef PALETTEENTRY XColor;
84 typedef guint VisualID;
87 /* Define some of the X11 constants also here, again just for laziness */
89 /* Generic null resource */
97 #define AlreadyGrabbed 2
99 /* Some structs are somewhat useful to emulate internally, just to
100 keep the code less #ifdefed. */
102 HPALETTE palette; /* Palette handle used when drawing. */
103 guint size; /* Number of entries in the palette. */
104 gboolean stale; /* 1 if palette needs to be realized,
107 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
108 gulong sizepalette; /* SIZEPALETTE if rc_palette */
109 } ColormapStruct, *Colormap;
119 unsigned long red_max;
120 unsigned long red_mult;
121 unsigned long green_max;
122 unsigned long green_mult;
123 unsigned long blue_max;
124 unsigned long blue_mult;
125 unsigned long base_pixel;
128 typedef struct _GdkGCWin32Data GdkGCWin32Data;
129 typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
130 typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
131 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
132 typedef struct _GdkCursorPrivate GdkCursorPrivate;
133 typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
134 typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
135 typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
136 typedef struct _GdkVisualPrivate GdkVisualPrivate;
137 typedef struct _GdkRegionPrivate GdkRegionPrivate;
138 typedef struct _GdkICPrivate GdkICPrivate;
140 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
141 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
142 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
144 struct _GdkGCWin32Data
146 /* A Windows Device Context (DC) is not equivalent to an X11
147 * GC. We can use a DC only in the window for which it was
148 * allocated, or (in the case of a memory DC) with the bitmap that
149 * has been selected into it. Thus, we have to release and
150 * reallocate a DC each time the GdkGC is used to paint into a new
151 * window or pixmap. We thus keep all the necessary values in the
152 * GdkGCWin32Data struct.
155 GdkGCValuesMask values_mask;
164 GdkSubwindowMode subwindow_mode;
169 gint graphics_exposures;
172 HANDLE hwnd; /* If a DC is allocated, for which window
173 * or what bitmap is selected into it
178 struct _GdkDrawableWin32Data
183 struct _GdkWindowWin32Data
185 GdkDrawableWin32Data drawable;
187 /* We must keep the event mask here to filter them ourselves */
190 /* Values for bg_type */
191 #define GDK_WIN32_BG_NORMAL 0
192 #define GDK_WIN32_BG_PIXEL 1
193 #define GDK_WIN32_BG_PIXMAP 2
194 #define GDK_WIN32_BG_PARENT_RELATIVE 3
195 #define GDK_WIN32_BG_TRANSPARENT 4
197 /* We draw the background ourselves at WM_ERASEBKGND */
200 GdkPixmap *bg_pixmap;
204 /* Window size hints */
207 gint hint_min_width, hint_min_height;
208 gint hint_max_width, hint_max_height;
210 gboolean extension_events_selected;
213 CHARSETINFO charset_info;
216 struct _GdkCursorPrivate
222 struct _GdkWin32SingleFont
230 struct _GdkFontPrivateWin32
233 GSList *fonts; /* List of GdkWin32SingleFonts */
237 struct _GdkVisualPrivate
243 struct _GdkColormapPrivateWin32
245 GdkColormapPrivate base;
251 time_t last_sync_time;
254 struct _GdkImagePrivateWin32
256 GdkImagePrivate base;
260 struct _GdkRegionPrivate
266 void gdk_win32_selection_init (void);
267 void gdk_win32_dnd_exit (void);
269 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
270 GdkVisual* gdk_visual_lookup (Visual *xvisual);
272 void gdk_xid_table_insert (HANDLE *hnd,
274 void gdk_xid_table_remove (HANDLE xid);
275 gpointer gdk_xid_table_lookup (HANDLE xid);
277 GdkGC * _gdk_win32_gc_new (GdkDrawable *drawable,
279 GdkGCValuesMask values_mask);
280 HDC gdk_gc_predraw (GdkDrawable *drawable,
281 GdkGCPrivate *gc_private,
282 GdkGCValuesMask usage);
283 void gdk_gc_postdraw (GdkDrawable *drawable,
284 GdkGCPrivate *gc_private,
285 GdkGCValuesMask usage);
286 HRGN BitmapToRegion (HBITMAP hBmp);
288 void gdk_sel_prop_store (GdkWindow *owner,
294 gint gdk_nmbstowcs (GdkWChar *dest,
298 gint gdk_nmbstowchar_ts (wchar_t *dest,
303 void gdk_wchar_text_handle (GdkFont *font,
304 const wchar_t *wcstr,
306 void (*handler)(GdkWin32SingleFont *,
312 gchar *gdk_color_to_string (const GdkColor *);
313 gchar *gdk_win32_last_error_string (void);
314 void gdk_win32_api_failed (const gchar *where,
318 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__PRETTY_FUNCTION__, __LINE__, api)
320 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
323 extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
325 extern GdkDrawableClass _gdk_win32_drawable_class;
326 extern HWND gdk_root_window;
327 GDKVAR ATOM gdk_selection_property;
328 GDKVAR gchar *gdk_progclass;
329 extern gboolean gdk_event_func_from_window_proc;
332 extern HINSTANCE gdk_DLLInstance;
333 extern HINSTANCE gdk_ProgInstance;
335 extern UINT gdk_selection_notify_msg;
336 extern UINT gdk_selection_request_msg;
337 extern UINT gdk_selection_clear_msg;
338 extern GdkAtom gdk_clipboard_atom;
339 extern GdkAtom gdk_win32_dropfiles_atom;
340 extern GdkAtom gdk_ole2_dnd_atom;
342 extern DWORD windows_version;
346 #endif /* __cplusplus */
349 #endif /* __GDK_PRIVATE_WIN32_H__ */