162
161
* paramspec list returned from Glib::Object::list_properties())
163
162
* we store a few select keys in the hash directly.
165
gperl_hv_take_sv_s (property, "name",
166
newSVpv (g_param_spec_get_name (pspec), 0));
164
hv_store (property, "name", 4,
165
newSVpv (g_param_spec_get_name (pspec), 0), 0);
168
167
/* map type names to package names, if possible */
169
168
pv = gperl_package_from_type (pspec->value_type);
170
169
if (!pv) pv = g_type_name (pspec->value_type);
171
gperl_hv_take_sv_s (property, "type", newSVpv (pv, 0));
170
hv_store (property, "type", 4, newSVpv (pv, 0), 0);
173
172
pv = gperl_package_from_type (pspec->owner_type);
175
174
pv = g_type_name (pspec->owner_type);
177
gperl_hv_take_sv_s (property, "owner_type", newSVpv (pv, 0));
176
hv_store (property, "owner_type", 10, newSVpv (pv, 0), 0);
179
178
pv = g_param_spec_get_blurb (pspec);
180
if (pv) gperl_hv_take_sv_s (property, "descr", newSVpv (pv, 0));
181
gperl_hv_take_sv_s (property, "flags", newSVGParamFlags (pspec->flags));
179
if (pv) hv_store (property, "descr", 5, newSVpv (pv, 0), 0);
180
hv_store (property, "flags", 5, newSVGParamFlags (pspec->flags), 0) ;
183
182
/* wrap it, bless it, ship it. */
184
183
sv = newRV_noinc ((SV*)property);
266
265
#if GLIB_CHECK_VERSION(2,4,0)
267
266
gperl_register_param_spec (G_TYPE_PARAM_OVERRIDE, "Glib::Param::Override");
269
#if GLIB_CHECK_VERSION(2,10,0)
270
gperl_register_param_spec (G_TYPE_PARAM_GTYPE, "Glib::Param::GType");
273
269
=for enum Glib::ParamFlags
493
489
## GParamSpec* g_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, const gchar *default_value, GParamFlags flags)
495
## "default_value" can be NULL. Not actually described in the docs as
496
## of 2.18, but used that way in lots of the builtin classes
499
491
g_param_spec_string (class, name, nick, blurb, default_value, flags)
500
492
const gchar *name
501
493
const gchar *nick
502
494
const gchar *blurb
503
const gchar_ornull *default_value
495
const gchar *default_value
504
496
GParamFlags flags
506
498
name, nick, blurb, default_value, flags
579
571
### GParamSpec* g_param_spec_value_array (const gchar *name, const gchar *nick, const gchar *blurb, GParamSpec *element_spec, GParamFlags flags)
582
#if GLIB_CHECK_VERSION(2, 10, 0)
585
=for arg is_a_type The name of a class whose subtypes are allowed as values of the property. Use C<undef> to allow any type.
588
g_param_spec_gtype (class, name, nick, blurb, is_a_type, flags)
592
const gchar_ornull *is_a_type
595
name, nick, blurb, is_a_type ? gperl_type_from_package (is_a_type) : G_TYPE_NONE, flags
1240
1215
## G_TYPE_PARAM_POINTER, "Glib::Param::Pointer" -- no members
1241
1216
## G_TYPE_PARAM_OBJECT, "Glib::Param::Object" -- no members
1242
1217
## G_TYPE_PARAM_OVERRIDE, "Glib::Param::Override" -- no public members
1245
MODULE = Glib::ParamSpec PACKAGE = Glib::Param::GType
1247
=for object Glib::Param::GType Wrapper for GType parameters in GLib
1250
#if GLIB_CHECK_VERSION(2, 10, 0)
1252
=for section DESCRIPTION
1256
This object describes a parameter which holds the name of a class known to the
1257
GLib type system. The name of the class is considered to be the common
1258
ancestor for valid values. To create a param that allows any type name,
1259
specify C<undef> for the package name. Beware, however, that although
1260
we say "any type name", this actually refers to any type registered
1261
with Glib; normal Perl packages will not work.
1266
If C<undef>, then any class is allowed.
1268
const gchar_ornull *
1269
get_is_a_type (GParamSpec * pspec_gtype)
1271
GParamSpecGType * p = G_PARAM_SPEC_GTYPE (pspec_gtype);
1272
RETVAL = p->is_a_type == G_TYPE_NONE
1274
: gperl_package_from_type (p->is_a_type);