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.PgAttributeShape; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 public import gtkc.pangotypes; 30 private import pango.PgAttribute; 31 private import pango.c.functions; 32 public import pango.c.types; 33 34 35 /** 36 * The #PangoAttrShape structure is used to represent attributes which 37 * impose shape restrictions. 38 */ 39 public class PgAttributeShape : PgAttribute 40 { 41 /** the main Gtk struct */ 42 protected PangoAttrShape* pangoAttrShape; 43 44 /** Get the main Gtk struct */ 45 public PangoAttrShape* getPgAttributeShapeStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return pangoAttrShape; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)pangoAttrShape; 56 } 57 58 protected override void setStruct(GObject* obj) 59 { 60 pangoAttrShape = cast(PangoAttrShape*)obj; 61 super.setStruct(obj); 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (PangoAttrShape* pangoAttrShape, bool ownedRef = false) 68 { 69 this.pangoAttrShape = pangoAttrShape; 70 super(cast(PangoAttribute*)pangoAttrShape, ownedRef); 71 } 72 73 74 /** 75 * Create a new shape attribute. A shape is used to impose a 76 * particular ink and logical rectangle on the result of shaping a 77 * particular glyph. This might be used, for instance, for 78 * embedding a picture or a widget inside a #PangoLayout. 79 * 80 * Params: 81 * inkRect = ink rectangle to assign to each character 82 * logicalRect = logical rectangle to assign to each character 83 * 84 * Returns: the newly allocated #PangoAttribute, 85 * which should be freed with pango_attribute_destroy(). 86 * 87 * Throws: ConstructionException GTK+ fails to create the object. 88 */ 89 public this(PangoRectangle* inkRect, PangoRectangle* logicalRect) 90 { 91 auto p = pango_attr_shape_new(inkRect, logicalRect); 92 93 if(p is null) 94 { 95 throw new ConstructionException("null returned by new"); 96 } 97 98 this(cast(PangoAttrShape*) p); 99 } 100 101 /** 102 * Like pango_attr_shape_new(), but a user data pointer is also 103 * provided; this pointer can be accessed when later 104 * rendering the glyph. 105 * 106 * Params: 107 * inkRect = ink rectangle to assign to each character 108 * logicalRect = logical rectangle to assign to each character 109 * data = user data pointer 110 * copyFunc = function to copy @data when the 111 * attribute is copied. If %NULL, @data is simply 112 * copied as a pointer. 113 * destroyFunc = function to free @data when the 114 * attribute is freed, or %NULL 115 * 116 * Returns: the newly allocated #PangoAttribute, which should be 117 * freed with pango_attribute_destroy(). 118 * 119 * Since: 1.8 120 * 121 * Throws: ConstructionException GTK+ fails to create the object. 122 */ 123 public this(PangoRectangle* inkRect, PangoRectangle* logicalRect, void* data, PangoAttrDataCopyFunc copyFunc, GDestroyNotify destroyFunc) 124 { 125 auto p = pango_attr_shape_new_with_data(inkRect, logicalRect, data, copyFunc, destroyFunc); 126 127 if(p is null) 128 { 129 throw new ConstructionException("null returned by new_with_data"); 130 } 131 132 this(cast(PangoAttrShape*) p); 133 } 134 }