gdkprivate-win32.h

Go to the documentation of this file.
00001 /* GDK - The GIMP Drawing Kit
00002  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
00022  * file for a list of people on the GTK+ Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
00025  */
00026 
00027 #ifndef __GDK_PRIVATE_WIN32_H__
00028 #define __GDK_PRIVATE_WIN32_H__
00029 
00030 #ifndef STRICT
00031 #define STRICT                  /* We want strict type checks */
00032 #endif
00033 #include <windows.h>
00034 #include <commctrl.h>
00035 
00036 /* Make up for mingw32 header lossage */
00037 
00038 /* PS_JOIN_MASK is missing from the mingw32 headers */
00039 #ifndef PS_JOIN_MASK
00040 #define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
00041 #endif
00042 
00043 /* CLR_INVALID is missing */
00044 #ifndef CLR_INVALID
00045 #define CLR_INVALID CLR_NONE
00046 #endif
00047 
00048 /* Some charsets are missing */
00049 #ifndef JOHAB_CHARSET
00050 #define JOHAB_CHARSET 130
00051 #endif
00052 #ifndef VIETNAMESE_CHARSET
00053 #define VIETNAMESE_CHARSET 163
00054 #endif
00055 
00056 #ifndef FS_VIETNAMESE
00057 #define FS_VIETNAMESE 0x100
00058 #endif
00059 
00060 #ifndef VM_OEM_PLUS
00061 #define VK_OEM_PLUS 0xBB
00062 #endif
00063 #ifndef VK_OEM_COMMA
00064 #define VK_OEM_COMMA 0xBC
00065 #endif
00066 #ifndef VK_OEM_MINUS
00067 #define VK_OEM_MINUS 0xBD
00068 #endif
00069 #ifndef VK_OEM_PERIOD
00070 #define VK_OEM_PERIOD 0xBE
00071 #endif
00072 
00073 #ifndef VK_OEM_1
00074 #define VK_OEM_1 0xBA
00075 #endif
00076 #ifndef VK_OEM_2
00077 #define VK_OEM_2 0xBF
00078 #endif
00079 #ifndef VK_OEM_3
00080 #define VK_OEM_3 0xC0
00081 #endif
00082 #ifndef VK_OEM_4
00083 #define VK_OEM_4 0xDB
00084 #endif
00085 #ifndef VK_OEM_5
00086 #define VK_OEM_5 0xDC
00087 #endif
00088 #ifndef VK_OEM_6
00089 #define VK_OEM_6 0xDD
00090 #endif
00091 #ifndef VK_OEM_7
00092 #define VK_OEM_7 0xDE
00093 #endif
00094 #ifndef VK_OEM_8
00095 #define VK_OEM_8 0xDF
00096 #endif
00097 
00098 /* Missing messages */
00099 #ifndef WM_MOUSEWHEEL
00100 #define WM_MOUSEWHEEL 0X20A
00101 #endif
00102 #ifndef WM_GETOBJECT
00103 #define WM_GETOBJECT 0x003D
00104 #endif
00105 #ifndef WM_NCXBUTTONDOWN
00106 #define WM_NCXBUTTONDOWN 0x00AB
00107 #endif
00108 #ifndef WM_NCXBUTTONUP
00109 #define WM_NCXBUTTONUP 0x00AC
00110 #endif
00111 #ifndef WM_NCXBUTTONDBLCLK
00112 #define WM_NCXBUTTONDBLCLK 0x00AD
00113 #endif
00114 #ifndef WM_MENURBUTTONUP
00115 #define WM_MENURBUTTONUP 0x0122
00116 #endif
00117 #ifndef WM_MENUDRAG
00118 #define WM_MENUDRAG 0x0123
00119 #endif
00120 #ifndef WM_MENUGETOBJECT
00121 #define WM_MENUGETOBJECT 0x0124
00122 #endif
00123 #ifndef WM_UNINITMENUPOPUP
00124 #define WM_UNINITMENUPOPUP 0x0125
00125 #endif
00126 #ifndef WM_MENUCOMMAND
00127 #define WM_MENUCOMMAND 0x0126
00128 #endif
00129 #ifndef WM_CHANGEUISTATE
00130 #define WM_CHANGEUISTATE 0x0127
00131 #endif
00132 #ifndef WM_UPDATEUISTATE
00133 #define WM_UPDATEUISTATE 0x0128
00134 #endif
00135 #ifndef WM_QUERYUISTATE
00136 #define WM_QUERYUISTATE 0x0129
00137 #endif
00138 #ifndef WM_XBUTTONDOWN
00139 #define WM_XBUTTONDOWN 0x020B
00140 #endif
00141 #ifndef WM_XBUTTONUP
00142 #define WM_XBUTTONUP 0x020C
00143 #endif
00144 #ifndef WM_XBUTTONDBLCLK
00145 #define WM_XBUTTONDBLCLK 0x020D
00146 #endif
00147 #ifndef WM_IME_REQUEST
00148 #define WM_IME_REQUEST 0x0288
00149 #endif
00150 #ifndef WM_MOUSEHOVER
00151 #define WM_MOUSEHOVER 0x02A1
00152 #endif
00153 #ifndef WM_MOUSELEAVE
00154 #define WM_MOUSELEAVE 0x02A3
00155 #endif
00156 #ifndef WM_NCMOUSEHOVER
00157 #define WM_NCMOUSEHOVER 0x02A0
00158 #endif
00159 #ifndef WM_NCMOUSELEAVE
00160 #define WM_NCMOUSELEAVE 0x02A2
00161 #endif
00162 #ifndef WM_APPCOMMAND
00163 #define WM_APPCOMMAND 0x0319
00164 #endif
00165 #ifndef WM_HANDHELDFIRST
00166 #define WM_HANDHELDFIRST 0x0358
00167 #endif
00168 #ifndef WM_HANDHELDLAST
00169 #define WM_HANDHELDLAST 0x035F
00170 #endif
00171 #ifndef WM_AFXFIRST
00172 #define WM_AFXFIRST 0x0360
00173 #endif
00174 #ifndef WM_AFXLAST
00175 #define WM_AFXLAST 0x037F
00176 #endif
00177 
00178 #ifndef CopyCursor
00179 #define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
00180 #endif
00181 
00182 #include <time.h>
00183 
00184 #include <gdk/gdktypes.h>
00185 #include <gdk/gdkprivate.h>
00186 
00187 #include <gdk/gdkcursor.h>
00188 #include <gdk/gdkevents.h>
00189 #include <gdk/gdkfont.h>
00190 #include <gdk/gdkgc.h>
00191 #include <gdk/gdkim.h>
00192 #include <gdk/gdkimage.h>
00193 #include <gdk/gdkvisual.h>
00194 #include <gdk/gdkwindow.h>
00195 
00196 #ifdef __cplusplus
00197 extern "C" {
00198 #endif                          /* __cplusplus */
00199 
00200 /* Define corresponding Windows types for some X11 types, just for laziness.
00201  */
00202 
00203    typedef PALETTEENTRY XColor;
00204    typedef guint VisualID;
00205    typedef int Status;
00206 
00207 /* Define some of the X11 constants also here, again just for laziness */
00208 
00209 /* Generic null resource */
00210 #define None 0
00211 
00212 /* Error codes */
00213 #define Success            0
00214 
00215 /* Grabbing status */
00216 #define GrabSuccess        0
00217 #define AlreadyGrabbed     2
00218 
00219 /* Some structs are somewhat useful to emulate internally, just to
00220    keep the code less #ifdefed.  */
00221    typedef struct {
00222       HPALETTE palette;         /* Palette handle used when drawing. */
00223       guint size;               /* Number of entries in the palette. */
00224       gboolean stale;           /* 1 if palette needs to be realized,
00225                                  * otherwise 0. */
00226       gboolean *in_use;
00227       gboolean rc_palette;      /* If RC_PALETTE is on in the RASTERCAPS */
00228       gulong sizepalette;       /* SIZEPALETTE if rc_palette */
00229    } ColormapStruct, *Colormap;
00230 
00231    typedef struct {
00232       gint map_entries;
00233       guint visualid;
00234       guint bitspixel;
00235    } Visual;
00236 
00237    typedef struct {
00238       Colormap colormap;
00239       unsigned long red_max;
00240       unsigned long red_mult;
00241       unsigned long green_max;
00242       unsigned long green_mult;
00243       unsigned long blue_max;
00244       unsigned long blue_mult;
00245       unsigned long base_pixel;
00246    } XStandardColormap;
00247 
00248    typedef struct _GdkGCWin32Data GdkGCWin32Data;
00249    typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
00250    typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
00251    typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
00252    typedef struct _GdkCursorPrivate GdkCursorPrivate;
00253    typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
00254    typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
00255    typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
00256    typedef struct _GdkVisualPrivate GdkVisualPrivate;
00257    typedef struct _GdkRegionPrivate GdkRegionPrivate;
00258    typedef struct _GdkICPrivate GdkICPrivate;
00259 
00260 #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
00261 #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
00262 #define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
00263 
00264    struct _GdkGCWin32Data {
00265       /* A Windows Device Context (DC) is not equivalent to an X11
00266        * GC. We can use a DC only in the window for which it was
00267        * allocated, or (in the case of a memory DC) with the bitmap that
00268        * has been selected into it. Thus, we have to release and
00269        * reallocate a DC each time the GdkGC is used to paint into a new
00270        * window or pixmap. We thus keep all the necessary values in the
00271        * GdkGCWin32Data struct.
00272        */
00273       HDC xgc;
00274       GdkGCValuesMask values_mask;
00275       gulong foreground;        /* Pixel values from GdkColor, */
00276       gulong background;        /* not Win32 COLORREFs */
00277       GdkFont *font;
00278       gint rop2;
00279       GdkFill fill_style;
00280       GdkPixmap *tile;
00281       GdkPixmap *stipple;
00282       HRGN clip_region;
00283       GdkSubwindowMode subwindow_mode;
00284       gint ts_x_origin;
00285       gint ts_y_origin;
00286       gint clip_x_origin;
00287       gint clip_y_origin;
00288       gint graphics_exposures;
00289       gint pen_width;
00290       DWORD pen_style;
00291       HANDLE hwnd;              /* If a DC is allocated, for which window
00292                                  * or what bitmap is selected into it
00293                                  */
00294 // bb add
00295       int luser_dash;           // length of array containing custom style bits
00296       int user_dash[32];        // array of custom style bits
00297 
00298       int saved_dc;
00299    };
00300 
00301    struct _GdkDrawableWin32Data {
00302       HANDLE xid;
00303    };
00304 
00305    struct _GdkWindowWin32Data {
00306       GdkDrawableWin32Data drawable;
00307 
00308       /* We must keep the event mask here to filter them ourselves */
00309       gint event_mask;
00310 
00311       /* Values for bg_type */
00312 #define GDK_WIN32_BG_NORMAL 0
00313 #define GDK_WIN32_BG_PIXEL 1
00314 #define GDK_WIN32_BG_PIXMAP 2
00315 #define GDK_WIN32_BG_PARENT_RELATIVE 3
00316 #define GDK_WIN32_BG_TRANSPARENT 4
00317 
00318       /* We draw the background ourselves at WM_ERASEBKGND  */
00319       guchar bg_type;
00320       gulong bg_pixel;          /* GdkColor pixel, not COLORREF */
00321       GdkPixmap *bg_pixmap;
00322 
00323       HCURSOR xcursor;
00324 
00325       /* Window size hints */
00326       gint hint_flags;
00327       gint hint_x, hint_y;
00328       gint hint_min_width, hint_min_height;
00329       gint hint_max_width, hint_max_height;
00330 
00331       gboolean extension_events_selected;
00332 
00333       HKL input_locale;
00334       CHARSETINFO charset_info;
00335 
00336       gint grab_button;          //vo
00337       gint grab_event_mask;      //vo
00338       gint grab_owner_events;    //vo
00339       gint grab_modifiers;       //vo
00340       guint32 grab_time;         //vo
00341       GdkWindow *grab_confine;   //vo
00342       GdkCursor *grab_cursor;    //vo
00343       GList *grab_keys;          //vo
00344       gint grab_key_owner_events;//vo
00345    };
00346 
00347    struct _GdkCursorPrivate {
00348       GdkCursor cursor;
00349       HCURSOR xcursor;
00350    };
00351 
00352    struct _GdkWin32SingleFont {
00353       HFONT xfont;
00354       UINT charset;
00355       UINT codepage;
00356       FONTSIGNATURE fs;
00357    };
00358 
00359    struct _GdkFontPrivateWin32 {
00360       GdkFontPrivate base;
00361       GSList *fonts;            /* List of GdkWin32SingleFonts */
00362       GSList *names;
00363    };
00364 
00365    struct _GdkVisualPrivate {
00366       GdkVisual visual;
00367       Visual *xvisual;
00368    };
00369 
00370    struct _GdkColormapPrivateWin32 {
00371       GdkColormapPrivate base;
00372       Colormap xcolormap;
00373       gint private_val;
00374 
00375       GHashTable *hash;
00376       GdkColorInfo *info;
00377       time_t last_sync_time;
00378    };
00379 
00380    struct _GdkImagePrivateWin32 {
00381       GdkImagePrivate base;
00382       HBITMAP ximage;
00383    };
00384 
00385    struct _GdkRegionPrivate {
00386       GdkRegion region;
00387       HRGN xregion;
00388    };
00389 
00390    void gdk_win32_selection_init(void);
00391    void gdk_win32_dnd_exit(void);
00392 
00393    GdkColormap *gdk_colormap_lookup(Colormap xcolormap);
00394    GdkVisual *gdk_visual_lookup(Visual * xvisual);
00395 
00396    void gdk_xid_table_insert(HANDLE * hnd, gpointer data);
00397    void gdk_xid_table_remove(HANDLE xid);
00398    gpointer gdk_xid_table_lookup(HANDLE xid);
00399 
00400    GdkGC *_gdk_win32_gc_new(GdkDrawable * drawable,
00401                             GdkGCValues * values,
00402                             GdkGCValuesMask values_mask);
00403    COLORREF gdk_colormap_color(GdkColormapPrivateWin32 * colormap_private,
00404                                gulong pixel);
00405    HDC gdk_gc_predraw(GdkDrawable * drawable,
00406                       GdkGCPrivate * gc_private, GdkGCValuesMask usage);
00407    void gdk_gc_postdraw(GdkDrawable * drawable,
00408                         GdkGCPrivate * gc_private, GdkGCValuesMask usage);
00409    HRGN BitmapToRegion(HBITMAP hBmp);
00410 
00411    void gdk_sel_prop_store(GdkWindow * owner,
00412                            GdkAtom type,
00413                            gint format, guchar * data, gint length);
00414 
00415    gint gdk_nmbstowcs(GdkWChar * dest,
00416                       const gchar * src, gint src_len, gint dest_max);
00417    gint gdk_nmbstowchar_ts(wchar_t * dest,
00418                            const gchar * src, gint src_len, gint dest_max);
00419 
00420    void gdk_wchar_text_handle(GdkFont * font,
00421                               const wchar_t * wcstr,
00422                               int wclen,
00423                               void (*handler) (GdkWin32SingleFont *,
00424                                                const wchar_t *,
00425                                                int, void *), void *arg);
00426 
00427    void gdk_win32_api_failed(const gchar * where,
00428                              gint line, const gchar * api);
00429    void gdk_other_api_failed(const gchar * where,
00430                              gint line, const gchar * api);
00431    void gdk_win32_gdi_failed(const gchar * where,
00432                              gint line, const gchar * api);
00433 #ifdef __GNUC__
00434 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
00435 #define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
00436 #define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
00437 #else
00438 #define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
00439 #define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__, __LINE__, api)
00440 #define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
00441 #endif
00442 
00443 #ifdef G_ENABLE_DEBUG
00444    gchar *gdk_win32_color_to_string(const GdkColor * color);
00445    gchar *gdk_win32_cap_style_to_string(GdkCapStyle cap_style);
00446    gchar *gdk_win32_fill_style_to_string(GdkFill fill);
00447    gchar *gdk_win32_function_to_string(GdkFunction function);
00448    gchar *gdk_win32_join_style_to_string(GdkJoinStyle join_style);
00449    gchar *gdk_win32_line_style_to_string(GdkLineStyle line_style);
00450    gchar *gdk_win32_message_name(UINT msg);
00451 #endif
00452 
00453    extern LRESULT CALLBACK gdk_WindowProc(HWND, UINT, WPARAM, LPARAM);
00454 
00455    extern GdkDrawableClass _gdk_win32_drawable_class;
00456    extern HWND gdk_root_window;
00457    GDKVAR ATOM gdk_selection_property;
00458    GDKVAR gchar *gdk_progclass;
00459    extern gboolean gdk_event_func_from_window_proc;
00460 
00461    extern HDC gdk_DC;
00462    extern HINSTANCE gdk_DLLInstance;
00463    extern HINSTANCE gdk_ProgInstance;
00464 
00465    extern UINT gdk_selection_notify_msg;
00466    extern UINT gdk_selection_request_msg;
00467    extern UINT gdk_selection_clear_msg;
00468    extern GdkAtom gdk_clipboard_atom;
00469    extern GdkAtom gdk_win32_dropfiles_atom;
00470    extern GdkAtom gdk_ole2_dnd_atom;
00471 
00472    extern DWORD windows_version;
00473 #define IS_WIN_NT(dwVersion) (dwVersion < 0x80000000)
00474 
00475 #ifdef __cplusplus
00476 }
00477 #endif                          /* __cplusplus */
00478 #endif                          /* __GDK_PRIVATE_WIN32_H__ */

Generated on Tue Jul 5 14:14:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1