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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gobject
28  * outFile = ParamSpecPool
29  * strct   = GParamSpecPool
30  * realStrct=
31  * ctorStrct=
32  * clss    = ParamSpecPool
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_param_spec_pool_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gobject.ParamSpec
48  * 	- glib.ListG
49  * structWrap:
50  * 	- GList* -> ListG
51  * 	- GParamSpec* -> ParamSpec
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gobject.ParamSpecPool;
58 
59 public  import gtkc.gobjecttypes;
60 
61 private import gtkc.gobject;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 private import glib.Str;
66 private import gobject.ParamSpec;
67 private import glib.ListG;
68 
69 
70 
71 /**
72  * GParamSpec is an object structure that encapsulates the metadata
73  * required to specify parameters, such as e.g. GObject properties.
74  *
75  * Parameter names need to start with a letter (a-z or A-Z). Subsequent
76  * characters can be letters, numbers or a '-'.
77  * All other characters are replaced by a '-' during construction.
78  * The result of this replacement is called the canonical name of the
79  * parameter.
80  */
81 public class ParamSpecPool
82 {
83 	
84 	/** the main Gtk struct */
85 	protected GParamSpecPool* gParamSpecPool;
86 	
87 	
88 	/** Get the main Gtk struct */
89 	public GParamSpecPool* getParamSpecPoolStruct()
90 	{
91 		return gParamSpecPool;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected void* getStruct()
97 	{
98 		return cast(void*)gParamSpecPool;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GParamSpecPool* gParamSpecPool)
105 	{
106 		this.gParamSpecPool = gParamSpecPool;
107 	}
108 	
109 	/**
110 	 */
111 	
112 	/**
113 	 * Creates a new GParamSpecPool.
114 	 * If type_prefixing is TRUE, lookups in the newly created pool will
115 	 * allow to specify the owner as a colon-separated prefix of the
116 	 * property name, like "GtkContainer:border-width". This feature is
117 	 * deprecated, so you should always set type_prefixing to FALSE.
118 	 * Params:
119 	 * typePrefixing = Whether the pool will support type-prefixed property names.
120 	 * Throws: ConstructionException GTK+ fails to create the object.
121 	 */
122 	public this (int typePrefixing)
123 	{
124 		// GParamSpecPool * g_param_spec_pool_new (gboolean type_prefixing);
125 		auto p = g_param_spec_pool_new(typePrefixing);
126 		if(p is null)
127 		{
128 			throw new ConstructionException("null returned by g_param_spec_pool_new(typePrefixing)");
129 		}
130 		this(cast(GParamSpecPool*) p);
131 	}
132 	
133 	/**
134 	 * Inserts a GParamSpec in the pool.
135 	 * Params:
136 	 * pspec = the GParamSpec to insert
137 	 * ownerType = a GType identifying the owner of pspec
138 	 */
139 	public void insert(ParamSpec pspec, GType ownerType)
140 	{
141 		// void g_param_spec_pool_insert (GParamSpecPool *pool,  GParamSpec *pspec,  GType owner_type);
142 		g_param_spec_pool_insert(gParamSpecPool, (pspec is null) ? null : pspec.getParamSpecStruct(), ownerType);
143 	}
144 	
145 	/**
146 	 * Removes a GParamSpec from the pool.
147 	 * Params:
148 	 * pspec = the GParamSpec to remove
149 	 */
150 	public void remove(ParamSpec pspec)
151 	{
152 		// void g_param_spec_pool_remove (GParamSpecPool *pool,  GParamSpec *pspec);
153 		g_param_spec_pool_remove(gParamSpecPool, (pspec is null) ? null : pspec.getParamSpecStruct());
154 	}
155 	
156 	/**
157 	 * Looks up a GParamSpec in the pool.
158 	 * Params:
159 	 * paramName = the name to look for
160 	 * ownerType = the owner to look for
161 	 * walkAncestors = If TRUE, also try to find a GParamSpec with param_name
162 	 * owned by an ancestor of owner_type.
163 	 * Returns: The found GParamSpec, or NULL if no matching GParamSpec was found. [transfer none]
164 	 */
165 	public ParamSpec lookup(string paramName, GType ownerType, int walkAncestors)
166 	{
167 		// GParamSpec * g_param_spec_pool_lookup (GParamSpecPool *pool,  const gchar *param_name,  GType owner_type,  gboolean walk_ancestors);
168 		auto p = g_param_spec_pool_lookup(gParamSpecPool, Str.toStringz(paramName), ownerType, walkAncestors);
169 		
170 		if(p is null)
171 		{
172 			return null;
173 		}
174 		
175 		return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p);
176 	}
177 	
178 	/**
179 	 * Gets an array of all GParamSpecs owned by owner_type in
180 	 * the pool.
181 	 * Params:
182 	 * ownerType = the owner to look for
183 	 * Returns: a newly allocated array containing pointers to all GParamSpecs owned by owner_type in the pool. [array length=n_pspecs_p][transfer container]
184 	 */
185 	public ParamSpec[] list(GType ownerType)
186 	{
187 		// GParamSpec ** g_param_spec_pool_list (GParamSpecPool *pool,  GType owner_type,  guint *n_pspecs_p);
188 		uint nPspecsP;
189 		auto p = g_param_spec_pool_list(gParamSpecPool, ownerType, &nPspecsP);
190 		
191 		if(p is null)
192 		{
193 			return null;
194 		}
195 		
196 		ParamSpec[] arr = new ParamSpec[nPspecsP];
197 		for(int i = 0; i < nPspecsP; i++)
198 		{
199 			arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]);
200 		}
201 		
202 		return arr;
203 	}
204 	
205 	/**
206 	 * Gets an GList of all GParamSpecs owned by owner_type in
207 	 * the pool.
208 	 * Params:
209 	 * ownerType = the owner to look for
210 	 * Returns: a GList of all GParamSpecs owned by owner_type in the poolGParamSpecs. [transfer container][element-type GObject.ParamSpec]
211 	 */
212 	public ListG listOwned(GType ownerType)
213 	{
214 		// GList * g_param_spec_pool_list_owned (GParamSpecPool *pool,  GType owner_type);
215 		auto p = g_param_spec_pool_list_owned(gParamSpecPool, ownerType);
216 		
217 		if(p is null)
218 		{
219 			return null;
220 		}
221 		
222 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
223 	}
224 }