You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

167 lines
6.1 KiB

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