Gtk2
view release on metacpan or search on metacpan
xs/GtkBuildable.xs view on Meta::CPAN
# allow the Buildable to handle its own tags during parsing. Unless somebody
# wants to reimplement GtkBuilder in perl code, these won't be useful.
# Besides, the dependency on GMarkupParser is a bit problematic.
#
# gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, GMarkupParser *parser, gpointer *data);
# void gtk_buildable_custom_tag_end (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, gpointer *data);
# void gtk_buildable_custom_finished (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, gpointer data);
=for apidoc __hide__
=cut
void gtk_buildable_parser_finished (GtkBuildable *buildable, GtkBuilder *builder);
=for apidoc __hide__
=cut
GObject * gtk_buildable_get_internal_child (GtkBuildable *buildable, GtkBuilder *builder, const gchar *childname);
MODULE = Gtk2::Buildable PACKAGE = Gtk2::Buildable::ParseContext PREFIX = g_markup_parse_context_
#
# NOTE: This is a minimal binding for the parts of GMarkupParseContext
# a user would need from the Buildable custom tag handlers.
# Should GMarkupParseContext be bound in Glib, remove these methods
# and have Gtk2::Builder::ParseContext inherit them from Glib.
#
=for object Gtk2::Buildable::ParseContext
=head1 DESCRIPTION
This object contains context of the XML subset parser used by Gtk2::Builder.
Objects of this type will be passed to the methods invoked on the parser
returned from your Gtk2::Buildable's C<CUSTOM_TAG_START>. You should use
these methods to create useful error messages, as necessary.
=cut
=for see_also Gtk2::Buildable
=cut
=for apidoc
=for signature string = $parse_context->get_element
Return the name of the currently open element.
=cut
const gchar * g_markup_parse_context_get_element (SV * sv);
C_ARGS:
SvGtkBuildableParseContext (sv)
#if GLIB_CHECK_VERSION(2, 16, 0)
=for apidoc
=for signature list = $parse_context->get_element_stack
Returns the element stack; the first item is the currently-open tag
(which would be returned by C<get_element()>), and the next item is
its immediate parent.
=cut
void g_markup_parse_context_get_element_stack (SV * sv);
PREINIT:
const GSList * list;
PPCODE:
list = g_markup_parse_context_get_element_stack
(SvGtkBuildableParseContext (sv));
while (list) {
XPUSHs (sv_2mortal (newSVGChar (list->data)));
list = list->next;
}
#endif
=for apidoc
=for signature (line_number, char_number) = $parse_context->get_position
=cut
void
g_markup_parse_context_get_position (SV * sv)
PREINIT:
int line_number;
int char_number;
PPCODE:
g_markup_parse_context_get_position (SvGtkBuildableParseContext (sv),
&line_number, &char_number);
EXTEND (SP, 2);
PUSHs (sv_2mortal (newSViv (line_number)));
PUSHs (sv_2mortal (newSViv (char_number)));
MODULE = Gtk2::Buildable PACKAGE = Gtk2::Buildable
=for position SYNOPSIS
=head1 SYNOPSIS
package Thing;
use Gtk2;
use Glib::Object::Subclass
Glib::Object::,
# Some signals and properties on the object...
signals => {
exploderize => {},
},
properties => [
Glib::ParamSpec->int ('force', 'Force',
'Explosive force, in megatons',
0, 1000000, 5, ['readable', 'writable']),
],
;
sub exploderize {
my $self = shift;
$self->signal_emit ('exploderize');
}
# We can accept all defaults for Buildable; see the description
# for details on custom XML.
package main;
use Gtk2 -init;
my $builder = Gtk2::Builder->new ();
$builder->add_from_string ('<interface>
<object class="Thing" id="thing1">
<property name="force">50</property>
<signal name="exploderize" handler="do_explode" />
</object>
</interface>');
$builder->connect_signals ();
my $thing = $builder->get_object ('thing1');
$thing->exploderize ();
sub do_explode {
my $thing = shift;
printf "boom * %d!\n", $thing->get ('force');
}
# This program prints "boom * 50!" on stdout.
=cut
( run in 0.716 second using v1.01-cache-2.11-cpan-5511b514fd6 )