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.PgItem; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtkc.pango; 30 public import gtkc.pangotypes; 31 32 33 /** 34 * The #PangoItem structure stores information about a segment of text. 35 */ 36 public class PgItem 37 { 38 /** the main Gtk struct */ 39 protected PangoItem* pangoItem; 40 41 /** Get the main Gtk struct */ 42 public PangoItem* getPgItemStruct() 43 { 44 return pangoItem; 45 } 46 47 /** the main Gtk struct as a void* */ 48 protected void* getStruct() 49 { 50 return cast(void*)pangoItem; 51 } 52 53 /** 54 * Sets our main struct and passes it to the parent class. 55 */ 56 public this (PangoItem* pangoItem) 57 { 58 this.pangoItem = pangoItem; 59 } 60 61 /** 62 */ 63 64 public static GType getType() 65 { 66 return pango_item_get_type(); 67 } 68 69 /** 70 * Creates a new #PangoItem structure initialized to default values. 71 * 72 * Return: the newly allocated #PangoItem, which should 73 * be freed with pango_item_free(). 74 * 75 * Throws: ConstructionException GTK+ fails to create the object. 76 */ 77 public this() 78 { 79 auto p = pango_item_new(); 80 81 if(p is null) 82 { 83 throw new ConstructionException("null returned by new"); 84 } 85 86 this(cast(PangoItem*) p); 87 } 88 89 /** 90 * Copy an existing #PangoItem structure. 91 * 92 * Return: the newly allocated #PangoItem, which should 93 * be freed with pango_item_free(), or %NULL if 94 * @item was NULL. 95 */ 96 public PgItem copy() 97 { 98 auto p = pango_item_copy(pangoItem); 99 100 if(p is null) 101 { 102 return null; 103 } 104 105 return ObjectG.getDObject!(PgItem)(cast(PangoItem*) p); 106 } 107 108 /** 109 * Free a #PangoItem and all associated memory. 110 */ 111 public void free() 112 { 113 pango_item_free(pangoItem); 114 } 115 116 /** 117 * Modifies @orig to cover only the text after @split_index, and 118 * returns a new item that covers the text before @split_index that 119 * used to be in @orig. You can think of @split_index as the length of 120 * the returned item. @split_index may not be 0, and it may not be 121 * greater than or equal to the length of @orig (that is, there must 122 * be at least one byte assigned to each item, you can't create a 123 * zero-length item). @split_offset is the length of the first item in 124 * chars, and must be provided because the text used to generate the 125 * item isn't available, so pango_item_split() can't count the char 126 * length of the split items itself. 127 * 128 * Params: 129 * splitIndex = byte index of position to split item, relative to the start of the item 130 * splitOffset = number of chars between start of @orig and @split_index 131 * 132 * Return: new item representing text before @split_index, which 133 * should be freed with pango_item_free(). 134 */ 135 public PgItem split(int splitIndex, int splitOffset) 136 { 137 auto p = pango_item_split(pangoItem, splitIndex, splitOffset); 138 139 if(p is null) 140 { 141 return null; 142 } 143 144 return ObjectG.getDObject!(PgItem)(cast(PangoItem*) p); 145 } 146 }