PageRenderTime 3537ms CodeModel.GetById 23ms RepoModel.GetById 2ms app.codeStats 0ms

/generated/gtkd/pango/PgItem.d

http://github.com/gtkd-developers/GtkD
D | 215 lines | 101 code | 30 blank | 84 comment | 6 complexity | b71cf6f6900f035f3d0c6d0b1b0cd1ed MD5 | raw file
Possible License(s): LGPL-3.0
  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. // generated automatically - do not change
  20. // find conversion definition on APILookup.txt
  21. // implement new conversion functionalities on the wrap.utils pakage
  22. module pango.PgItem;
  23. private import glib.ConstructionException;
  24. private import glib.MemorySlice;
  25. private import gobject.ObjectG;
  26. public import gtkc.pangotypes;
  27. private import gtkd.Loader;
  28. private import pango.c.functions;
  29. public import pango.c.types;
  30. /**
  31. * The #PangoItem structure stores information about a segment of text.
  32. */
  33. public final class PgItem
  34. {
  35. /** the main Gtk struct */
  36. protected PangoItem* pangoItem;
  37. protected bool ownedRef;
  38. /** Get the main Gtk struct */
  39. public PangoItem* getPgItemStruct(bool transferOwnership = false)
  40. {
  41. if (transferOwnership)
  42. ownedRef = false;
  43. return pangoItem;
  44. }
  45. /** the main Gtk struct as a void* */
  46. protected void* getStruct()
  47. {
  48. return cast(void*)pangoItem;
  49. }
  50. /**
  51. * Sets our main struct and passes it to the parent class.
  52. */
  53. public this (PangoItem* pangoItem, bool ownedRef = false)
  54. {
  55. this.pangoItem = pangoItem;
  56. this.ownedRef = ownedRef;
  57. }
  58. ~this ()
  59. {
  60. if ( Linker.isLoaded(LIBRARY_PANGO) && ownedRef )
  61. pango_item_free(pangoItem);
  62. }
  63. /**
  64. * byte offset of the start of this item in text.
  65. */
  66. public @property int offset()
  67. {
  68. return pangoItem.offset;
  69. }
  70. /** Ditto */
  71. public @property void offset(int value)
  72. {
  73. pangoItem.offset = value;
  74. }
  75. /**
  76. * length of this item in bytes.
  77. */
  78. public @property int length()
  79. {
  80. return pangoItem.length;
  81. }
  82. /** Ditto */
  83. public @property void length(int value)
  84. {
  85. pangoItem.length = value;
  86. }
  87. /**
  88. * number of Unicode characters in the item.
  89. */
  90. public @property int numChars()
  91. {
  92. return pangoItem.numChars;
  93. }
  94. /** Ditto */
  95. public @property void numChars(int value)
  96. {
  97. pangoItem.numChars = value;
  98. }
  99. /**
  100. * analysis results for the item.
  101. */
  102. public @property PangoAnalysis analysis()
  103. {
  104. return pangoItem.analysis;
  105. }
  106. /** Ditto */
  107. public @property void analysis(PangoAnalysis value)
  108. {
  109. pangoItem.analysis = value;
  110. }
  111. /** */
  112. public static GType getType()
  113. {
  114. return pango_item_get_type();
  115. }
  116. /**
  117. * Creates a new #PangoItem structure initialized to default values.
  118. *
  119. * Returns: the newly allocated #PangoItem, which should
  120. * be freed with pango_item_free().
  121. *
  122. * Throws: ConstructionException GTK+ fails to create the object.
  123. */
  124. public this()
  125. {
  126. auto p = pango_item_new();
  127. if(p is null)
  128. {
  129. throw new ConstructionException("null returned by new");
  130. }
  131. this(cast(PangoItem*) p);
  132. }
  133. /**
  134. * Copy an existing #PangoItem structure.
  135. *
  136. * Returns: the newly allocated #PangoItem, which
  137. * should be freed with pango_item_free(), or %NULL if
  138. * @item was %NULL.
  139. */
  140. public PgItem copy()
  141. {
  142. auto p = pango_item_copy(pangoItem);
  143. if(p is null)
  144. {
  145. return null;
  146. }
  147. return ObjectG.getDObject!(PgItem)(cast(PangoItem*) p, true);
  148. }
  149. /**
  150. * Free a #PangoItem and all associated memory.
  151. */
  152. public void free()
  153. {
  154. pango_item_free(pangoItem);
  155. ownedRef = false;
  156. }
  157. /**
  158. * Modifies @orig to cover only the text after @split_index, and
  159. * returns a new item that covers the text before @split_index that
  160. * used to be in @orig. You can think of @split_index as the length of
  161. * the returned item. @split_index may not be 0, and it may not be
  162. * greater than or equal to the length of @orig (that is, there must
  163. * be at least one byte assigned to each item, you can't create a
  164. * zero-length item). @split_offset is the length of the first item in
  165. * chars, and must be provided because the text used to generate the
  166. * item isn't available, so pango_item_split() can't count the char
  167. * length of the split items itself.
  168. *
  169. * Params:
  170. * splitIndex = byte index of position to split item, relative to the start of the item
  171. * splitOffset = number of chars between start of @orig and @split_index
  172. *
  173. * Returns: new item representing text before @split_index, which
  174. * should be freed with pango_item_free().
  175. */
  176. public PgItem split(int splitIndex, int splitOffset)
  177. {
  178. auto p = pango_item_split(pangoItem, splitIndex, splitOffset);
  179. if(p is null)
  180. {
  181. return null;
  182. }
  183. return ObjectG.getDObject!(PgItem)(cast(PangoItem*) p, true);
  184. }
  185. }