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 	public static GType getType()
77 	{
78 		return pango_fontset_simple_get_type();
79 	}
80 
81 	/**
82 	 * Creates a new #PangoFontsetSimple for the given language.
83 	 *
84 	 * Params:
85 	 *     language = a #PangoLanguage tag
86 	 *
87 	 * Return: the newly allocated #PangoFontsetSimple, which should
88 	 *     be freed with g_object_unref().
89 	 *
90 	 * Throws: ConstructionException GTK+ fails to create the object.
91 	 */
92 	public this(PgLanguage language)
93 	{
94 		auto p = pango_fontset_simple_new((language is null) ? null : language.getPgLanguageStruct());
95 		
96 		if(p is null)
97 		{
98 			throw new ConstructionException("null returned by new");
99 		}
100 		
101 		this(cast(PangoFontsetSimple*) p, true);
102 	}
103 
104 	/**
105 	 * Adds a font to the fontset.
106 	 *
107 	 * Params:
108 	 *     font = a #PangoFont.
109 	 */
110 	public void append(PgFont font)
111 	{
112 		pango_fontset_simple_append(pangoFontsetSimple, (font is null) ? null : font.getPgFontStruct());
113 	}
114 
115 	/**
116 	 * Returns the number of fonts in the fontset.
117 	 *
118 	 * Return: the size of @fontset.
119 	 */
120 	public int size()
121 	{
122 		return pango_fontset_simple_size(pangoFontsetSimple);
123 	}
124 }