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 public static GType getType() 76 { 77 return atk_registry_get_type(); 78 } 79 80 /** 81 * Gets an #AtkObjectFactory appropriate for creating #AtkObjects 82 * appropriate for @type. 83 * 84 * Params: 85 * type = a #GType with which to look up the associated #AtkObjectFactory 86 * 87 * Return: an #AtkObjectFactory appropriate for creating 88 * #AtkObjects appropriate for @type. 89 */ 90 public ObjectFactory getFactory(GType type) 91 { 92 auto p = atk_registry_get_factory(atkRegistry, type); 93 94 if(p is null) 95 { 96 return null; 97 } 98 99 return ObjectG.getDObject!(ObjectFactory)(cast(AtkObjectFactory*) p); 100 } 101 102 /** 103 * Provides a #GType indicating the #AtkObjectFactory subclass 104 * associated with @type. 105 * 106 * Params: 107 * type = a #GType with which to look up the associated #AtkObjectFactory 108 * subclass 109 * 110 * Return: a #GType associated with type @type 111 */ 112 public GType getFactoryType(GType type) 113 { 114 return atk_registry_get_factory_type(atkRegistry, type); 115 } 116 117 /** 118 * Associate an #AtkObjectFactory subclass with a #GType. Note: 119 * The associated @factory_type will thereafter be responsible for 120 * the creation of new #AtkObject implementations for instances 121 * appropriate for @type. 122 * 123 * Params: 124 * type = an #AtkObject type 125 * factoryType = an #AtkObjectFactory type to associate with @type. Must 126 * implement AtkObject appropriate for @type. 127 */ 128 public void setFactoryType(GType type, GType factoryType) 129 { 130 atk_registry_set_factory_type(atkRegistry, type, factoryType); 131 } 132 133 /** 134 * Gets a default implementation of the #AtkObjectFactory/type 135 * registry. 136 * Note: For most toolkit maintainers, this will be the correct 137 * registry for registering new #AtkObject factories. Following 138 * a call to this function, maintainers may call atk_registry_set_factory_type() 139 * to associate an #AtkObjectFactory subclass with the GType of objects 140 * for whom accessibility information will be provided. 141 * 142 * Return: a default implementation of the 143 * #AtkObjectFactory/type registry 144 */ 145 public static Registry getDefaultRegistry() 146 { 147 auto p = atk_get_default_registry(); 148 149 if(p is null) 150 { 151 return null; 152 } 153 154 return ObjectG.getDObject!(Registry)(cast(AtkRegistry*) p, true); 155 } 156 }