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