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