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 * Conversion parameters: 26 * inFile = 27 * outPack = pango 28 * outFile = PgAttributeList 29 * strct = PangoAttrList 30 * realStrct= 31 * ctorStrct= 32 * clss = PgAttributeList 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_attr_list_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - pango.PgAttribute 47 * - pango.PgAttributeIterator 48 * structWrap: 49 * - PangoAttrIterator* -> PgAttributeIterator 50 * - PangoAttrList* -> PgAttributeList 51 * - PangoAttribute* -> PgAttribute 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module pango.PgAttributeList; 58 59 public import gtkc.pangotypes; 60 61 private import gtkc.pango; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import pango.PgAttribute; 66 private import pango.PgAttributeIterator; 67 68 69 70 /** 71 * Attributed text is used in a number of places in Pango. It 72 * is used as the input to the itemization process and also when 73 * creating a PangoLayout. The data types and functions in 74 * this section are used to represent and manipulate sets 75 * of attributes applied to a portion of text. 76 */ 77 public class PgAttributeList 78 { 79 80 /** the main Gtk struct */ 81 protected PangoAttrList* pangoAttrList; 82 83 84 /** Get the main Gtk struct */ 85 public PangoAttrList* getPgAttributeListStruct() 86 { 87 return pangoAttrList; 88 } 89 90 91 /** the main Gtk struct as a void* */ 92 protected void* getStruct() 93 { 94 return cast(void*)pangoAttrList; 95 } 96 97 /** 98 * Sets our main struct and passes it to the parent class 99 */ 100 public this (PangoAttrList* pangoAttrList) 101 { 102 this.pangoAttrList = pangoAttrList; 103 } 104 105 /** 106 */ 107 108 /** 109 * Create a new empty attribute list with a reference count of one. 110 * Throws: ConstructionException GTK+ fails to create the object. 111 */ 112 public this () 113 { 114 // PangoAttrList * pango_attr_list_new (void); 115 auto p = pango_attr_list_new(); 116 if(p is null) 117 { 118 throw new ConstructionException("null returned by pango_attr_list_new()"); 119 } 120 this(cast(PangoAttrList*) p); 121 } 122 123 /** 124 * Increase the reference count of the given attribute list by one. 125 * Since 1.10 126 * Returns: The attribute list passed in 127 */ 128 public PgAttributeList doref() 129 { 130 // PangoAttrList * pango_attr_list_ref (PangoAttrList *list); 131 auto p = pango_attr_list_ref(pangoAttrList); 132 133 if(p is null) 134 { 135 return null; 136 } 137 138 return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p); 139 } 140 141 /** 142 * Decrease the reference count of the given attribute list by one. 143 * If the result is zero, free the attribute list and the attributes 144 * it contains. 145 */ 146 public void unref() 147 { 148 // void pango_attr_list_unref (PangoAttrList *list); 149 pango_attr_list_unref(pangoAttrList); 150 } 151 152 /** 153 * Copy list and return an identical new list. 154 * Returns: the newly allocated PangoAttrList, with a reference count of one, which should be freed with pango_attr_list_unref(). Returns NULL if list was NULL. 155 */ 156 public PgAttributeList copy() 157 { 158 // PangoAttrList * pango_attr_list_copy (PangoAttrList *list); 159 auto p = pango_attr_list_copy(pangoAttrList); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p); 167 } 168 169 /** 170 * Insert the given attribute into the PangoAttrList. It will 171 * be inserted after all other attributes with a matching 172 * start_index. 173 * Params: 174 * attr = the attribute to insert. Ownership of this 175 * value is assumed by the list. [transfer full] 176 */ 177 public void insert(PgAttribute attr) 178 { 179 // void pango_attr_list_insert (PangoAttrList *list, PangoAttribute *attr); 180 pango_attr_list_insert(pangoAttrList, (attr is null) ? null : attr.getPgAttributeStruct()); 181 } 182 183 /** 184 * Insert the given attribute into the PangoAttrList. It will 185 * be inserted before all other attributes with a matching 186 * start_index. 187 * Params: 188 * attr = the attribute to insert. Ownership of this 189 * value is assumed by the list. [transfer full] 190 */ 191 public void insertBefore(PgAttribute attr) 192 { 193 // void pango_attr_list_insert_before (PangoAttrList *list, PangoAttribute *attr); 194 pango_attr_list_insert_before(pangoAttrList, (attr is null) ? null : attr.getPgAttributeStruct()); 195 } 196 197 /** 198 * Insert the given attribute into the PangoAttrList. It will 199 * replace any attributes of the same type on that segment 200 * and be merged with any adjoining attributes that are identical. 201 * This function is slower than pango_attr_list_insert() for 202 * creating a attribute list in order (potentially much slower 203 * for large lists). However, pango_attr_list_insert() is not 204 * suitable for continually changing a set of attributes 205 * since it never removes or combines existing attributes. 206 * Params: 207 * attr = the attribute to insert. Ownership of this 208 * value is assumed by the list. [transfer full] 209 */ 210 public void change(PgAttribute attr) 211 { 212 // void pango_attr_list_change (PangoAttrList *list, PangoAttribute *attr); 213 pango_attr_list_change(pangoAttrList, (attr is null) ? null : attr.getPgAttributeStruct()); 214 } 215 216 /** 217 * This function opens up a hole in list, fills it in with attributes from 218 * the left, and then merges other on top of the hole. 219 * This operation is equivalent to stretching every attribute 220 * that applies at position pos in list by an amount len, 221 * and then calling pango_attr_list_change() with a copy 222 * of each attribute in other in sequence (offset in position by pos). 223 * This operation proves useful for, for instance, inserting 224 * a pre-edit string in the middle of an edit buffer. 225 * Params: 226 * other = another PangoAttrList 227 * pos = the position in list at which to insert other 228 * len = the length of the spliced segment. (Note that this 229 * must be specified since the attributes in other 230 * may only be present at some subsection of this range) 231 */ 232 public void splice(PgAttributeList other, int pos, int len) 233 { 234 // void pango_attr_list_splice (PangoAttrList *list, PangoAttrList *other, gint pos, gint len); 235 pango_attr_list_splice(pangoAttrList, (other is null) ? null : other.getPgAttributeListStruct(), pos, len); 236 } 237 238 /** 239 * Given a PangoAttrList and callback function, removes any elements 240 * of list for which func returns TRUE and inserts them into 241 * a new list. 242 * Since 1.2 243 * Params: 244 * func = callback function; returns TRUE 245 * if an attribute should be filtered out. [scope call][closure data] 246 * data = Data to be passed to func. [closure] 247 * Returns: the new PangoAttrList or NULL if no attributes of the given types were found. [transfer full] 248 */ 249 public PgAttributeList filter(PangoAttrFilterFunc func, void* data) 250 { 251 // PangoAttrList * pango_attr_list_filter (PangoAttrList *list, PangoAttrFilterFunc func, gpointer data); 252 auto p = pango_attr_list_filter(pangoAttrList, func, data); 253 254 if(p is null) 255 { 256 return null; 257 } 258 259 return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p); 260 } 261 262 /** 263 * Create a iterator initialized to the beginning of the list. 264 * list must not be modified until this iterator is freed. 265 * Returns: the newly allocated PangoAttrIterator, which should be freed with pango_attr_iterator_destroy(). [transfer full] 266 */ 267 public PgAttributeIterator getIterator() 268 { 269 // PangoAttrIterator * pango_attr_list_get_iterator (PangoAttrList *list); 270 auto p = pango_attr_list_get_iterator(pangoAttrList); 271 272 if(p is null) 273 { 274 return null; 275 } 276 277 return ObjectG.getDObject!(PgAttributeIterator)(cast(PangoAttrIterator*) p); 278 } 279 }