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