ROOT  6.05/03
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gdkprivate-win32.h
Go to the documentation of this file.
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19 
20 /*
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/.
25  */
26 
27 #ifndef __GDK_PRIVATE_WIN32_H__
28 #define __GDK_PRIVATE_WIN32_H__
29 
30 #ifndef STRICT
31 #define STRICT /* We want strict type checks */
32 #endif
33 #include <windows.h>
34 #include <commctrl.h>
35 
36 /* Make up for mingw32 header lossage */
37 
38 /* PS_JOIN_MASK is missing from the mingw32 headers */
39 #ifndef PS_JOIN_MASK
40 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
41 #endif
42 
43 /* CLR_INVALID is missing */
44 #ifndef CLR_INVALID
45 #define CLR_INVALID CLR_NONE
46 #endif
47 
48 /* Some charsets are missing */
49 #ifndef JOHAB_CHARSET
50 #define JOHAB_CHARSET 130
51 #endif
52 #ifndef VIETNAMESE_CHARSET
53 #define VIETNAMESE_CHARSET 163
54 #endif
55 
56 #ifndef FS_VIETNAMESE
57 #define FS_VIETNAMESE 0x100
58 #endif
59 
60 #ifndef VM_OEM_PLUS
61 #define VK_OEM_PLUS 0xBB
62 #endif
63 #ifndef VK_OEM_COMMA
64 #define VK_OEM_COMMA 0xBC
65 #endif
66 #ifndef VK_OEM_MINUS
67 #define VK_OEM_MINUS 0xBD
68 #endif
69 #ifndef VK_OEM_PERIOD
70 #define VK_OEM_PERIOD 0xBE
71 #endif
72 
73 #ifndef VK_OEM_1
74 #define VK_OEM_1 0xBA
75 #endif
76 #ifndef VK_OEM_2
77 #define VK_OEM_2 0xBF
78 #endif
79 #ifndef VK_OEM_3
80 #define VK_OEM_3 0xC0
81 #endif
82 #ifndef VK_OEM_4
83 #define VK_OEM_4 0xDB
84 #endif
85 #ifndef VK_OEM_5
86 #define VK_OEM_5 0xDC
87 #endif
88 #ifndef VK_OEM_6
89 #define VK_OEM_6 0xDD
90 #endif
91 #ifndef VK_OEM_7
92 #define VK_OEM_7 0xDE
93 #endif
94 #ifndef VK_OEM_8
95 #define VK_OEM_8 0xDF
96 #endif
97 
98 /* Missing messages */
99 #ifndef WM_MOUSEWHEEL
100 #define WM_MOUSEWHEEL 0X20A
101 #endif
102 #ifndef WM_GETOBJECT
103 #define WM_GETOBJECT 0x003D
104 #endif
105 #ifndef WM_NCXBUTTONDOWN
106 #define WM_NCXBUTTONDOWN 0x00AB
107 #endif
108 #ifndef WM_NCXBUTTONUP
109 #define WM_NCXBUTTONUP 0x00AC
110 #endif
111 #ifndef WM_NCXBUTTONDBLCLK
112 #define WM_NCXBUTTONDBLCLK 0x00AD
113 #endif
114 #ifndef WM_MENURBUTTONUP
115 #define WM_MENURBUTTONUP 0x0122
116 #endif
117 #ifndef WM_MENUDRAG
118 #define WM_MENUDRAG 0x0123
119 #endif
120 #ifndef WM_MENUGETOBJECT
121 #define WM_MENUGETOBJECT 0x0124
122 #endif
123 #ifndef WM_UNINITMENUPOPUP
124 #define WM_UNINITMENUPOPUP 0x0125
125 #endif
126 #ifndef WM_MENUCOMMAND
127 #define WM_MENUCOMMAND 0x0126
128 #endif
129 #ifndef WM_CHANGEUISTATE
130 #define WM_CHANGEUISTATE 0x0127
131 #endif
132 #ifndef WM_UPDATEUISTATE
133 #define WM_UPDATEUISTATE 0x0128
134 #endif
135 #ifndef WM_QUERYUISTATE
136 #define WM_QUERYUISTATE 0x0129
137 #endif
138 #ifndef WM_XBUTTONDOWN
139 #define WM_XBUTTONDOWN 0x020B
140 #endif
141 #ifndef WM_XBUTTONUP
142 #define WM_XBUTTONUP 0x020C
143 #endif
144 #ifndef WM_XBUTTONDBLCLK
145 #define WM_XBUTTONDBLCLK 0x020D
146 #endif
147 #ifndef WM_IME_REQUEST
148 #define WM_IME_REQUEST 0x0288
149 #endif
150 #ifndef WM_MOUSEHOVER
151 #define WM_MOUSEHOVER 0x02A1
152 #endif
153 #ifndef WM_MOUSELEAVE
154 #define WM_MOUSELEAVE 0x02A3
155 #endif
156 #ifndef WM_NCMOUSEHOVER
157 #define WM_NCMOUSEHOVER 0x02A0
158 #endif
159 #ifndef WM_NCMOUSELEAVE
160 #define WM_NCMOUSELEAVE 0x02A2
161 #endif
162 #ifndef WM_APPCOMMAND
163 #define WM_APPCOMMAND 0x0319
164 #endif
165 #ifndef WM_HANDHELDFIRST
166 #define WM_HANDHELDFIRST 0x0358
167 #endif
168 #ifndef WM_HANDHELDLAST
169 #define WM_HANDHELDLAST 0x035F
170 #endif
171 #ifndef WM_AFXFIRST
172 #define WM_AFXFIRST 0x0360
173 #endif
174 #ifndef WM_AFXLAST
175 #define WM_AFXLAST 0x037F
176 #endif
177 
178 #ifndef CopyCursor
179 #define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
180 #endif
181 
182 #include <time.h>
183 
184 #include <gdk/gdktypes.h>
185 #include <gdk/gdkprivate.h>
186 
187 #include <gdk/gdkcursor.h>
188 #include <gdk/gdkevents.h>
189 #include <gdk/gdkfont.h>
190 #include <gdk/gdkgc.h>
191 #include <gdk/gdkim.h>
192 #include <gdk/gdkimage.h>
193 #include <gdk/gdkvisual.h>
194 #include <gdk/gdkwindow.h>
195 
196 #ifdef __cplusplus
197 extern "C" {
198 #endif /* __cplusplus */
199 
200 /* Define corresponding Windows types for some X11 types, just for laziness.
201  */
202 
203  typedef PALETTEENTRY XColor;
204  typedef guint VisualID;
205  typedef int Status;
206 
207 /* Define some of the X11 constants also here, again just for laziness */
208 
209 /* Generic null resource */
210 #define None 0
211 
212 /* Error codes */
213 #define Success 0
214 
215 /* Grabbing status */
216 #define GrabSuccess 0
217 #define AlreadyGrabbed 2
218 
219 /* Some structs are somewhat useful to emulate internally, just to
220  keep the code less #ifdefed. */
221  typedef struct {
222  HPALETTE palette; /* Palette handle used when drawing. */
223  guint size; /* Number of entries in the palette. */
224  gboolean stale; /* 1 if palette needs to be realized,
225  * otherwise 0. */
227  gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
228  gulong sizepalette; /* SIZEPALETTE if rc_palette */
230 
231  typedef struct {
235  } Visual;
236 
237  typedef struct {
238  Colormap colormap;
239  unsigned long red_max;
240  unsigned long red_mult;
241  unsigned long green_max;
242  unsigned long green_mult;
243  unsigned long blue_max;
244  unsigned long blue_mult;
245  unsigned long base_pixel;
247 
258  typedef struct _GdkICPrivate GdkICPrivate;
259 
260 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
261 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
262 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
263 
265  /* A Windows Device Context (DC) is not equivalent to an X11
266  * GC. We can use a DC only in the window for which it was
267  * allocated, or (in the case of a memory DC) with the bitmap that
268  * has been selected into it. Thus, we have to release and
269  * reallocate a DC each time the GdkGC is used to paint into a new
270  * window or pixmap. We thus keep all the necessary values in the
271  * GdkGCWin32Data struct.
272  */
273  HDC xgc;
275  gulong foreground; /* Pixel values from GdkColor, */
276  gulong background; /* not Win32 COLORREFs */
290  DWORD pen_style;
291  HANDLE hwnd; /* If a DC is allocated, for which window
292  * or what bitmap is selected into it
293  */
294 // bb add
295  int luser_dash; // length of array containing custom style bits
296  int user_dash[32]; // array of custom style bits
297 
298  int saved_dc;
299  };
300 
302  HANDLE xid;
303  };
304 
307 
308  /* We must keep the event mask here to filter them ourselves */
310 
311  /* Values for bg_type */
312 #define GDK_WIN32_BG_NORMAL 0
313 #define GDK_WIN32_BG_PIXEL 1
314 #define GDK_WIN32_BG_PIXMAP 2
315 #define GDK_WIN32_BG_PARENT_RELATIVE 3
316 #define GDK_WIN32_BG_TRANSPARENT 4
317 
318  /* We draw the background ourselves at WM_ERASEBKGND */
320  gulong bg_pixel; /* GdkColor pixel, not COLORREF */
322 
323  HCURSOR xcursor;
324 
325  /* Window size hints */
330 
332 
334  CHARSETINFO charset_info;
335 
345  };
346 
349  HCURSOR xcursor;
350  };
351 
353  HFONT xfont;
354  UINT charset;
355  UINT codepage;
356  FONTSIGNATURE fs;
357  };
358 
361  GSList *fonts; /* List of GdkWin32SingleFonts */
363  };
364 
368  };
369 
372  Colormap xcolormap;
374 
378  };
379 
382  HBITMAP ximage;
383  };
384 
387  HRGN xregion;
388  };
389 
390  void gdk_win32_selection_init(void);
391  void gdk_win32_dnd_exit(void);
392 
393  GdkColormap *gdk_colormap_lookup(Colormap xcolormap);
394  GdkVisual *gdk_visual_lookup(Visual * xvisual);
395 
396  void gdk_xid_table_insert(HANDLE * hnd, gpointer data);
397  void gdk_xid_table_remove(HANDLE xid);
398  gpointer gdk_xid_table_lookup(HANDLE xid);
399 
400  GdkGC *_gdk_win32_gc_new(GdkDrawable * drawable,
401  GdkGCValues * values,
402  GdkGCValuesMask values_mask);
403  COLORREF gdk_colormap_color(GdkColormapPrivateWin32 * colormap_private,
404  gulong pixel);
405  HDC gdk_gc_predraw(GdkDrawable * drawable,
406  GdkGCPrivate * gc_private, GdkGCValuesMask usage);
407  void gdk_gc_postdraw(GdkDrawable * drawable,
408  GdkGCPrivate * gc_private, GdkGCValuesMask usage);
409  HRGN BitmapToRegion(HBITMAP hBmp);
410 
411  void gdk_sel_prop_store(GdkWindow * owner,
412  GdkAtom type,
414 
416  const gchar * src, gint src_len, gint dest_max);
417  gint gdk_nmbstowchar_ts(wchar_t * dest,
418  const gchar * src, gint src_len, gint dest_max);
419 
420  void gdk_wchar_text_handle(GdkFont * font,
421  const wchar_t * wcstr,
422  int wclen,
423  void (*handler) (GdkWin32SingleFont *,
424  const wchar_t *,
425  int, void *), void *arg);
426 
427  void gdk_win32_api_failed(const gchar * where,
428  gint line, const gchar * api);
429  void gdk_other_api_failed(const gchar * where,
430  gint line, const gchar * api);
431  void gdk_win32_gdi_failed(const gchar * where,
432  gint line, const gchar * api);
433 #ifdef __GNUC__
434 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
435 #define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
436 #define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
437 #else
438 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
439 #define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__, __LINE__, api)
440 #define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
441 #endif
442 
443 #ifdef G_ENABLE_DEBUG
444  gchar *gdk_win32_color_to_string(const GdkColor * color);
445  gchar *gdk_win32_cap_style_to_string(GdkCapStyle cap_style);
446  gchar *gdk_win32_fill_style_to_string(GdkFill fill);
447  gchar *gdk_win32_function_to_string(GdkFunction function);
448  gchar *gdk_win32_join_style_to_string(GdkJoinStyle join_style);
449  gchar *gdk_win32_line_style_to_string(GdkLineStyle line_style);
450  gchar *gdk_win32_message_name(UINT msg);
451 #endif
452 
453  extern LRESULT CALLBACK gdk_WindowProc(HWND, UINT, WPARAM, LPARAM);
454 
456  extern HWND gdk_root_window;
460 
461  extern HDC gdk_DC;
462  extern HINSTANCE gdk_DLLInstance;
463  extern HINSTANCE gdk_ProgInstance;
464 
465  extern UINT gdk_selection_notify_msg;
466  extern UINT gdk_selection_request_msg;
467  extern UINT gdk_selection_clear_msg;
470  extern GdkAtom gdk_ole2_dnd_atom;
471 
472  extern DWORD windows_version;
473 #define IS_WIN_NT(dwVersion) (dwVersion < 0x80000000)
474 
475 #ifdef __cplusplus
476 }
477 #endif /* __cplusplus */
478 #endif /* __GDK_PRIVATE_WIN32_H__ */
HRGN BitmapToRegion(HBITMAP hBmp)
Definition: gdkgc-win32.c:1112
HWND gdk_root_window
struct ColormapStruct * Colormap
gpointer gdk_xid_table_lookup(HANDLE xid)
Definition: gdkwin32id.c:61
UINT gdk_selection_clear_msg
void gdk_win32_selection_init(void)
unsigned int guint
Definition: g_types.h:51
gboolean gdk_event_func_from_window_proc
unsigned char guchar
Definition: g_types.h:48
HDC gdk_DC
GdkDrawableWin32Data drawable
TLine * line
GdkSubwindowMode subwindow_mode
HINSTANCE gdk_DLLInstance
unsigned long blue_max
GdkLineStyle
Definition: gdkgc.h:92
struct _GdkICPrivate GdkICPrivate
GdkColormapPrivate base
GdkAtom gdk_win32_dropfiles_atom
void gdk_win32_dnd_exit(void)
Definition: gdkdnd-win32.c:669
GdkDrawableClass _gdk_win32_drawable_class
gulong GdkAtom
Definition: gdktypes.h:77
static std::string format(double x, double y, int digits, int width)
unsigned long green_mult
G_BEGIN_DECLS typedef char gchar
Definition: g_types.h:41
GdkAtom gdk_clipboard_atom
unsigned int guint32
gint gboolean
Definition: g_types.h:45
int Status
void gdk_xid_table_remove(HANDLE xid)
Definition: gdkwin32id.c:52
UINT gdk_selection_notify_msg
unsigned long blue_mult
GDKVAR ATOM gdk_selection_property
Definition: gdkgc.h:145
guint visualid
GdkAtom gdk_ole2_dnd_atom
DWORD windows_version
void gdk_win32_gdi_failed(const gchar *where, gint line, const gchar *api)
void gdk_wchar_text_handle(GdkFont *font, const wchar_t *wcstr, int wclen, void(*handler)(GdkWin32SingleFont *, const wchar_t *, int, void *), void *arg)
void gdk_xid_table_insert(HANDLE *hnd, gpointer data)
Definition: gdkwin32id.c:41
unsigned long gulong
Definition: g_types.h:50
COLORREF gdk_colormap_color(GdkColormapPrivateWin32 *colormap_private, gulong pixel)
Definition: gdkgc-win32.c:809
guint VisualID
typedefG_BEGIN_DECLS struct _GSList GSList
Definition: gslist.h:34
GdkJoinStyle
Definition: gdkgc.h:81
GdkSubwindowMode
Definition: gdkgc.h:98
HINSTANCE gdk_ProgInstance
int gint
Definition: g_types.h:44
PALETTEENTRY XColor
Double_t length(const TVector2 &v)
Definition: CsgOps.cxx:347
typedefG_BEGIN_DECLS struct _GHashTable GHashTable
Definition: ghash.h:34
void gdk_win32_api_failed(const gchar *where, gint line, const gchar *api)
GdkGCValuesMask
Definition: gdkgc.h:103
void * gpointer
Definition: g_types.h:67
void gdk_sel_prop_store(GdkWindow *owner, GdkAtom type, gint format, guchar *data, gint length)
GdkFill
Definition: gdkgc.h:33
#define CALLBACK
Definition: TGLFaceSet.cxx:30
void gdk_other_api_failed(const gchar *where, gint line, const gchar *api)
HDC gdk_gc_predraw(GdkDrawable *drawable, GdkGCPrivate *gc_private, GdkGCValuesMask usage)
Definition: gdkgc-win32.c:963
LRESULT CALLBACK gdk_WindowProc(HWND, UINT, WPARAM, LPARAM)
unsigned long green_max
GDKVAR gchar * gdk_progclass
static void usage(const char *argv0)
Definition: main.cpp:558
gchar data[7]
UINT gdk_selection_request_msg
GdkGCValuesMask values_mask
GdkGC * _gdk_win32_gc_new(GdkDrawable *drawable, GdkGCValues *values, GdkGCValuesMask values_mask)
Definition: gdkgc-win32.c:406
gint gdk_nmbstowcs(GdkWChar *dest, const gchar *src, gint src_len, gint dest_max)
Definition: gdkim-win32.c:229
guint32 GdkWChar
Definition: gdktypes.h:76
gboolean extension_events_selected
void fill()
Definition: utils.cpp:314
GdkColormap * gdk_colormap_lookup(Colormap xcolormap)
int type
Definition: TGX11.cxx:116
unsigned long base_pixel
unsigned long red_max
GdkFunction
Definition: gdkgc.h:58
void gdk_gc_postdraw(GdkDrawable *drawable, GdkGCPrivate *gc_private, GdkGCValuesMask usage)
Definition: gdkgc-win32.c:1031
typedefG_BEGIN_DECLS struct _GList GList
Definition: glist.h:34
guint bitspixel
#define GDKVAR
Definition: gdktypes.h:41
#define dest(otri, vertexptr)
Definition: triangle.c:1040
gint map_entries
GdkVisual * gdk_visual_lookup(Visual *xvisual)
GdkPixmap * stipple
GdkCapStyle
Definition: gdkgc.h:20
gint gdk_nmbstowchar_ts(wchar_t *dest, const gchar *src, gint src_len, gint dest_max)
Definition: gdkim-win32.c:295
unsigned long red_mult