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 pango.PgFont;
30 private import pango.PgFontset;
31 private import pango.PgLanguage;
32 private import pango.c.functions;
33 public  import pango.c.types;
34 
35 
36 /**
37  * `PangoFontsetSimple` is a implementation of the abstract
38  * `PangoFontset` base class as an array of fonts.
39  * 
40  * When creating a `PangoFontsetSimple`, you have to provide
41  * the array of fonts that make up the fontset.
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 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (PangoFontsetSimple* pangoFontsetSimple, bool ownedRef = false)
66 	{
67 		this.pangoFontsetSimple = pangoFontsetSimple;
68 		super(cast(PangoFontset*)pangoFontsetSimple, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return pango_fontset_simple_get_type();
76 	}
77 
78 	/**
79 	 * Creates a new `PangoFontsetSimple` for the given language.
80 	 *
81 	 * Params:
82 	 *     language = a `PangoLanguage` tag
83 	 *
84 	 * Returns: the newly allocated `PangoFontsetSimple`, which should
85 	 *     be freed with g_object_unref().
86 	 *
87 	 * Throws: ConstructionException GTK+ fails to create the object.
88 	 */
89 	public this(PgLanguage language)
90 	{
91 		auto __p = pango_fontset_simple_new((language is null) ? null : language.getPgLanguageStruct());
92 
93 		if(__p is null)
94 		{
95 			throw new ConstructionException("null returned by new");
96 		}
97 
98 		this(cast(PangoFontsetSimple*) __p, true);
99 	}
100 
101 	/**
102 	 * Adds a font to the fontset.
103 	 *
104 	 * Params:
105 	 *     font = a `PangoFont`.
106 	 */
107 	public void append(PgFont font)
108 	{
109 		pango_fontset_simple_append(pangoFontsetSimple, (font is null) ? null : font.getPgFontStruct());
110 	}
111 
112 	/**
113 	 * Returns the number of fonts in the fontset.
114 	 *
115 	 * Returns: the size of @fontset.
116 	 */
117 	public int size()
118 	{
119 		return pango_fontset_simple_size(pangoFontsetSimple);
120 	}
121 }