1Glib::ParamSpec(3) User Contributed Perl Documentation Glib::ParamSpec(3)
2
3
4
6 Glib::ParamSpec - encapsulates metadate needed to specify parameters
7
9 Glib::ParamSpec encapsulates the metadata required to specify
10 parameters. You will see these most often when creating new
11 Glib::Object types; see "Glib::Type->register" and
12 Glib::Object::Subclass.
13
14 Parameter specifications allow you to provide limits for validation as
15 well as nicknames and blurbs to document the parameters. Blurbs show
16 up in reference documentation such as this page or the gtk+ C API
17 reference; i'm not really sure where the nicknames get used. The Perl
18 bindings for the most part ignore the difference between dashes and
19 underscores in the paramspec names, which typically find use as the
20 actual keys for object parameters.
21
22 It's worth noting that Glib offers various sizes of integer and
23 floating point values, while Perl really only deals with full integers
24 and double precision floating point values. The size distinction is
25 important for the underlying C libraries.
26
28 Glib::ParamSpec
29
31 paramspec = Glib::ParamSpec->IV ($name, $nick, $blurb, $minimum, $maximum,
32 $default_value, $flags)
33 • $name (string)
34
35 • $nick (string)
36
37 • $blurb (string)
38
39 • $minimum (integer)
40
41 • $maximum (integer)
42
43 • $default_value (integer)
44
45 • $flags (Glib::ParamFlags)
46
47 paramspec = Glib::ParamSpec->UV ($name, $nick, $blurb, $minimum, $maximum,
48 $default_value, $flags)
49 • $name (string)
50
51 • $nick (string)
52
53 • $blurb (string)
54
55 • $minimum (unsigned)
56
57 • $maximum (unsigned)
58
59 • $default_value (unsigned)
60
61 • $flags (Glib::ParamFlags)
62
63 string = $pspec->get_blurb
64 paramspec = Glib::ParamSpec->boolean ($name, $nick, $blurb, $default_value,
65 $flags)
66 • $name (string)
67
68 • $nick (string)
69
70 • $blurb (string)
71
72 • $default_value (boolean)
73
74 • $flags (Glib::ParamFlags)
75
76 paramspec = Glib::ParamSpec->boxed ($name, $nick, $blurb, $package, $flags)
77 • $name (string)
78
79 • $nick (string)
80
81 • $blurb (string)
82
83 • $package (string) name of the class, derived from Glib::Boxed, of
84 the objects this property will hold.
85
86 • $flags (Glib::ParamFlags)
87
88 paramspec = Glib::ParamSpec->char ($name, $nick, $blurb, $minimum,
89 $maximum, $default_value, $flags)
90 • $name (string)
91
92 • $nick (string)
93
94 • $blurb (string)
95
96 • $minimum (integer)
97
98 • $maximum (integer)
99
100 • $default_value (integer)
101
102 • $flags (Glib::ParamFlags)
103
104 scalar = $pspec->get_default_value
105 (This is the C level "g_param_value_set_default" function.)
106
107 Note that on a "Glib::Param::Unichar" the return is a single-char
108 string. This is the same as the constructor
109 "Glib::ParamSpec->unichar", but it's not the same as "Glib::Object"
110 "get_property" / "set_property", so an "ord()" conversion is needed if
111 passing the default value to a unichar "set_property".
112
113 paramspec = Glib::ParamSpec->double ($name, $nick, $blurb, $minimum,
114 $maximum, $default_value, $flags)
115 • $name (string)
116
117 • $nick (string)
118
119 • $blurb (string)
120
121 • $minimum (double)
122
123 • $maximum (double)
124
125 • $default_value (double)
126
127 • $flags (Glib::ParamFlags)
128
129 paramspec = Glib::ParamSpec->enum ($name, $nick, $blurb, $enum_type,
130 $default_value, $flags)
131 • $name (string)
132
133 • $nick (string)
134
135 • $blurb (string)
136
137 • $enum_type (string)
138
139 • $default_value (scalar)
140
141 • $flags (Glib::ParamFlags)
142
143 paramspec = Glib::ParamSpec->flags ($name, $nick, $blurb, $flags_type,
144 $default_value, $flags)
145 • $name (string)
146
147 • $nick (string)
148
149 • $blurb (string)
150
151 • $flags_type (string)
152
153 • $default_value (scalar)
154
155 • $flags (Glib::ParamFlags)
156
157 paramflags = $pspec->get_flags
158 paramspec = Glib::ParamSpec->float ($name, $nick, $blurb, $minimum,
159 $maximum, $default_value, $flags)
160 • $name (string)
161
162 • $nick (string)
163
164 • $blurb (string)
165
166 • $minimum (double)
167
168 • $maximum (double)
169
170 • $default_value (double)
171
172 • $flags (Glib::ParamFlags)
173
174 paramspec = Glib::ParamSpec->gtype ($name, $nick, $blurb, $is_a_type,
175 $flags)
176 • $name (string)
177
178 • $nick (string)
179
180 • $blurb (string)
181
182 • $is_a_type (string or undef) The name of a class whose subtypes are
183 allowed as values of the property. Use "undef" to allow any type.
184
185 • $flags (Glib::ParamFlags)
186
187 Since: glib 2.10
188
189 paramspec = Glib::ParamSpec->int ($name, $nick, $blurb, $minimum, $maximum,
190 $default_value, $flags)
191 • $name (string)
192
193 • $nick (string)
194
195 • $blurb (string)
196
197 • $minimum (integer)
198
199 • $maximum (integer)
200
201 • $default_value (integer)
202
203 • $flags (Glib::ParamFlags)
204
205 paramspec = Glib::ParamSpec->int64 ($name, $nick, $blurb, $minimum,
206 $maximum, $default_value, $flags)
207 • $name (string)
208
209 • $nick (string)
210
211 • $blurb (string)
212
213 • $minimum (64 bit integer)
214
215 • $maximum (64 bit integer)
216
217 • $default_value (64 bit integer)
218
219 • $flags (Glib::ParamFlags)
220
221 paramspec = Glib::ParamSpec->long ($name, $nick, $blurb, $minimum,
222 $maximum, $default_value, $flags)
223 • $name (string)
224
225 • $nick (string)
226
227 • $blurb (string)
228
229 • $minimum (integer)
230
231 • $maximum (integer)
232
233 • $default_value (integer)
234
235 • $flags (Glib::ParamFlags)
236
237 string = $paramspec->get_name
238 Dashes in the name are converted to underscores.
239
240 string = $pspec->get_nick
241 paramspec = Glib::ParamSpec->object ($name, $nick, $blurb, $package,
242 $flags)
243 • $name (string)
244
245 • $nick (string)
246
247 • $blurb (string)
248
249 • $package (string) name of the class, derived from Glib::Object, of
250 the objects this property will hold.
251
252 • $flags (Glib::ParamFlags)
253
254 paramspec = Glib::ParamSpec->override ($name, $overridden)
255 • $name (string)
256
257 • $overridden (Glib::ParamSpec)
258
259 Since: glib 2.4
260
261 string = $pspec->get_owner_type
262 paramspec = Glib::ParamSpec->param_spec ($name, $nick, $blurb, $package,
263 $flags)
264 • $name (string)
265
266 • $nick (string)
267
268 • $blurb (string)
269
270 • $package (string) name of the class, derived from Glib::ParamSpec,
271 of the objects this property will hold.
272
273 • $flags (Glib::ParamFlags)
274
275 paramspec or undef = $pspec->get_redirect_target
276 Since: glib 2.4
277
278 paramspec = Glib::ParamSpec->scalar ($name, $nick, $blurb, $flags)
279 • $name (string)
280
281 • $nick (string)
282
283 • $blurb (string)
284
285 • $flags (Glib::ParamFlags)
286
287 ParamSpec to be used for any generic perl scalar, including references
288 to complex objects.
289
290 Currently "Gtk2::Builder" cannot set object properties of this type
291 (there's no hooks for property value parsing, as of Gtk 2.20), so
292 prefer the builtin types if buildable support for an object matters. A
293 "boxed" of "Glib::Strv" can give an array of strings. A signal handler
294 callback can do most of what a coderef might.
295
296 paramspec = Glib::ParamSpec->string ($name, $nick, $blurb, $default_value,
297 $flags)
298 • $name (string)
299
300 • $nick (string)
301
302 • $blurb (string)
303
304 • $default_value (string or undef)
305
306 • $flags (Glib::ParamFlags)
307
308 paramspec = Glib::ParamSpec->uchar ($name, $nick, $blurb, $minimum,
309 $maximum, $default_value, $flags)
310 • $name (string)
311
312 • $nick (string)
313
314 • $blurb (string)
315
316 • $minimum (unsigned)
317
318 • $maximum (unsigned)
319
320 • $default_value (unsigned)
321
322 • $flags (Glib::ParamFlags)
323
324 paramspec = Glib::ParamSpec->uint ($name, $nick, $blurb, $minimum,
325 $maximum, $default_value, $flags)
326 • $name (string)
327
328 • $nick (string)
329
330 • $blurb (string)
331
332 • $minimum (unsigned)
333
334 • $maximum (unsigned)
335
336 • $default_value (unsigned)
337
338 • $flags (Glib::ParamFlags)
339
340 paramspec = Glib::ParamSpec->uint64 ($name, $nick, $blurb, $minimum,
341 $maximum, $default_value, $flags)
342 • $name (string)
343
344 • $nick (string)
345
346 • $blurb (string)
347
348 • $minimum (64 bit unsigned)
349
350 • $maximum (64 bit unsigned)
351
352 • $default_value (64 bit unsigned)
353
354 • $flags (Glib::ParamFlags)
355
356 paramspec = Glib::ParamSpec->ulong ($name, $nick, $blurb, $minimum,
357 $maximum, $default_value, $flags)
358 • $name (string)
359
360 • $nick (string)
361
362 • $blurb (string)
363
364 • $minimum (unsigned)
365
366 • $maximum (unsigned)
367
368 • $default_value (unsigned)
369
370 • $flags (Glib::ParamFlags)
371
372 paramspec = Glib::ParamSpec->unichar ($name, $nick, $blurb, $default_value,
373 $flags)
374 • $name (string)
375
376 • $nick (string)
377
378 • $blurb (string)
379
380 • $default_value (character)
381
382 • $flags (Glib::ParamFlags)
383
384 string = $pspec->get_value_type
385 bool = $paramspec->value_validate ($value)
386 (bool, newval) = $paramspec->value_validate ($value)
387 • $value (scalar)
388
389 In scalar context return true if $value must be modified to be valid
390 for $paramspec, or false if it's valid already. In array context
391 return also a new value which is $value made valid.
392
393 $value must be the right type for $paramspec (with usual stringizing,
394 numizing, etc). "value_validate" checks the further restrictions such
395 as minimum and maximum for a numeric type or allowed characters in a
396 string. The "made valid" return is then for instance clamped to the
397 min/max, or offending chars replaced by a substitutor.
398
399 integer = $pspec->values_cmp ($value1, $value2)
400 • $value1 (scalar)
401
402 • $value2 (scalar)
403
404 Compares value1 with value2 according to pspec, and returns -1, 0 or
405 +1, if value1 is found to be less than, equal to or greater than
406 value2, respectively.
407
409 flags Glib::ParamFlags
410 • 'readable' / 'G_PARAM_READABLE'
411
412 • 'writable' / 'G_PARAM_WRITABLE'
413
414 • 'construct' / 'G_PARAM_CONSTRUCT'
415
416 • 'construct-only' / 'G_PARAM_CONSTRUCT_ONLY'
417
418 • 'lax-validation' / 'G_PARAM_LAX_VALIDATION'
419
420 • 'private' / 'G_PARAM_PRIVATE'
421
422 • 'static-name' / 'G_PARAM_STATIC_NAME'
423
424 • 'static-nick' / 'G_PARAM_STATIC_NICK'
425
426 • 'static-blurb' / 'G_PARAM_STATIC_BLURB'
427
428 • 'explicit-notify' / 'G_PARAM_EXPLICIT_NOTIFY'
429
430 • 'deprecated' / 'G_PARAM_DEPRECATED'
431
433 Glib
434
436 Copyright (C) 2003-2011 by the gtk2-perl team.
437
438 This software is licensed under the LGPL. See Glib for a full notice.
439
440
441
442perl v5.32.1 2021-01-27 Glib::ParamSpec(3)