PageRenderTime 27ms CodeModel.GetById 7ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

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