/binding/pango/attributes.d

http://github.com/wilkie/djehuty · D · 285 lines · 206 code · 45 blank · 34 comment · 0 complexity · 953a1d9b5d4c95e3d836ebb7e5b25316 MD5 · raw file

  1. /*
  2. * attributes.d
  3. *
  4. * This file holds bindings to pango's pango-attributes.h. The original copyright
  5. * is displayed below, but does not pertain to this file.
  6. *
  7. * Author: Dave Wilkinson
  8. *
  9. */
  10. module binding.pango.attributes;
  11. /* Pango
  12. * pango-attributes.h: Attributed text
  13. *
  14. * Copyright (C) 2000 Red Hat Software
  15. *
  16. * This library is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU Library General Public
  18. * License as published by the Free Software Foundation; either
  19. * version 2 of the License, or (at your option) any later version.
  20. *
  21. * This library is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * Library General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Library General Public
  27. * License along with this library; if not, write to the
  28. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  29. * Boston, MA 02111-1307, USA.
  30. */
  31. import binding.pango.types;
  32. import binding.pango.font;
  33. import binding.pango.gravity;
  34. extern(C):
  35. /* PangoColor */
  36. alias _PangoColor PangoColor;
  37. struct _PangoColor
  38. {
  39. guint16 red;
  40. guint16 green;
  41. guint16 blue;
  42. }
  43. //#define PANGO_TYPE_COLOR pango_color_get_type ()
  44. GType pango_color_get_type () ;
  45. PangoColor *pango_color_copy (PangoColor *src);
  46. void pango_color_free (PangoColor *color);
  47. gboolean pango_color_parse (PangoColor *color,
  48. char *spec);
  49. gchar *pango_color_to_string(PangoColor *color);
  50. /* Attributes */
  51. alias _PangoAttribute PangoAttribute;
  52. alias _PangoAttrClass PangoAttrClass;
  53. alias _PangoAttrString PangoAttrString;
  54. alias _PangoAttrLanguage PangoAttrLanguage;
  55. alias _PangoAttrInt PangoAttrInt;
  56. alias _PangoAttrSize PangoAttrSize;
  57. alias _PangoAttrFloat PangoAttrFloat;
  58. alias _PangoAttrColor PangoAttrColor;
  59. alias _PangoAttrFontDesc PangoAttrFontDesc;
  60. alias _PangoAttrShape PangoAttrShape;
  61. //#define PANGO_TYPE_ATTR_LIST pango_attr_list_get_type ()
  62. extern(C) struct _PangoAttrList;
  63. extern(C) struct _PangoAttrIterator;
  64. alias _PangoAttrList PangoAttrList;
  65. alias _PangoAttrIterator PangoAttrIterator;
  66. enum PangoAttrType
  67. {
  68. PANGO_ATTR_INVALID, /* 0 is an invalid attribute type */
  69. PANGO_ATTR_LANGUAGE, /* PangoAttrLanguage */
  70. PANGO_ATTR_FAMILY, /* PangoAttrString */
  71. PANGO_ATTR_STYLE, /* PangoAttrInt */
  72. PANGO_ATTR_WEIGHT, /* PangoAttrInt */
  73. PANGO_ATTR_VARIANT, /* PangoAttrInt */
  74. PANGO_ATTR_STRETCH, /* PangoAttrInt */
  75. PANGO_ATTR_SIZE, /* PangoAttrSize */
  76. PANGO_ATTR_FONT_DESC, /* PangoAttrFontDesc */
  77. PANGO_ATTR_FOREGROUND, /* PangoAttrColor */
  78. PANGO_ATTR_BACKGROUND, /* PangoAttrColor */
  79. PANGO_ATTR_UNDERLINE, /* PangoAttrInt */
  80. PANGO_ATTR_STRIKETHROUGH, /* PangoAttrInt */
  81. PANGO_ATTR_RISE, /* PangoAttrInt */
  82. PANGO_ATTR_SHAPE, /* PangoAttrShape */
  83. PANGO_ATTR_SCALE, /* PangoAttrFloat */
  84. PANGO_ATTR_FALLBACK, /* PangoAttrInt */
  85. PANGO_ATTR_LETTER_SPACING, /* PangoAttrInt */
  86. PANGO_ATTR_UNDERLINE_COLOR, /* PangoAttrColor */
  87. PANGO_ATTR_STRIKETHROUGH_COLOR,/* PangoAttrColor */
  88. PANGO_ATTR_ABSOLUTE_SIZE, /* PangoAttrSize */
  89. PANGO_ATTR_GRAVITY, /* PangoAttrInt */
  90. PANGO_ATTR_GRAVITY_HINT /* PangoAttrInt */
  91. }
  92. enum PangoUnderline {
  93. PANGO_UNDERLINE_NONE,
  94. PANGO_UNDERLINE_SINGLE,
  95. PANGO_UNDERLINE_DOUBLE,
  96. PANGO_UNDERLINE_LOW,
  97. PANGO_UNDERLINE_ERROR
  98. }
  99. struct _PangoAttribute
  100. {
  101. PangoAttrClass *klass;
  102. guint start_index; /* in bytes */
  103. guint end_index; /* in bytes. The character at this index is not included */
  104. }
  105. alias gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute,
  106. gpointer data);
  107. alias gpointer (*PangoAttrDataCopyFunc) (gconstpointer data);
  108. struct _PangoAttrClass
  109. {
  110. /*< public >*/
  111. PangoAttrType type;
  112. PangoAttribute * (*copy) (PangoAttribute *attr);
  113. void (*destroy) (PangoAttribute *attr);
  114. gboolean (*equal) (PangoAttribute *attr1, PangoAttribute *attr2);
  115. }
  116. struct _PangoAttrString
  117. {
  118. PangoAttribute attr;
  119. char *value;
  120. }
  121. struct _PangoAttrLanguage
  122. {
  123. PangoAttribute attr;
  124. PangoLanguage *value;
  125. }
  126. struct _PangoAttrInt
  127. {
  128. PangoAttribute attr;
  129. int value;
  130. }
  131. struct _PangoAttrFloat
  132. {
  133. PangoAttribute attr;
  134. double value;
  135. }
  136. struct _PangoAttrColor
  137. {
  138. PangoAttribute attr;
  139. PangoColor color;
  140. }
  141. struct _PangoAttrSize
  142. {
  143. PangoAttribute attr;
  144. int size;
  145. guint absolute;
  146. }
  147. struct _PangoAttrShape
  148. {
  149. PangoAttribute attr;
  150. PangoRectangle ink_rect;
  151. PangoRectangle logical_rect;
  152. gpointer data;
  153. PangoAttrDataCopyFunc copy_func;
  154. GDestroyNotify destroy_func;
  155. }
  156. struct _PangoAttrFontDesc
  157. {
  158. PangoAttribute attr;
  159. PangoFontDescription *desc;
  160. }
  161. PangoAttrType pango_attr_type_register (gchar *name);
  162. PangoAttribute * pango_attribute_copy (PangoAttribute *attr);
  163. void pango_attribute_destroy (PangoAttribute *attr);
  164. gboolean pango_attribute_equal (PangoAttribute *attr1,
  165. PangoAttribute *attr2);
  166. PangoAttribute *pango_attr_language_new (PangoLanguage *language);
  167. PangoAttribute *pango_attr_family_new ( char *family);
  168. PangoAttribute *pango_attr_foreground_new (guint16 red,
  169. guint16 green,
  170. guint16 blue);
  171. PangoAttribute *pango_attr_background_new (guint16 red,
  172. guint16 green,
  173. guint16 blue);
  174. PangoAttribute *pango_attr_size_new (int size);
  175. PangoAttribute *pango_attr_size_new_absolute (int size);
  176. PangoAttribute *pango_attr_style_new (PangoStyle style);
  177. PangoAttribute *pango_attr_weight_new (PangoWeight weight);
  178. PangoAttribute *pango_attr_variant_new (PangoVariant variant);
  179. PangoAttribute *pango_attr_stretch_new (PangoStretch stretch);
  180. PangoAttribute *pango_attr_font_desc_new (PangoFontDescription *desc);
  181. PangoAttribute *pango_attr_underline_new (PangoUnderline underline);
  182. PangoAttribute *pango_attr_underline_color_new (guint16 red,
  183. guint16 green,
  184. guint16 blue);
  185. PangoAttribute *pango_attr_strikethrough_new (gboolean strikethrough);
  186. PangoAttribute *pango_attr_strikethrough_color_new (guint16 red,
  187. guint16 green,
  188. guint16 blue);
  189. PangoAttribute *pango_attr_rise_new (int rise);
  190. PangoAttribute *pango_attr_scale_new (double scale_factor);
  191. PangoAttribute *pango_attr_fallback_new (gboolean enable_fallback);
  192. PangoAttribute *pango_attr_letter_spacing_new (int letter_spacing);
  193. PangoAttribute *pango_attr_shape_new (PangoRectangle *ink_rect,
  194. PangoRectangle *logical_rect);
  195. PangoAttribute *pango_attr_shape_new_with_data (PangoRectangle *ink_rect,
  196. PangoRectangle *logical_rect,
  197. gpointer data,
  198. PangoAttrDataCopyFunc copy_func,
  199. GDestroyNotify destroy_func);
  200. PangoAttribute *pango_attr_gravity_new (PangoGravity gravity);
  201. PangoAttribute *pango_attr_gravity_hint_new (PangoGravityHint hint);
  202. GType pango_attr_list_get_type () ;
  203. PangoAttrList * pango_attr_list_new ();
  204. PangoAttrList * pango_attr_list_ref (PangoAttrList *list);
  205. void pango_attr_list_unref (PangoAttrList *list);
  206. PangoAttrList * pango_attr_list_copy (PangoAttrList *list);
  207. void pango_attr_list_insert (PangoAttrList *list,
  208. PangoAttribute *attr);
  209. void pango_attr_list_insert_before (PangoAttrList *list,
  210. PangoAttribute *attr);
  211. void pango_attr_list_change (PangoAttrList *list,
  212. PangoAttribute *attr);
  213. void pango_attr_list_splice (PangoAttrList *list,
  214. PangoAttrList *other,
  215. gint pos,
  216. gint len);
  217. PangoAttrList *pango_attr_list_filter (PangoAttrList *list,
  218. PangoAttrFilterFunc func,
  219. gpointer data);
  220. PangoAttrIterator *pango_attr_list_get_iterator (PangoAttrList *list);
  221. void pango_attr_iterator_range (PangoAttrIterator *iterator,
  222. gint *start,
  223. gint *end);
  224. gboolean pango_attr_iterator_next (PangoAttrIterator *iterator);
  225. PangoAttrIterator *pango_attr_iterator_copy (PangoAttrIterator *iterator);
  226. void pango_attr_iterator_destroy (PangoAttrIterator *iterator);
  227. PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator,
  228. PangoAttrType type);
  229. void pango_attr_iterator_get_font (PangoAttrIterator *iterator,
  230. PangoFontDescription *desc,
  231. PangoLanguage **language,
  232. GSList **extra_attrs);
  233. GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator);
  234. gboolean pango_parse_markup (char *markup_text,
  235. int length,
  236. gunichar accel_marker,
  237. PangoAttrList **attr_list,
  238. char **text,
  239. gunichar *accel_char,
  240. GError **error);