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