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.PgMap;
26 
27 private import glib.ListSG;
28 private import gobject.ObjectG;
29 private import gtkc.pango;
30 public  import gtkc.pangotypes;
31 private import pango.PgEngine;
32 private import pango.PgLanguage;
33 
34 
35 /**
36  * A #PangoMap structure can be used to determine the engine to
37  * use for each character.
38  */
39 public class PgMap
40 {
41 	/** the main Gtk struct */
42 	protected PangoMap* pangoMap;
43 
44 	/** Get the main Gtk struct */
45 	public PangoMap* getPgMapStruct()
46 	{
47 		return pangoMap;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected void* getStruct()
52 	{
53 		return cast(void*)pangoMap;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (PangoMap* pangoMap)
60 	{
61 		this.pangoMap = pangoMap;
62 	}
63 
64 	/**
65 	 */
66 
67 	/**
68 	 * Returns the best engine listed in the map for a given script
69 	 *
70 	 * Params:
71 	 *     script = a #PangoScript
72 	 *
73 	 * Return: the best engine, if one is listed for the script,
74 	 *     or %NULL. The lookup may cause the engine to be loaded;
75 	 *     once an engine is loaded, it won't be unloaded. If multiple
76 	 *     engines are exact for the script, the choice of which is
77 	 *     returned is arbitrary.
78 	 */
79 	public PgEngine getEngine(PangoScript script)
80 	{
81 		auto p = pango_map_get_engine(pangoMap, script);
82 		
83 		if(p is null)
84 		{
85 			return null;
86 		}
87 		
88 		return ObjectG.getDObject!(PgEngine)(cast(PangoEngine*) p);
89 	}
90 
91 	/**
92 	 * Finds engines in the map that handle the given script. The returned
93 	 * lists should be freed with g_slist_free, but the engines in the
94 	 * lists are owned by GLib and will be kept around permanently, so
95 	 * they should not be unref'ed.
96 	 *
97 	 * Params:
98 	 *     script = a #PangoScript
99 	 *     exactEngines = location to store list of engines that exactly
100 	 *         handle this script.
101 	 *     fallbackEngines = location to store list of engines that approximately
102 	 *         handle this script.
103 	 *
104 	 * Since: 1.4
105 	 */
106 	public void getEngines(PangoScript script, out ListSG exactEngines, out ListSG fallbackEngines)
107 	{
108 		GSList* outexactEngines = null;
109 		GSList* outfallbackEngines = null;
110 		
111 		pango_map_get_engines(pangoMap, script, &outexactEngines, &outfallbackEngines);
112 		
113 		exactEngines = new ListSG(outexactEngines);
114 		fallbackEngines = new ListSG(outfallbackEngines);
115 	}
116 
117 	/**
118 	 * Locate a #PangoMap for a particular engine type and render
119 	 * type. The resulting map can be used to determine the engine
120 	 * for each character.
121 	 *
122 	 * Params:
123 	 *     language = the language tag for which to find the map
124 	 *     engineTypeId = the engine type for the map to find
125 	 *     renderTypeId = the render type for the map to find
126 	 *
127 	 * Return: the suitable #PangoMap.
128 	 */
129 	public static PgMap findMap(PgLanguage language, uint engineTypeId, uint renderTypeId)
130 	{
131 		auto p = pango_find_map((language is null) ? null : language.getPgLanguageStruct(), engineTypeId, renderTypeId);
132 		
133 		if(p is null)
134 		{
135 			return null;
136 		}
137 		
138 		return ObjectG.getDObject!(PgMap)(cast(PangoMap*) p);
139 	}
140 
141 	/**
142 	 * Registers a statically linked module with Pango. The
143 	 * #PangoIncludedModule structure that is passed in contains the
144 	 * functions that would otherwise be loaded from a dynamically loaded
145 	 * module.
146 	 *
147 	 * Params:
148 	 *     modul = a #PangoIncludedModule
149 	 */
150 	public static void moduleRegister(PangoIncludedModule* modul)
151 	{
152 		pango_module_register(modul);
153 	}
154 }