alternative to assert
[gtkD.git] / gtkD / src / pango / PgItem.d
blob4bd518d600044f8ccfc5cbecdb3d68df399f90de
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = pango
27 * outFile = PgItem
28 * strct = PangoItem
29 * realStrct=
30 * ctorStrct=
31 * clss = PgItem
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_item_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - pango.PgContext
45 * - pango.PgLayout
46 * - pango.PgFontDescription
47 * - pango.PgFontMetrics
48 * - pango.PgFontFamily
49 * - pango.PgFontFace
50 * - pango.PgFontMap
51 * - pango.PgFontsetSimple
52 * - pango.PgAttribute
53 * - pango.PgAttributeList
54 * - pango.PgLanguage
55 * - pango.PgTabArray
56 * - pango.PgLayout
57 * - pango.PgLayoutIter
58 * - pango.PgScriptIter
59 * structWrap:
60 * - PangoAttribute* -> PgAttribute
61 * - PangoAttributeList* -> PgAttributeList
62 * - PangoContext* -> PgContext
63 * - PangoFontDescription* -> PgFontDescription
64 * - PangoFontFace* -> PgFontFace
65 * - PangoFontFamily* -> PgFontFamily
66 * - PangoFontMap* -> PgFontMap
67 * - PangoFontMetrics* -> PgFontMetrics
68 * - PangoFontsetSimple* -> PgFontsetSimple
69 * - PangoLanguage* -> PgLanguage
70 * - PangoLayout* -> PgLayout
71 * - PangoLayoutIter* -> PgLayoutIter
72 * - PangoScriptIter* -> PgScriptIter
73 * - PangoTabArray* -> PgTabArray
74 * module aliases:
75 * local aliases:
78 module pango.PgItem;
80 version(noAssert)
82 version(Tango)
84 import tango.io.Stdout; // use the tango loging?
88 private import gtkc.pangotypes;
90 private import gtkc.pango;
93 private import pango.PgContext;
94 private import pango.PgLayout;
95 private import pango.PgFontDescription;
96 private import pango.PgFontMetrics;
97 private import pango.PgFontFamily;
98 private import pango.PgFontFace;
99 private import pango.PgFontMap;
100 private import pango.PgFontsetSimple;
101 private import pango.PgAttribute;
102 private import pango.PgAttributeList;
103 private import pango.PgLanguage;
104 private import pango.PgTabArray;
105 private import pango.PgLayout;
106 private import pango.PgLayoutIter;
107 private import pango.PgScriptIter;
113 * Description
114 * The Pango rendering pipeline takes a string of
115 * Unicode characters and converts it into glyphs.
116 * The functions described in this section accomplish
117 * various steps of this process.
119 public class PgItem
122 /** the main Gtk struct */
123 protected PangoItem* pangoItem;
126 public PangoItem* getPgItemStruct()
128 return pangoItem;
132 /** the main Gtk struct as a void* */
133 protected void* getStruct()
135 return cast(void*)pangoItem;
139 * Sets our main struct and passes it to the parent class
141 public this (PangoItem* pangoItem)
143 version(noAssert)
145 if ( pangoItem is null )
147 int zero = 0;
148 version(Tango)
150 Stdout("struct pangoItem is null on constructor").newline;
152 else
154 printf("struct pangoItem is null on constructor");
156 zero = zero / zero;
159 else
161 assert(pangoItem !is null, "struct pangoItem is null on constructor");
163 this.pangoItem = pangoItem;
178 * Free a PangoItem and all associated memory.
179 * item:
180 * a PangoItem
182 public void free()
184 // void pango_item_free (PangoItem *item);
185 pango_item_free(pangoItem);
189 * Copy an existing PangoItem structure.
190 * item:
191 * a PangoItem
192 * Returns:
193 * the newly allocated PangoItem, which should
194 * be freed with pango_item_free().
196 public PangoItem* copy()
198 // PangoItem* pango_item_copy (PangoItem *item);
199 return pango_item_copy(pangoItem);
203 * Creates a new PangoItem structure initialized to default values.
204 * Returns:
205 * the newly allocated PangoItem, which should
206 * be freed with pango_item_free().
208 public this ()
210 // PangoItem* pango_item_new (void);
211 this(cast(PangoItem*)pango_item_new() );
215 * Modifies orig to cover only the text after split_index, and
216 * returns a new item that covers the text before split_index that
217 * used to be in orig. You can think of split_index as the length of
218 * the returned item. split_index may not be 0, and it may not be
219 * greater than or equal to the length of orig (that is, there must
220 * be at least one byte assigned to each item, you can't create a
221 * zero-length item). split_offset is the length of the first item in
222 * chars, and must be provided because the text used to generate the
223 * item isn't available, so pango_item_split() can't count the char
224 * length of the split items itself.
225 * orig:
226 * a PangoItem
227 * split_index:
228 * byte index of position to split item, relative to the start of the item
229 * split_offset:
230 * number of chars between start of orig and split_index
231 * Returns:
232 * new item representing text before split_index, which
233 * should be freed with pango_item_free().
235 public PangoItem* split(int splitIndex, int splitOffset)
237 // PangoItem* pango_item_split (PangoItem *orig, int split_index, int split_offset);
238 return pango_item_split(pangoItem, splitIndex, splitOffset);