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