1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module pango.PgGlyphItemIter; 26 27 private import glib.Str; 28 private import gobject.ObjectG; 29 private import gtkc.pango; 30 public import gtkc.pangotypes; 31 private import pango.PgGlyphItem; 32 33 34 /** 35 * A #PangoGlyphItemIter is an iterator over the clusters in a 36 * #PangoGlyphItem. The <firstterm>forward direction</firstterm> of the 37 * iterator is the logical direction of text. That is, with increasing 38 * @start_index and @start_char values. If @glyph_item is right-to-left 39 * (that is, if <literal>@glyph_item->item->analysis.level</literal> is odd), 40 * then @start_glyph decreases as the iterator moves forward. Moreover, 41 * in right-to-left cases, @start_glyph is greater than @end_glyph. 42 * 43 * An iterator should be initialized using either of 44 * pango_glyph_item_iter_init_start() and 45 * pango_glyph_item_iter_init_end(), for forward and backward iteration 46 * respectively, and walked over using any desired mixture of 47 * pango_glyph_item_iter_next_cluster() and 48 * pango_glyph_item_iter_prev_cluster(). A common idiom for doing a 49 * forward iteration over the clusters is: 50 * <programlisting> 51 * PangoGlyphItemIter cluster_iter; 52 * gboolean have_cluster; 53 * 54 * for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, 55 * glyph_item, text); 56 * have_cluster; 57 * have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter)) 58 * { 59 * ... 60 * } 61 * </programlisting> 62 * 63 * Note that @text is the start of the text for layout, which is then 64 * indexed by <literal>@glyph_item->item->offset</literal> to get to the 65 * text of @glyph_item. The @start_index and @end_index values can directly 66 * index into @text. The @start_glyph, @end_glyph, @start_char, and @end_char 67 * values however are zero-based for the @glyph_item. For each cluster, the 68 * item pointed at by the start variables is included in the cluster while 69 * the one pointed at by end variables is not. 70 * 71 * None of the members of a #PangoGlyphItemIter should be modified manually. 72 * 73 * Since: 1.22 74 */ 75 public class PgGlyphItemIter 76 { 77 /** the main Gtk struct */ 78 protected PangoGlyphItemIter* pangoGlyphItemIter; 79 80 /** Get the main Gtk struct */ 81 public PangoGlyphItemIter* getPgGlyphItemIterStruct() 82 { 83 return pangoGlyphItemIter; 84 } 85 86 /** the main Gtk struct as a void* */ 87 protected void* getStruct() 88 { 89 return cast(void*)pangoGlyphItemIter; 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class. 94 */ 95 public this (PangoGlyphItemIter* pangoGlyphItemIter) 96 { 97 this.pangoGlyphItemIter = pangoGlyphItemIter; 98 } 99 100 /** 101 */ 102 103 public static GType getType() 104 { 105 return pango_glyph_item_iter_get_type(); 106 } 107 108 /** 109 * Make a shallow copy of an existing #PangoGlyphItemIter structure. 110 * 111 * Return: the newly allocated #PangoGlyphItemIter, which should 112 * be freed with pango_glyph_item_iter_free(), or %NULL 113 * if @orig was %NULL. 114 * 115 * Since: 1.22 116 */ 117 public PgGlyphItemIter copy() 118 { 119 auto p = pango_glyph_item_iter_copy(pangoGlyphItemIter); 120 121 if(p is null) 122 { 123 return null; 124 } 125 126 return ObjectG.getDObject!(PgGlyphItemIter)(cast(PangoGlyphItemIter*) p); 127 } 128 129 /** 130 * Frees a #PangoGlyphItemIter created by pango_glyph_item_iter_copy(). 131 * 132 * Since: 1.22 133 */ 134 public void free() 135 { 136 pango_glyph_item_iter_free(pangoGlyphItemIter); 137 } 138 139 /** 140 * Initializes a #PangoGlyphItemIter structure to point to the 141 * last cluster in a glyph item. 142 * See #PangoGlyphItemIter for details of cluster orders. 143 * 144 * Params: 145 * glyphItem = the glyph item to iterate over 146 * text = text corresponding to the glyph item 147 * 148 * Return: %FALSE if there are no clusters in the glyph item 149 * 150 * Since: 1.22 151 */ 152 public bool initEnd(PgGlyphItem glyphItem, string text) 153 { 154 return pango_glyph_item_iter_init_end(pangoGlyphItemIter, (glyphItem is null) ? null : glyphItem.getPgGlyphItemStruct(), Str.toStringz(text)) != 0; 155 } 156 157 /** 158 * Initializes a #PangoGlyphItemIter structure to point to the 159 * first cluster in a glyph item. 160 * See #PangoGlyphItemIter for details of cluster orders. 161 * 162 * Params: 163 * glyphItem = the glyph item to iterate over 164 * text = text corresponding to the glyph item 165 * 166 * Return: %FALSE if there are no clusters in the glyph item 167 * 168 * Since: 1.22 169 */ 170 public bool initStart(PgGlyphItem glyphItem, string text) 171 { 172 return pango_glyph_item_iter_init_start(pangoGlyphItemIter, (glyphItem is null) ? null : glyphItem.getPgGlyphItemStruct(), Str.toStringz(text)) != 0; 173 } 174 175 /** 176 * Advances the iterator to the next cluster in the glyph item. 177 * See #PangoGlyphItemIter for details of cluster orders. 178 * 179 * Return: %TRUE if the iterator was advanced, %FALSE if we were already on the 180 * last cluster. 181 * 182 * Since: 1.22 183 */ 184 public bool nextCluster() 185 { 186 return pango_glyph_item_iter_next_cluster(pangoGlyphItemIter) != 0; 187 } 188 189 /** 190 * Moves the iterator to the preceding cluster in the glyph item. 191 * See #PangoGlyphItemIter for details of cluster orders. 192 * 193 * Return: %TRUE if the iterator was moved, %FALSE if we were already on the 194 * first cluster. 195 * 196 * Since: 1.22 197 */ 198 public bool prevCluster() 199 { 200 return pango_glyph_item_iter_prev_cluster(pangoGlyphItemIter) != 0; 201 } 202 }