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 atk.Registry; 26 27 private import atk.ObjectFactory; 28 private import gobject.ObjectG; 29 private import gtkc.atk; 30 public import gtkc.atktypes; 31 32 33 /** 34 * The AtkRegistry is normally used to create appropriate ATK "peers" 35 * for user interface components. Application developers usually need 36 * only interact with the AtkRegistry by associating appropriate ATK 37 * implementation classes with GObject classes via the 38 * atk_registry_set_factory_type call, passing the appropriate GType 39 * for application custom widget classes. 40 */ 41 public class Registry : ObjectG 42 { 43 /** the main Gtk struct */ 44 protected AtkRegistry* atkRegistry; 45 46 /** Get the main Gtk struct */ 47 public AtkRegistry* getRegistryStruct() 48 { 49 return atkRegistry; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)atkRegistry; 56 } 57 58 protected override void setStruct(GObject* obj) 59 { 60 atkRegistry = cast(AtkRegistry*)obj; 61 super.setStruct(obj); 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (AtkRegistry* atkRegistry, bool ownedRef = false) 68 { 69 this.atkRegistry = atkRegistry; 70 super(cast(GObject*)atkRegistry, ownedRef); 71 } 72 73 /** 74 */ 75 76 public static GType getType() 77 { 78 return atk_registry_get_type(); 79 } 80 81 /** 82 * Gets an #AtkObjectFactory appropriate for creating #AtkObjects 83 * appropriate for @type. 84 * 85 * Params: 86 * type = a #GType with which to look up the associated #AtkObjectFactory 87 * 88 * Return: an #AtkObjectFactory appropriate for creating 89 * #AtkObjects appropriate for @type. 90 */ 91 public ObjectFactory getFactory(GType type) 92 { 93 auto p = atk_registry_get_factory(atkRegistry, type); 94 95 if(p is null) 96 { 97 return null; 98 } 99 100 return ObjectG.getDObject!(ObjectFactory)(cast(AtkObjectFactory*) p); 101 } 102 103 /** 104 * Provides a #GType indicating the #AtkObjectFactory subclass 105 * associated with @type. 106 * 107 * Params: 108 * type = a #GType with which to look up the associated #AtkObjectFactory 109 * subclass 110 * 111 * Return: a #GType associated with type @type 112 */ 113 public GType getFactoryType(GType type) 114 { 115 return atk_registry_get_factory_type(atkRegistry, type); 116 } 117 118 /** 119 * Associate an #AtkObjectFactory subclass with a #GType. Note: 120 * The associated @factory_type will thereafter be responsible for 121 * the creation of new #AtkObject implementations for instances 122 * appropriate for @type. 123 * 124 * Params: 125 * type = an #AtkObject type 126 * factoryType = an #AtkObjectFactory type to associate with @type. Must 127 * implement AtkObject appropriate for @type. 128 */ 129 public void setFactoryType(GType type, GType factoryType) 130 { 131 atk_registry_set_factory_type(atkRegistry, type, factoryType); 132 } 133 134 /** 135 * Gets a default implementation of the #AtkObjectFactory/type 136 * registry. 137 * Note: For most toolkit maintainers, this will be the correct 138 * registry for registering new #AtkObject factories. Following 139 * a call to this function, maintainers may call atk_registry_set_factory_type() 140 * to associate an #AtkObjectFactory subclass with the GType of objects 141 * for whom accessibility information will be provided. 142 * 143 * Return: a default implementation of the 144 * #AtkObjectFactory/type registry 145 */ 146 public static Registry getDefaultRegistry() 147 { 148 auto p = atk_get_default_registry(); 149 150 if(p is null) 151 { 152 return null; 153 } 154 155 return ObjectG.getDObject!(Registry)(cast(AtkRegistry*) p, true); 156 } 157 }