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 * Conversion parameters: 26 * inFile = pango-Engines.html 27 * outPack = pango 28 * outFile = PgEngine 29 * strct = PangoEngine 30 * realStrct= 31 * ctorStrct= 32 * clss = PgEngine 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - script_engine_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gobject.TypeModule 48 * - pango.PgEngine 49 * structWrap: 50 * - GTypeModule* -> TypeModule 51 * - PangoEngine* -> PgEngine 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module pango.PgEngine; 58 59 public import gtkc.pangotypes; 60 61 private import gtkc.pango; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import glib.Str; 66 private import gobject.TypeModule; 67 private import pango.PgEngine; 68 69 70 private import gobject.ObjectG; 71 72 /** 73 * Pango utilizes a module architecture in which the language-specific 74 * and render-system-specific components are provided by loadable 75 * modules. Each loadable module supplies one or more 76 * engines. Each engine 77 * has an associated engine type and 78 * render type. These two types are represented by 79 * strings. 80 * 81 * Each dynamically-loaded module exports several functions which provide 82 * the public API. These functions are script_engine_list(), 83 * script_engine_init() and script_engine_exit, and 84 * script_engine_create(). The latter three functions are used when 85 * creating engines from the module at run time, while the first 86 * function is used when building a catalog of all available modules. 87 */ 88 public class PgEngine : ObjectG 89 { 90 91 /** the main Gtk struct */ 92 protected PangoEngine* pangoEngine; 93 94 95 /** Get the main Gtk struct */ 96 public PangoEngine* getPgEngineStruct() 97 { 98 return pangoEngine; 99 } 100 101 102 /** the main Gtk struct as a void* */ 103 protected override void* getStruct() 104 { 105 return cast(void*)pangoEngine; 106 } 107 108 /** 109 * Sets our main struct and passes it to the parent class 110 */ 111 public this (PangoEngine* pangoEngine) 112 { 113 super(cast(GObject*)pangoEngine); 114 this.pangoEngine = pangoEngine; 115 } 116 117 protected override void setStruct(GObject* obj) 118 { 119 super.setStruct(obj); 120 pangoEngine = cast(PangoEngine*)obj; 121 } 122 123 /** 124 */ 125 126 /** 127 * Function to be provided by a module to list the engines that the 128 * module supplies. The function stores a pointer to an array 129 * of PangoEngineInfo structures and the length of that array in 130 * the given location. 131 * Note that script_engine_init() will not be called before this 132 * function. 133 * Params: 134 * engines = location to store a pointer to an array of engines. 135 */ 136 public static void list(out PangoEngineInfo[] engines) 137 { 138 // void script_engine_list (PangoEngineInfo **engines, int *n_engines); 139 PangoEngineInfo* outengines = null; 140 int nEngines; 141 142 script_engine_list(&outengines, &nEngines); 143 144 engines = outengines[0 .. nEngines]; 145 } 146 147 /** 148 * Function to be provided by a module to register any 149 * GObject types in the module. 150 */ 151 public static void init(TypeModule modul) 152 { 153 // void script_engine_init (GTypeModule *module); 154 script_engine_init((modul is null) ? null : modul.getTypeModuleStruct()); 155 } 156 157 /** 158 * Function to be provided by the module that is called 159 * when the module is unloading. Frequently does nothing. 160 */ 161 public static void exit() 162 { 163 // void script_engine_exit (void); 164 script_engine_exit(); 165 } 166 167 /** 168 * Function to be provided by the module to create an instance 169 * of one of the engines implemented by the module. 170 * Params: 171 * id = the ID of an engine as reported by script_engine_list. 172 * Returns: a newly created PangoEngine of the specified type, or NULL if an error occurred. (In normal operation, a module should not return NULL. A NULL return is only acceptable in the case where system misconfiguration or bugs in the driver routine are encountered.) 173 */ 174 public static PgEngine create(string id) 175 { 176 // PangoEngine * script_engine_create (const char *id); 177 auto p = script_engine_create(Str.toStringz(id)); 178 179 if(p is null) 180 { 181 return null; 182 } 183 184 return ObjectG.getDObject!(PgEngine)(cast(PangoEngine*) p); 185 } 186 }