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.PgFontsetSimple;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 public  import gtkc.pangotypes;
30 private import pango.PgFont;
31 private import pango.PgFontset;
32 private import pango.PgLanguage;
33 private import pango.c.functions;
34 public  import pango.c.types;
35 
36 
37 /**
38  * #PangoFontsetSimple is a implementation of the abstract
39  * #PangoFontset base class in terms of an array of fonts,
40  * which the creator provides when constructing the
41  * #PangoFontsetSimple.
42  */
43 public class PgFontsetSimple : PgFontset
44 {
45 	/** the main Gtk struct */
46 	protected PangoFontsetSimple* pangoFontsetSimple;
47 
48 	/** Get the main Gtk struct */
49 	public PangoFontsetSimple* getPgFontsetSimpleStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return pangoFontsetSimple;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected override void* getStruct()
58 	{
59 		return cast(void*)pangoFontsetSimple;
60 	}
61 
62 	protected override void setStruct(GObject* obj)
63 	{
64 		pangoFontsetSimple = cast(PangoFontsetSimple*)obj;
65 		super.setStruct(obj);
66 	}
67 
68 	/**
69 	 * Sets our main struct and passes it to the parent class.
70 	 */
71 	public this (PangoFontsetSimple* pangoFontsetSimple, bool ownedRef = false)
72 	{
73 		this.pangoFontsetSimple = pangoFontsetSimple;
74 		super(cast(PangoFontset*)pangoFontsetSimple, ownedRef);
75 	}
76 
77 
78 	/** */
79 	public static GType getType()
80 	{
81 		return pango_fontset_simple_get_type();
82 	}
83 
84 	/**
85 	 * Creates a new #PangoFontsetSimple for the given language.
86 	 *
87 	 * Params:
88 	 *     language = a #PangoLanguage tag
89 	 *
90 	 * Returns: the newly allocated #PangoFontsetSimple, which should
91 	 *     be freed with g_object_unref().
92 	 *
93 	 * Throws: ConstructionException GTK+ fails to create the object.
94 	 */
95 	public this(PgLanguage language)
96 	{
97 		auto p = pango_fontset_simple_new((language is null) ? null : language.getPgLanguageStruct());
98 
99 		if(p is null)
100 		{
101 			throw new ConstructionException("null returned by new");
102 		}
103 
104 		this(cast(PangoFontsetSimple*) p, true);
105 	}
106 
107 	/**
108 	 * Adds a font to the fontset.
109 	 *
110 	 * Params:
111 	 *     font = a #PangoFont.
112 	 */
113 	public void append(PgFont font)
114 	{
115 		pango_fontset_simple_append(pangoFontsetSimple, (font is null) ? null : font.getPgFontStruct());
116 	}
117 
118 	/**
119 	 * Returns the number of fonts in the fontset.
120 	 *
121 	 * Returns: the size of @fontset.
122 	 */
123 	public int size()
124 	{
125 		return pango_fontset_simple_size(pangoFontsetSimple);
126 	}
127 }