Gtk2

 view release on metacpan or  search on metacpan

xs/Gtk2.xs  view on Meta::CPAN

BOOT:
	{
	/* include some files autogenerated by Makefile.PL. */
	/* register Gtk/Gdk/Atk/Pango classes as perl packages.
	 * be sure to include this autogenerated set first, so that the
	 * hand-written boot code functions called by the next include
	 * can override the registrations if necessary. */
#include "register.xsh"
	/* call the boot code for all the various other modules */
#include "boot.xsh"
	/* route Gtk+ log messages through perl's warn() and croak() */
	gperl_handle_logs_for ("Gtk");
	gperl_handle_logs_for ("Gdk");
	gperl_handle_logs_for ("GdkPixbuf");

	/* make sure that we're running/linked against a version at least as 
	 * new as we built against, otherwise bad things can happen. */
	if ((((int)gtk_major_version) < GTK_MAJOR_VERSION)
	    ||
	    (gtk_major_version == GTK_MAJOR_VERSION && 
	     ((int)gtk_minor_version) < GTK_MINOR_VERSION)
	    ||
	    (gtk_major_version == GTK_MAJOR_VERSION && 
	     gtk_minor_version == GTK_MINOR_VERSION &&
	     ((int)gtk_micro_version) < GTK_MICRO_VERSION))
		warn ("*** This build of Gtk2 was compiled with gtk+ %d.%d.%d,"
		      " but is currently running with %d.%d.%d, which is too"
		      " old.  We'll continue, but expect problems!\n",
		      GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
		      gtk_major_version, gtk_minor_version, gtk_micro_version);
	}

#############################################################################
#############################################################################

=for object Gtk2::version Library Version Information
=cut

=head1 SYNOPSIS

  use Gtk2 '1.023';  # require at least version 1.023 of the bindings

  if ($Gtk2::VERSION >= 1.040 and Gtk2->CHECK_VERSION (2, 4, 0)) {
     # the GtkFileChooser, new in gtk+ 2.4.0 and first supported in
     # Gtk2-Perl at 1.040, is available
  } else {
     # GtkFileChooser is not available, fall back to GtkFileSelection
  }

=head1 DESCRIPTION

Since the Gtk2 Perl module is a bridge to an external library with its own
versions and API revisions, we have three different versions available for
inspection.  Which one you need to use at which time depends entirely on
the situation.  Gtk2 uses the same scheme as Glib and the underlying gtk+
C library; that is, the standard
C<$Gtk2::VERSION> for the version of the bindings, all-caps
(MAJOR|MINOR|MICRO)_VERSION functions for the bound version, and
lower-case (major|minor|micro)_version functions for the runtime version.
See L<Glib::version> and
L<http://developer.gnome.org/doc/API/2.0/gtk/gtk-Feature-Test-Macros.html>
for more information.

Note also that gtk_check_version() and GTK_CHECK_VERSION() have different
semantics in C, and we have preserved those faithfully.

=cut

=for see_also Glib::version
=cut

  # we have no use for these in perl.
 ##GTKMAIN_C_VAR const guint gtk_binary_age;
 ##GTKMAIN_C_VAR const guint gtk_interface_age;

=for apidoc
=for signature (major, minor, micro) = Gtk2->get_version_info
Shorthand to fetch as a list the gtk+ version against which Gtk2 is linked.
See C<Gtk2::major_version>, etc.
=cut
void
gtk_get_version_info (class)
    PPCODE:
	EXTEND(SP,3);
	PUSHs(sv_2mortal(newSViv(gtk_major_version)));
	PUSHs(sv_2mortal(newSViv(gtk_minor_version)));
	PUSHs(sv_2mortal(newSViv(gtk_micro_version)));
	PERL_UNUSED_VAR (ax);

=for apidoc
Returns undef if the version of gtk+ currently in use is compatible with the
given version, otherwise returns a string describing the mismatch.  Note that
this is not the same logic as C<Gtk2::CHECK_VERSION>.  This check is not
terribly reliable, and should not be used to test for availability of widgets
or functions in the Gtk2 module --- use C<Gtk2::CHECK_VERSION> for that.
See L<Glib::version> for a more detailed description of when you'd want to
do a runtime-version test.
=cut
gchar * 
gtk_check_version (class, required_major, required_minor, required_micro)
	guint   required_major
	guint   required_minor
	guint   required_micro
    CODE:
	RETVAL = (gchar *) gtk_check_version (required_major, required_minor, required_micro);
    OUTPUT:
	RETVAL

=for apidoc Gtk2::MAJOR_VERSION __function__
The major version of the gtk+ library against which Gtk2 was compiled.
Equivalent to gtk+'s GTK_MAJOR_VERSION.
=cut

=for apidoc Gtk2::MINOR_VERSION __function__
The minor version of the gtk+ library against which Gtk2 was compiled.
Equivalent to gtk+'s GTK_MINOR_VERSION.
=cut

=for apidoc Gtk2::MICRO_VERSION __function__
The micro version of the gtk+ library against which Gtk2 was compiled.
Equivalent to gtk+'s GTK_MICRO_VERSION.



( run in 1.995 second using v1.01-cache-2.11-cpan-0d23b851a93 )