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