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