]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkprivate-quartz.h
0116852333b3e47f7fdfd4ae1cc4d738bd13ca12
[~andy/gtk] / gdk / quartz / gdkprivate-quartz.h
1 /* gdkwindow-quartz.c
2  *
3  * Copyright (C) 2005-2006 Imendio AB
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GDK_PRIVATE_QUARTZ_H__
22 #define __GDK_PRIVATE_QUARTZ_H__
23
24 #define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
25 #define GDK_QUARTZ_RELEASE_POOL [pool release]
26
27 #include <gdk/gdkprivate.h>
28 #include <gdk/quartz/gdkpixmap-quartz.h>
29 #include <gdk/quartz/gdkwindow-quartz.h>
30
31 #include <gdk/gdk.h>
32
33 #include "gdkinternals.h"
34
35 #include <config.h>
36
37 #define GDK_TYPE_GC_QUARTZ              (_gdk_gc_quartz_get_type ())
38 #define GDK_GC_QUARTZ(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_QUARTZ, GdkGCQuartz))
39 #define GDK_GC_QUARTZ_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))
40 #define GDK_IS_GC_QUARTZ(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_QUARTZ))
41 #define GDK_IS_GC_QUARTZ_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_QUARTZ))
42 #define GDK_GC_QUARTZ_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))
43
44 #define GDK_DRAG_CONTEXT_PRIVATE(context) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (context)->windowing_data)
45
46 typedef struct _GdkCursorPrivate GdkCursorPrivate;
47 typedef struct _GdkGCQuartz       GdkGCQuartz;
48 typedef struct _GdkGCQuartzClass  GdkGCQuartzClass;
49 typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
50
51 struct _GdkGCQuartz
52 {
53   GdkGC parent_instance;
54
55   GdkGCValuesMask values_mask;
56
57   gboolean have_clip_region;
58   gboolean have_clip_mask;
59   CGImageRef clip_mask;
60 };
61
62 struct _GdkGCQuartzClass
63 {
64   GdkGCClass parent_class;
65 };
66
67 struct _GdkVisualClass
68 {
69   GObjectClass parent_class;
70 };
71
72 struct _GdkCursorPrivate
73 {
74   GdkCursor cursor;
75   NSCursor *nscursor;
76 };
77
78 struct _GdkDragContextPrivate
79 {
80   id <NSDraggingInfo> dragging_info;
81 };
82
83 extern GdkDisplay *_gdk_display;
84 extern GdkScreen *_gdk_screen;
85 extern GdkWindow *_gdk_root;
86
87 extern GdkDragContext *_gdk_quartz_drag_source_context;
88
89 GType _gdk_gc_quartz_get_type (void);
90
91 GdkGC *_gdk_quartz_gc_new (GdkDrawable      *drawable,
92                           GdkGCValues      *values,
93                           GdkGCValuesMask   values_mask);
94
95 /* Initialization */
96 void _gdk_windowing_window_init (void);
97 void _gdk_events_init           (void);
98 void _gdk_visual_init           (void);
99 void _gdk_input_init            (void);
100
101 void _gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
102 void _gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
103
104 void _gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc);
105
106 gint        _gdk_quartz_get_inverted_screen_y      (gint y);
107
108 GdkWindow * _gdk_quartz_find_child_window_by_point (GdkWindow *toplevel,
109                                                     int        x,
110                                                     int        y,
111                                                     int       *x_ret,
112                                                     int       *y_ret);
113
114 void        _gdk_quartz_update_focus_window (GdkWindow *new_window,
115                                              gboolean   got_focus);
116 GdkWindow *_gdk_quartz_get_mouse_window     (void);
117 void       _gdk_quartz_update_mouse_window  (GdkWindow *window);
118 void       _gdk_quartz_update_cursor        (GdkWindow *window);
119
120 GdkImage  *_gdk_quartz_copy_to_image (GdkDrawable *drawable,
121                                       GdkImage    *image,
122                                       gint         src_x,
123                                       gint         src_y,
124                                       gint         dest_x,
125                                       gint         dest_y,
126                                       gint         width,
127                                       gint         height);
128
129 void _gdk_quartz_send_map_events (GdkWindow *window);
130
131 GdkEventType _gdk_quartz_key_event_type  (NSEvent   *event);
132 gboolean     _gdk_quartz_key_is_modifier (guint      keycode);
133
134 extern GdkWindow *_gdk_quartz_keyboard_grab_window;
135 extern GdkWindow *_gdk_quartz_pointer_grab_window;
136
137 #endif /* __GDK_PRIVATE_QUARTZ_H__ */