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 VK_OEM_PLUS 0xBB
60 #include <gdk/gdktypes.h>
61 #include <gdk/gdkprivate.h>
63 #include <gdk/gdkcursor.h>
64 #include <gdk/gdkevents.h>
65 #include <gdk/gdkfont.h>
66 #include <gdk/gdkgc.h>
67 #include <gdk/gdkim.h>
68 #include <gdk/gdkimage.h>
69 #include <gdk/gdkvisual.h>
70 #include <gdk/gdkwindow.h>
74 #endif /* __cplusplus */
76 /* Define corresponding Windows types for some X11 types, just for laziness.
79 typedef PALETTEENTRY XColor;
80 typedef guint VisualID;
83 /* Define some of the X11 constants also here, again just for laziness */
85 /* Generic null resource */
93 #define AlreadyGrabbed 2
95 /* Some structs are somewhat useful to emulate internally, just to
96 keep the code less #ifdefed. */
98 HPALETTE palette; /* Palette handle used when drawing. */
99 guint size; /* Number of entries in the palette. */
100 gboolean stale; /* 1 if palette needs to be realized,
103 gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
104 gulong sizepalette; /* SIZEPALETTE if rc_palette */
105 } ColormapStruct, *Colormap;
115 unsigned long red_max;
116 unsigned long red_mult;
117 unsigned long green_max;
118 unsigned long green_mult;
119 unsigned long blue_max;
120 unsigned long blue_mult;
121 unsigned long base_pixel;
124 typedef struct _GdkGCWin32Data GdkGCWin32Data;
125 typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
126 typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
127 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
128 typedef struct _GdkCursorPrivate GdkCursorPrivate;
129 typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
130 typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
131 typedef struct _GdkVisualPrivate GdkVisualPrivate;
132 typedef struct _GdkRegionPrivate GdkRegionPrivate;
133 typedef struct _GdkICPrivate GdkICPrivate;
135 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
136 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
137 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
139 struct _GdkGCWin32Data
141 /* A Windows Device Context (DC) is not equivalent to an X11
142 * GC. We can use a DC only in the window for which it was
143 * allocated, or (in the case of a memory DC) with the bitmap that
144 * has been selected into it. Thus, we have to release and
145 * reallocate a DC each time the GdkGC is used to paint into a new
146 * window or pixmap. We thus keep all the necessary values in the
147 * GdkGCPrivate struct.
150 GdkGCValuesMask values_mask;
159 GdkSubwindowMode subwindow_mode;
164 gint graphics_exposures;
167 HANDLE hwnd; /* If a DC is allocated, for which window
168 or what bitmap is selected into it */
172 struct _GdkDrawableWin32Data
177 struct _GdkWindowWin32Data
179 GdkDrawableWin32Data drawable;
181 /* We must keep the event mask here to filter them ourselves */
184 /* Values for bg_type */
185 #define GDK_WIN32_BG_NORMAL 0
186 #define GDK_WIN32_BG_PIXEL 1
187 #define GDK_WIN32_BG_PIXMAP 2
188 #define GDK_WIN32_BG_PARENT_RELATIVE 3
189 #define GDK_WIN32_BG_TRANSPARENT 4
191 /* We draw the background ourselves at WM_ERASEBKGND */
194 GdkPixmap *bg_pixmap;
198 /* Window size hints */
201 gint hint_min_width, hint_min_height;
202 gint hint_max_width, hint_max_height;
204 gint extension_events;
205 gboolean extension_events_selected;
208 CHARSETINFO charset_info;
211 struct _GdkCursorPrivate
224 } GdkWin32SingleFont;
226 struct _GdkFontPrivateWin32
229 GSList *fonts; /* Points to a list of GdkWin32SingleFonts */
233 struct _GdkVisualPrivate
239 struct _GdkColormapPrivateWin32
241 GdkColormapPrivate base;
248 time_t last_sync_time;
251 struct _GdkImagePrivateWin32
253 GdkImagePrivate base;
257 struct _GdkRegionPrivate
263 void gdk_selection_init (void);
264 void gdk_dnd_exit (void);
266 GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
267 GdkVisual* gdk_visual_lookup (Visual *xvisual);
269 void gdk_xid_table_insert (HANDLE *hnd,
271 void gdk_xid_table_remove (HANDLE xid);
272 gpointer gdk_xid_table_lookup (HANDLE xid);
274 GdkGC * _gdk_win32_gc_new (GdkDrawable *drawable,
276 GdkGCValuesMask values_mask);
277 HDC gdk_gc_predraw (GdkDrawable *drawable,
278 GdkGCPrivate *gc_private);
279 void gdk_gc_postdraw (GdkDrawable *drawable,
280 GdkGCPrivate *gc_private);
281 HRGN BitmapToRegion (HBITMAP hBmp);
283 void gdk_sel_prop_store (GdkWindow *owner,
289 gint gdk_nmbstowcs (GdkWChar *dest,
293 gint gdk_nmbstowchar_ts (wchar_t *dest,
298 void gdk_wchar_text_handle (GdkFont *font,
299 const wchar_t *wcstr,
301 void (*handler)(GdkWin32SingleFont *,
307 char *gdk_color_to_string (const GdkColor *);
309 extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
311 extern HWND gdk_root_window;
312 GDKVAR ATOM gdk_selection_property;
313 GDKVAR gchar *gdk_progclass;
314 extern gboolean gdk_event_func_from_window_proc;
317 extern HINSTANCE gdk_DLLInstance;
318 extern HINSTANCE gdk_ProgInstance;
320 extern UINT gdk_selection_notify_msg;
321 extern UINT gdk_selection_request_msg;
322 extern UINT gdk_selection_clear_msg;
323 extern GdkAtom gdk_clipboard_atom;
324 extern GdkAtom gdk_win32_dropfiles_atom;
325 extern GdkAtom gdk_ole2_dnd_atom;
327 extern DWORD windows_version;
331 #endif /* __cplusplus */
334 #endif /* __GDK_PRIVATE_WIN32_H__ */