]> Pileus Git - ~andy/gtk/blob - gdk/gdkpango.h
Bug 355343. Add a GdkPangoAttrEmbossColor.
[~andy/gtk] / gdk / gdkpango.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 2000 Red Hat, Inc. 
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 #ifndef __GDK_PANGO_H__
21 #define __GDK_PANGO_H__
22
23 #include <gdk/gdktypes.h>
24
25 G_BEGIN_DECLS
26
27 /* Pango interaction */
28
29 typedef struct _GdkPangoRenderer        GdkPangoRenderer;
30 typedef struct _GdkPangoRendererClass   GdkPangoRendererClass;
31 typedef struct _GdkPangoRendererPrivate GdkPangoRendererPrivate;
32
33 #define GDK_TYPE_PANGO_RENDERER            (gdk_pango_renderer_get_type())
34 #define GDK_PANGO_RENDERER(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PANGO_RENDERER, GdkPangoRenderer))
35 #define GDK_IS_PANGO_RENDERER(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PANGO_RENDERER))
36 #define GDK_PANGO_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PANGO_RENDERER, GdkPangoRendererClass))
37 #define GDK_IS_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PANGO_RENDERER))
38 #define GDK_PANGO_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PANGO_RENDERER, GdkPangoRendererClass))
39
40 /**
41  * GdkPangoRenderer:
42  *
43  * #GdkPangoRenderer is a subclass of #PangoRenderer used for rendering
44  * Pango objects into GDK drawables. The default renderer for a particular
45  * screen is obtained with gdk_pango_renderer_get_default(); Pango
46  * functions like pango_renderer_draw_layout() and
47  * pango_renderer_draw_layout_line() are then used to draw objects with
48  * the renderer.
49  *
50  * In most simple cases, applications can just use gdk_draw_layout(), and
51  * don't need to directly use #GdkPangoRenderer at all. Using the
52  * #GdkPangoRenderer directly is most useful when working with a
53  * transformation such as a rotation, because the Pango drawing functions
54  * take user space coordinates (coordinates before the transformation)
55  * instead of device coordinates.
56  *
57  * In certain cases it can be useful to subclass #GdkPangoRenderer. Examples
58  * of reasons to do this are to add handling of custom attributes by
59  * overriding 'prepare_run' or to do custom drawing of embedded objects
60  * by overriding 'draw_shape'.
61  *
62  * Since: 2.6
63  **/
64 struct _GdkPangoRenderer
65 {
66   /*< private >*/
67   PangoRenderer parent_instance;
68
69   GdkPangoRendererPrivate *priv;
70 };
71
72 /**
73  * GdkPangoRendererClass:
74  *
75  * #GdkPangoRenderer is the class structure for #GdkPangoRenderer.
76  *
77  * Since: 2.6
78  **/
79 struct _GdkPangoRendererClass
80 {
81   /*< private >*/
82   PangoRendererClass parent_class;
83 };
84
85 GType gdk_pango_renderer_get_type (void) G_GNUC_CONST;
86
87 PangoRenderer *gdk_pango_renderer_new         (GdkScreen *screen);
88 PangoRenderer *gdk_pango_renderer_get_default (GdkScreen *screen);
89
90 void gdk_pango_renderer_set_drawable       (GdkPangoRenderer *gdk_renderer,
91                                             GdkDrawable      *drawable);
92 void gdk_pango_renderer_set_gc             (GdkPangoRenderer *gdk_renderer,
93                                             GdkGC            *gc);
94 void gdk_pango_renderer_set_stipple        (GdkPangoRenderer *gdk_renderer,
95                                             PangoRenderPart   part,
96                                             GdkBitmap        *stipple);
97 void gdk_pango_renderer_set_override_color (GdkPangoRenderer *gdk_renderer,
98                                             PangoRenderPart   part,
99                                             const GdkColor   *color);
100
101 /************************************************************************/
102
103 PangoContext *gdk_pango_context_get_for_screen (GdkScreen    *screen);
104 #ifndef GDK_MULTIHEAD_SAFE
105 PangoContext *gdk_pango_context_get            (void);
106 #endif
107 #ifndef GDK_DISABLE_DEPRECATED
108 void          gdk_pango_context_set_colormap   (PangoContext *context,
109                                                 GdkColormap  *colormap);
110 #endif 
111
112
113 /* Get a clip region to draw only part of a layout or
114  * line. index_ranges contains alternating range starts/stops. The
115  * region is the region which contains the given ranges, i.e. if you
116  * draw with the region as clip, only the given ranges are drawn.
117  */
118
119 GdkRegion    *gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
120                                                      gint             x_origin,
121                                                      gint             y_origin,
122                                                      gint            *index_ranges,
123                                                      gint             n_ranges);
124 GdkRegion    *gdk_pango_layout_get_clip_region      (PangoLayout     *layout,
125                                                      gint             x_origin,
126                                                      gint             y_origin,
127                                                      gint            *index_ranges,
128                                                      gint             n_ranges);
129
130
131
132 /* Attributes use to render insensitive text in GTK+. */
133
134 typedef struct _GdkPangoAttrStipple GdkPangoAttrStipple;
135 typedef struct _GdkPangoAttrEmbossed GdkPangoAttrEmbossed;
136 typedef struct _GdkPangoAttrEmbossColor GdkPangoAttrEmbossColor;
137
138 struct _GdkPangoAttrStipple
139 {
140   PangoAttribute attr;
141   GdkBitmap *stipple;
142 };
143
144 struct _GdkPangoAttrEmbossed
145 {
146   PangoAttribute attr;
147   gboolean embossed;
148 };
149
150 struct _GdkPangoAttrEmbossColor
151 {
152   PangoAttribute attr;
153   PangoColor color;
154 };
155
156 PangoAttribute *gdk_pango_attr_stipple_new  (GdkBitmap *stipple);
157 PangoAttribute *gdk_pango_attr_embossed_new (gboolean embossed);
158 PangoAttribute *gdk_pango_attr_emboss_color_new (const GdkColor *color);
159
160 G_END_DECLS
161
162 #endif /* __GDK_FONT_H__ */