]> Pileus Git - ~andy/gtk/blob - gdk/gdkgc.h
Revert name change
[~andy/gtk] / gdk / gdkgc.h
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 Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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-2000.  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 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_GC_H__
32 #define __GDK_GC_H__
33
34 #include <gdk/gdkcolor.h>
35 #include <gdk/gdktypes.h>
36
37 G_BEGIN_DECLS
38
39 typedef struct _GdkGCValues           GdkGCValues;
40 typedef struct _GdkGCClass            GdkGCClass;
41
42 /* GC cap styles
43  *  CapNotLast:
44  *  CapButt:
45  *  CapRound:
46  *  CapProjecting:
47  */
48 typedef enum
49 {
50   GDK_CAP_NOT_LAST,
51   GDK_CAP_BUTT,
52   GDK_CAP_ROUND,
53   GDK_CAP_PROJECTING
54 } GdkCapStyle;
55
56 /* GC fill types.
57  *  Solid:
58  *  Tiled:
59  *  Stippled:
60  *  OpaqueStippled:
61  */
62 typedef enum
63 {
64   GDK_SOLID,
65   GDK_TILED,
66   GDK_STIPPLED,
67   GDK_OPAQUE_STIPPLED
68 } GdkFill;
69
70 /* GC function types.
71  *   Copy: Overwrites destination pixels with the source pixels.
72  *   Invert: Inverts the destination pixels.
73  *   Xor: Xor's the destination pixels with the source pixels.
74  *   Clear: set pixels to 0
75  *   And: source AND destination
76  *   And Reverse: source AND (NOT destination)
77  *   And Invert: (NOT source) AND destination
78  *   Noop: destination
79  *   Or: source OR destination
80  *   Nor: (NOT source) AND (NOT destination)
81  *   Equiv: (NOT source) XOR destination
82  *   Xor Reverse: source OR (NOT destination)
83  *   Copy Inverted: NOT source
84  *   Xor Inverted: (NOT source) OR destination
85  *   Nand: (NOT source) OR (NOT destination)
86  *   Set: set pixels to 1
87  */
88 typedef enum
89 {
90   GDK_COPY,
91   GDK_INVERT,
92   GDK_XOR,
93   GDK_CLEAR,
94   GDK_AND,
95   GDK_AND_REVERSE,
96   GDK_AND_INVERT,
97   GDK_NOOP,
98   GDK_OR,
99   GDK_EQUIV,
100   GDK_OR_REVERSE,
101   GDK_COPY_INVERT,
102   GDK_OR_INVERT,
103   GDK_NAND,
104   GDK_NOR,
105   GDK_SET
106 } GdkFunction;
107
108 /* GC join styles
109  *  JoinMiter:
110  *  JoinRound:
111  *  JoinBevel:
112  */
113 typedef enum
114 {
115   GDK_JOIN_MITER,
116   GDK_JOIN_ROUND,
117   GDK_JOIN_BEVEL
118 } GdkJoinStyle;
119
120 /* GC line styles
121  *  Solid:
122  *  OnOffDash:
123  *  DoubleDash:
124  */
125 typedef enum
126 {
127   GDK_LINE_SOLID,
128   GDK_LINE_ON_OFF_DASH,
129   GDK_LINE_DOUBLE_DASH
130 } GdkLineStyle;
131
132 typedef enum
133 {
134   GDK_CLIP_BY_CHILDREN  = 0,
135   GDK_INCLUDE_INFERIORS = 1
136 } GdkSubwindowMode;
137
138 typedef enum
139 {
140   GDK_GC_FOREGROUND    = 1 << 0,
141   GDK_GC_BACKGROUND    = 1 << 1,
142   GDK_GC_FONT          = 1 << 2,
143   GDK_GC_FUNCTION      = 1 << 3,
144   GDK_GC_FILL          = 1 << 4,
145   GDK_GC_TILE          = 1 << 5,
146   GDK_GC_STIPPLE       = 1 << 6,
147   GDK_GC_CLIP_MASK     = 1 << 7,
148   GDK_GC_SUBWINDOW     = 1 << 8,
149   GDK_GC_TS_X_ORIGIN   = 1 << 9,
150   GDK_GC_TS_Y_ORIGIN   = 1 << 10,
151   GDK_GC_CLIP_X_ORIGIN = 1 << 11,
152   GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
153   GDK_GC_EXPOSURES     = 1 << 13,
154   GDK_GC_LINE_WIDTH    = 1 << 14,
155   GDK_GC_LINE_STYLE    = 1 << 15,
156   GDK_GC_CAP_STYLE     = 1 << 16,
157   GDK_GC_JOIN_STYLE    = 1 << 17
158 } GdkGCValuesMask;
159
160 struct _GdkGCValues
161 {
162   GdkColor          foreground;
163   GdkColor          background;
164   GdkFont          *font;
165   GdkFunction       function;
166   GdkFill           fill;
167   GdkPixmap        *tile;
168   GdkPixmap        *stipple;
169   GdkPixmap        *clip_mask;
170   GdkSubwindowMode  subwindow_mode;
171   gint              ts_x_origin;
172   gint              ts_y_origin;
173   gint              clip_x_origin;
174   gint              clip_y_origin;
175   gint              graphics_exposures;
176   gint              line_width;
177   GdkLineStyle      line_style;
178   GdkCapStyle       cap_style;
179   GdkJoinStyle      join_style;
180 };
181
182 #define GDK_TYPE_GC              (gdk_gc_get_type ())
183 #define GDK_GC(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC, GdkGC))
184 #define GDK_GC_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC, GdkGCClass))
185 #define GDK_IS_GC(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC))
186 #define GDK_IS_GC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC))
187 #define GDK_GC_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC, GdkGCClass))
188
189 struct _GdkGC
190 {
191   GObject parent_instance;
192
193   gint clip_x_origin;
194   gint clip_y_origin;
195   gint ts_x_origin;
196   gint ts_y_origin;
197
198   GdkColormap *colormap;
199 };
200
201 struct _GdkGCClass 
202 {
203   GObjectClass parent_class;
204   
205   void (*get_values)     (GdkGC          *gc,
206                           GdkGCValues    *values);
207   void (*set_values)     (GdkGC          *gc,
208                           GdkGCValues    *values,
209                           GdkGCValuesMask mask);
210   void (*set_dashes)     (GdkGC          *gc,
211                           gint            dash_offset,
212                           gint8           dash_list[],
213                           gint            n);
214   
215   /* Padding for future expansion */
216   void         (*_gdk_reserved1)  (void);
217   void         (*_gdk_reserved2)  (void);
218   void         (*_gdk_reserved3)  (void);
219   void         (*_gdk_reserved4)  (void);
220 };
221
222
223 GType  gdk_gc_get_type            (void) G_GNUC_CONST;
224 GdkGC *gdk_gc_new                 (GdkDrawable      *drawable);
225 GdkGC *gdk_gc_new_with_values     (GdkDrawable      *drawable,
226                                    GdkGCValues      *values,
227                                    GdkGCValuesMask   values_mask);
228
229 #ifndef GDK_DISABLE_DEPRECATED
230 GdkGC *gdk_gc_ref                 (GdkGC            *gc);
231 void   gdk_gc_unref               (GdkGC            *gc);
232 #endif
233
234 void   gdk_gc_get_values          (GdkGC            *gc,
235                                    GdkGCValues      *values);
236 void   gdk_gc_set_values          (GdkGC           *gc,
237                                    GdkGCValues     *values,
238                                    GdkGCValuesMask  values_mask);
239 void   gdk_gc_set_foreground      (GdkGC            *gc,
240                                    const GdkColor   *color);
241 void   gdk_gc_set_background      (GdkGC            *gc,
242                                    const GdkColor   *color);
243 #ifndef GDK_DISABLE_DEPRECATED
244 void   gdk_gc_set_font            (GdkGC            *gc,
245                                    GdkFont          *font);
246 #endif /* GDK_DISABLE_DEPRECATED */
247 void   gdk_gc_set_function        (GdkGC            *gc,
248                                    GdkFunction       function);
249 void   gdk_gc_set_fill            (GdkGC            *gc,
250                                    GdkFill           fill);
251 void   gdk_gc_set_tile            (GdkGC            *gc,
252                                    GdkPixmap        *tile);
253 void   gdk_gc_set_stipple         (GdkGC            *gc,
254                                    GdkPixmap        *stipple);
255 void   gdk_gc_set_ts_origin       (GdkGC            *gc,
256                                    gint              x,
257                                    gint              y);
258 void   gdk_gc_set_clip_origin     (GdkGC            *gc,
259                                    gint              x,
260                                    gint              y);
261 void   gdk_gc_set_clip_mask       (GdkGC            *gc,
262                                    GdkBitmap        *mask);
263 void   gdk_gc_set_clip_rectangle  (GdkGC            *gc,
264                                    const GdkRectangle *rectangle);
265 void   gdk_gc_set_clip_region     (GdkGC            *gc,
266                                    const GdkRegion  *region);
267 void   gdk_gc_set_subwindow       (GdkGC            *gc,
268                                    GdkSubwindowMode  mode);
269 void   gdk_gc_set_exposures       (GdkGC            *gc,
270                                    gboolean          exposures);
271 void   gdk_gc_set_line_attributes (GdkGC            *gc,
272                                    gint              line_width,
273                                    GdkLineStyle      line_style,
274                                    GdkCapStyle       cap_style,
275                                    GdkJoinStyle      join_style);
276 void   gdk_gc_set_dashes          (GdkGC            *gc,
277                                    gint              dash_offset,
278                                    gint8             dash_list[],
279                                    gint              n);
280 void   gdk_gc_offset              (GdkGC            *gc,
281                                    gint              x_offset,
282                                    gint              y_offset);
283 void   gdk_gc_copy                (GdkGC            *dst_gc,
284                                    GdkGC            *src_gc);
285
286
287 void         gdk_gc_set_colormap     (GdkGC          *gc,
288                                       GdkColormap    *colormap);
289 GdkColormap *gdk_gc_get_colormap     (GdkGC          *gc);
290 void         gdk_gc_set_rgb_fg_color (GdkGC          *gc,
291                                       const GdkColor *color);
292 void         gdk_gc_set_rgb_bg_color (GdkGC          *gc,
293                                       const GdkColor *color);
294 GdkScreen *  gdk_gc_get_screen       (GdkGC          *gc);
295
296 #ifndef GDK_DISABLE_DEPRECATED
297 #define gdk_gc_destroy                 gdk_gc_unref
298 #endif /* GDK_DISABLE_DEPRECATED */
299
300 G_END_DECLS
301
302 #endif /* __GDK_DRAWABLE_H__ */