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