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 66 private import glib.Str; 67 private import gobject.TypeModule; 68 private import pango.PgEngine; 69 70 71 72 private import gobject.ObjectG; 73 74 /** 75 * Description 76 * Pango utilizes a module architecture in which the language-specific 77 * and render-system-specific components are provided by loadable 78 * modules. Each loadable module supplies one or more 79 * engines. Each engine 80 * has an associated engine type and 81 * render type. These two types are represented by 82 * strings. 83 * Each dynamically-loaded module exports several functions which provide 84 * the public API. These functions are script_engine_list(), 85 * script_engine_init() and script_engine_exit, and 86 * script_engine_create(). The latter three functions are used when 87 * creating engines from the module at run time, while the first 88 * function is used when building a catalog of all available modules. 89 */ 90 public class PgEngine : ObjectG 91 { 92 93 /** the main Gtk struct */ 94 protected PangoEngine* pangoEngine; 95 96 97 public PangoEngine* getPgEngineStruct() 98 { 99 return pangoEngine; 100 } 101 102 103 /** the main Gtk struct as a void* */ 104 protected override void* getStruct() 105 { 106 return cast(void*)pangoEngine; 107 } 108 109 /** 110 * Sets our main struct and passes it to the parent class 111 */ 112 public this (PangoEngine* pangoEngine) 113 { 114 super(cast(GObject*)pangoEngine); 115 this.pangoEngine = pangoEngine; 116 } 117 118 protected override void setStruct(GObject* obj) 119 { 120 super.setStruct(obj); 121 pangoEngine = cast(PangoEngine*)obj; 122 } 123 124 /** 125 */ 126 127 /** 128 * Function to be provided by a module to list the engines that the 129 * module supplies. The function stores a pointer to an array 130 * of PangoEngineInfo structures and the length of that array in 131 * the given location. 132 * Note that script_engine_init() will not be called before this 133 * function. 134 * Params: 135 * engines = location to store a pointer to an array of engines. 136 */ 137 public static void list(out PangoEngineInfo[] engines) 138 { 139 // void script_engine_list (PangoEngineInfo **engines, int *n_engines); 140 PangoEngineInfo* outengines = null; 141 int nEngines; 142 143 script_engine_list(&outengines, &nEngines); 144 145 engines = outengines[0 .. nEngines]; 146 } 147 148 /** 149 * Function to be provided by a module to register any 150 * GObject types in the module. 151 */ 152 public static void init(TypeModule modul) 153 { 154 // void script_engine_init (GTypeModule *module); 155 script_engine_init((modul is null) ? null : modul.getTypeModuleStruct()); 156 } 157 158 /** 159 * Function to be provided by the module that is called 160 * when the module is unloading. Frequently does nothing. 161 */ 162 public static void exit() 163 { 164 // void script_engine_exit (void); 165 script_engine_exit(); 166 } 167 168 /** 169 * Function to be provided by the module to create an instance 170 * of one of the engines implemented by the module. 171 * Params: 172 * id = the ID of an engine as reported by script_engine_list. 173 * 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.) 174 */ 175 public static PgEngine create(string id) 176 { 177 // PangoEngine * script_engine_create (const char *id); 178 auto p = script_engine_create(Str.toStringz(id)); 179 180 if(p is null) 181 { 182 return null; 183 } 184 185 return ObjectG.getDObject!(PgEngine)(cast(PangoEngine*) p); 186 } 187 }