]> Pileus Git - ~andy/gtk/blob - gdk/gdkdrawable.h
a1c5fd3f2b4cd10e238a1d6a5b614e098b2fc51e
[~andy/gtk] / gdk / gdkdrawable.h
1 #ifndef __GDK_DRAWABLE_H__
2 #define __GDK_DRAWABLE_H__
3
4 #include <gdk/gdktypes.h>
5 #include <gdk/gdkgc.h>
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif /* __cplusplus */
10
11 typedef struct _GdkDrawableClass GdkDrawableClass;
12
13 /* Types of windows.
14  *   Root: There is only 1 root window and it is initialized
15  *         at startup. Creating a window of type GDK_WINDOW_ROOT
16  *         is an error.
17  *   Toplevel: Windows which interact with the window manager.
18  *   Child: Windows which are children of some other type of window.
19  *          (Any other type of window). Most windows are child windows.
20  *   Dialog: A special kind of toplevel window which interacts with
21  *           the window manager slightly differently than a regular
22  *           toplevel window. Dialog windows should be used for any
23  *           transient window.
24  *   Pixmap: Pixmaps are really just another kind of window which
25  *           doesn't actually appear on the screen. It can't have
26  *           children, either and is really just a convenience so
27  *           that the drawing functions can work on both windows
28  *           and pixmaps transparently. (ie. You shouldn't pass a
29  *           pixmap to any procedure which accepts a window with the
30  *           exception of the drawing functions).
31  *   Foreign: A window that actually belongs to another application
32  */
33 typedef enum
34 {
35   GDK_WINDOW_ROOT,
36   GDK_WINDOW_TOPLEVEL,
37   GDK_WINDOW_CHILD,
38   GDK_WINDOW_DIALOG,
39   GDK_WINDOW_TEMP,
40   GDK_DRAWABLE_PIXMAP,
41   GDK_WINDOW_FOREIGN
42 } GdkDrawableType;
43
44 struct _GdkDrawable
45 {
46   gpointer user_data;
47 };
48  
49 struct _GdkDrawableClass 
50 {
51   void  (*destroy)       (GdkDrawable    *drawable);
52   GdkGC *(*create_gc)    (GdkDrawable    *drawable,
53                           GdkGCValues    *values,
54                           GdkGCValuesMask mask);
55   void (*draw_rectangle) (GdkDrawable  *drawable,
56                           GdkGC        *gc,
57                           gint          filled,
58                           gint          x,
59                           gint          y,
60                           gint          width,
61                           gint          height);
62   void (*draw_arc)       (GdkDrawable  *drawable,
63                           GdkGC        *gc,
64                           gint          filled,
65                           gint          x,
66                           gint          y,
67                           gint          width,
68                           gint          height,
69                           gint          angle1,
70                           gint          angle2);
71   void (*draw_polygon)   (GdkDrawable  *drawable,
72                           GdkGC        *gc,
73                           gint          filled,
74                           GdkPoint     *points,
75                           gint          npoints);
76   void (*draw_text)      (GdkDrawable  *drawable,
77                           GdkFont      *font,
78                           GdkGC        *gc,
79                           gint          x,
80                           gint          y,
81                           const gchar  *text,
82                           gint          text_length);
83   void (*draw_text_wc)   (GdkDrawable    *drawable,
84                           GdkFont        *font,
85                           GdkGC          *gc,
86                           gint            x,
87                           gint            y,
88                           const GdkWChar *text,
89                           gint            text_length);
90   void (*draw_drawable)  (GdkDrawable  *drawable,
91                           GdkGC        *gc,
92                           GdkDrawable  *src,
93                           gint          xsrc,
94                           gint          ysrc,
95                           gint          xdest,
96                           gint          ydest,
97                           gint          width,
98                           gint          height);
99   void (*draw_points)    (GdkDrawable  *drawable,
100                           GdkGC        *gc,
101                           GdkPoint     *points,
102                           gint          npoints);
103   void (*draw_segments)  (GdkDrawable  *drawable,
104                           GdkGC        *gc,
105                           GdkSegment   *segs,
106                           gint          nsegs);
107   void (*draw_lines)     (GdkDrawable  *drawable,
108                           GdkGC        *gc,
109                           GdkPoint     *points,
110                           gint          npoints);
111 };
112
113 /* Manipulation of drawables
114  */
115 GdkDrawable *   gdk_drawable_alloc        (void);
116
117 GdkDrawableType gdk_drawable_get_type     (GdkDrawable    *window);
118
119 void            gdk_drawable_set_data     (GdkDrawable    *drawable,
120                                            const gchar    *key,
121                                            gpointer       data,
122                                            GDestroyNotify  destroy_func);
123 gpointer        gdk_drawable_get_data     (GdkDrawable    *drawable,
124                                            const gchar    *key);
125
126 void            gdk_drawable_get_size     (GdkWindow      *drawable,
127                                            gint           *width,
128                                            gint           *height);
129 void            gdk_drawable_set_colormap (GdkDrawable    *drawable,
130                                            GdkColormap    *colormap);
131 GdkColormap*    gdk_drawable_get_colormap (GdkDrawable    *drawable);
132 GdkVisual*      gdk_drawable_get_visual   (GdkDrawable    *drawable);
133 gint            gdk_drawable_get_depth    (GdkDrawable    *drawable);
134 GdkDrawable*    gdk_drawable_ref          (GdkDrawable    *drawable);
135 void            gdk_drawable_unref        (GdkDrawable    *drawable);
136
137 /* Drawing
138  */
139 void gdk_draw_point      (GdkDrawable  *drawable,
140                           GdkGC        *gc,
141                           gint          x,
142                           gint          y);
143 void gdk_draw_line       (GdkDrawable  *drawable,
144                           GdkGC        *gc,
145                           gint          x1,
146                           gint          y1,
147                           gint          x2,
148                           gint          y2);
149 void gdk_draw_rectangle  (GdkDrawable  *drawable,
150                           GdkGC        *gc,
151                           gint          filled,
152                           gint          x,
153                           gint          y,
154                           gint          width,
155                           gint          height);
156 void gdk_draw_arc        (GdkDrawable  *drawable,
157                           GdkGC        *gc,
158                           gint          filled,
159                           gint          x,
160                           gint          y,
161                           gint          width,
162                           gint          height,
163                           gint          angle1,
164                           gint          angle2);
165 void gdk_draw_polygon    (GdkDrawable  *drawable,
166                           GdkGC        *gc,
167                           gint          filled,
168                           GdkPoint     *points,
169                           gint          npoints);
170 void gdk_draw_string     (GdkDrawable  *drawable,
171                           GdkFont      *font,
172                           GdkGC        *gc,
173                           gint          x,
174                           gint          y,
175                           const gchar  *string);
176 void gdk_draw_text       (GdkDrawable  *drawable,
177                           GdkFont      *font,
178                           GdkGC        *gc,
179                           gint          x,
180                           gint          y,
181                           const gchar  *text,
182                           gint          text_length);
183 void gdk_draw_text_wc    (GdkDrawable    *drawable,
184                           GdkFont        *font,
185                           GdkGC          *gc,
186                           gint            x,
187                           gint            y,
188                           const GdkWChar *text,
189                           gint            text_length);
190 void gdk_draw_drawable   (GdkDrawable  *drawable,
191                           GdkGC        *gc,
192                           GdkDrawable  *src,
193                           gint          xsrc,
194                           gint          ysrc,
195                           gint          xdest,
196                           gint          ydest,
197                           gint          width,
198                           gint          height);
199 void gdk_draw_image      (GdkDrawable  *drawable,
200                           GdkGC        *gc,
201                           GdkImage     *image,
202                           gint          xsrc,
203                           gint          ysrc,
204                           gint          xdest,
205                           gint          ydest,
206                           gint          width,
207                           gint          height);
208 void gdk_draw_points     (GdkDrawable  *drawable,
209                           GdkGC        *gc,
210                           GdkPoint     *points,
211                           gint          npoints);
212 void gdk_draw_segments   (GdkDrawable  *drawable,
213                           GdkGC        *gc,
214                           GdkSegment   *segs,
215                           gint          nsegs);
216 void gdk_draw_lines      (GdkDrawable  *drawable,
217                           GdkGC        *gc,
218                           GdkPoint     *points,
219                           gint          npoints);
220  
221 #ifdef __cplusplus
222 }
223 #endif /* __cplusplus */
224
225 #endif /* __GDK_DRAWABLE_H__ */